Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:26

0001 // Copyright 2021 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
0004 
0005 #ifndef INCLUDE_V8_PRIMITIVE_OBJECT_H_
0006 #define INCLUDE_V8_PRIMITIVE_OBJECT_H_
0007 
0008 #include "v8-local-handle.h"  // NOLINT(build/include_directory)
0009 #include "v8-object.h"        // NOLINT(build/include_directory)
0010 #include "v8config.h"         // NOLINT(build/include_directory)
0011 
0012 namespace v8 {
0013 
0014 class Isolate;
0015 
0016 /**
0017  * A Number object (ECMA-262, 4.3.21).
0018  */
0019 class V8_EXPORT NumberObject : public Object {
0020  public:
0021   static Local<Value> New(Isolate* isolate, double value);
0022 
0023   double ValueOf() const;
0024 
0025   V8_INLINE static NumberObject* Cast(Value* value) {
0026 #ifdef V8_ENABLE_CHECKS
0027     CheckCast(value);
0028 #endif
0029     return static_cast<NumberObject*>(value);
0030   }
0031 
0032  private:
0033   static void CheckCast(Value* obj);
0034 };
0035 
0036 /**
0037  * A BigInt object (https://tc39.github.io/proposal-bigint)
0038  */
0039 class V8_EXPORT BigIntObject : public Object {
0040  public:
0041   static Local<Value> New(Isolate* isolate, int64_t value);
0042 
0043   Local<BigInt> ValueOf() const;
0044 
0045   V8_INLINE static BigIntObject* Cast(Value* value) {
0046 #ifdef V8_ENABLE_CHECKS
0047     CheckCast(value);
0048 #endif
0049     return static_cast<BigIntObject*>(value);
0050   }
0051 
0052  private:
0053   static void CheckCast(Value* obj);
0054 };
0055 
0056 /**
0057  * A Boolean object (ECMA-262, 4.3.15).
0058  */
0059 class V8_EXPORT BooleanObject : public Object {
0060  public:
0061   static Local<Value> New(Isolate* isolate, bool value);
0062 
0063   bool ValueOf() const;
0064 
0065   V8_INLINE static BooleanObject* Cast(Value* value) {
0066 #ifdef V8_ENABLE_CHECKS
0067     CheckCast(value);
0068 #endif
0069     return static_cast<BooleanObject*>(value);
0070   }
0071 
0072  private:
0073   static void CheckCast(Value* obj);
0074 };
0075 
0076 /**
0077  * A String object (ECMA-262, 4.3.18).
0078  */
0079 class V8_EXPORT StringObject : public Object {
0080  public:
0081   static Local<Value> New(Isolate* isolate, Local<String> value);
0082 
0083   Local<String> ValueOf() const;
0084 
0085   V8_INLINE static StringObject* Cast(Value* value) {
0086 #ifdef V8_ENABLE_CHECKS
0087     CheckCast(value);
0088 #endif
0089     return static_cast<StringObject*>(value);
0090   }
0091 
0092  private:
0093   static void CheckCast(Value* obj);
0094 };
0095 
0096 /**
0097  * A Symbol object (ECMA-262 edition 6).
0098  */
0099 class V8_EXPORT SymbolObject : public Object {
0100  public:
0101   static Local<Value> New(Isolate* isolate, Local<Symbol> value);
0102 
0103   Local<Symbol> ValueOf() const;
0104 
0105   V8_INLINE static SymbolObject* Cast(Value* value) {
0106 #ifdef V8_ENABLE_CHECKS
0107     CheckCast(value);
0108 #endif
0109     return static_cast<SymbolObject*>(value);
0110   }
0111 
0112  private:
0113   static void CheckCast(Value* obj);
0114 };
0115 
0116 }  // namespace v8
0117 
0118 #endif  // INCLUDE_V8_PRIMITIVE_OBJECT_H_