Coverage Report

Created: 2025-07-04 09:33

/src/node/deps/v8/include/v8-primitive-object.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2021 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef INCLUDE_V8_PRIMITIVE_OBJECT_H_
6
#define INCLUDE_V8_PRIMITIVE_OBJECT_H_
7
8
#include "v8-local-handle.h"  // NOLINT(build/include_directory)
9
#include "v8-object.h"        // NOLINT(build/include_directory)
10
#include "v8config.h"         // NOLINT(build/include_directory)
11
12
namespace v8 {
13
14
class Isolate;
15
16
/**
17
 * A Number object (ECMA-262, 4.3.21).
18
 */
19
class V8_EXPORT NumberObject : public Object {
20
 public:
21
  static Local<Value> New(Isolate* isolate, double value);
22
23
  double ValueOf() const;
24
25
0
  V8_INLINE static NumberObject* Cast(Value* value) {
26
0
#ifdef V8_ENABLE_CHECKS
27
0
    CheckCast(value);
28
0
#endif
29
0
    return static_cast<NumberObject*>(value);
30
0
  }
31
32
 private:
33
  static void CheckCast(Value* obj);
34
};
35
36
/**
37
 * A BigInt object (https://tc39.github.io/proposal-bigint)
38
 */
39
class V8_EXPORT BigIntObject : public Object {
40
 public:
41
  static Local<Value> New(Isolate* isolate, int64_t value);
42
43
  Local<BigInt> ValueOf() const;
44
45
0
  V8_INLINE static BigIntObject* Cast(Value* value) {
46
0
#ifdef V8_ENABLE_CHECKS
47
0
    CheckCast(value);
48
0
#endif
49
0
    return static_cast<BigIntObject*>(value);
50
0
  }
51
52
 private:
53
  static void CheckCast(Value* obj);
54
};
55
56
/**
57
 * A Boolean object (ECMA-262, 4.3.15).
58
 */
59
class V8_EXPORT BooleanObject : public Object {
60
 public:
61
  static Local<Value> New(Isolate* isolate, bool value);
62
63
  bool ValueOf() const;
64
65
0
  V8_INLINE static BooleanObject* Cast(Value* value) {
66
0
#ifdef V8_ENABLE_CHECKS
67
0
    CheckCast(value);
68
0
#endif
69
0
    return static_cast<BooleanObject*>(value);
70
0
  }
71
72
 private:
73
  static void CheckCast(Value* obj);
74
};
75
76
/**
77
 * A String object (ECMA-262, 4.3.18).
78
 */
79
class V8_EXPORT StringObject : public Object {
80
 public:
81
  static Local<Value> New(Isolate* isolate, Local<String> value);
82
83
  Local<String> ValueOf() const;
84
85
0
  V8_INLINE static StringObject* Cast(Value* value) {
86
0
#ifdef V8_ENABLE_CHECKS
87
0
    CheckCast(value);
88
0
#endif
89
0
    return static_cast<StringObject*>(value);
90
0
  }
91
92
 private:
93
  static void CheckCast(Value* obj);
94
};
95
96
/**
97
 * A Symbol object (ECMA-262 edition 6).
98
 */
99
class V8_EXPORT SymbolObject : public Object {
100
 public:
101
  static Local<Value> New(Isolate* isolate, Local<Symbol> value);
102
103
  Local<Symbol> ValueOf() const;
104
105
0
  V8_INLINE static SymbolObject* Cast(Value* value) {
106
0
#ifdef V8_ENABLE_CHECKS
107
0
    CheckCast(value);
108
0
#endif
109
0
    return static_cast<SymbolObject*>(value);
110
0
  }
111
112
 private:
113
  static void CheckCast(Value* obj);
114
};
115
116
}  // namespace v8
117
118
#endif  // INCLUDE_V8_PRIMITIVE_OBJECT_H_