v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
hole.h
Go to the documentation of this file.
1// Copyright 2023 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 V8_OBJECTS_HOLE_H_
6#define V8_OBJECTS_HOLE_H_
7
10
11// Has to be the last include (doesn't have include guards):
13
14namespace v8 {
15namespace internal {
16
17#include "torque-generated/src/objects/hole-tq.inc"
18
19class Hole : public HeapObject {
20 public:
21 inline void set_raw_numeric_value(uint64_t bits);
22
24
25 static inline void Initialize(Isolate* isolate, DirectHandle<Hole> hole,
26 DirectHandle<HeapNumber> numeric_value);
27
28 // Currently, we allow optimized code to treat holes as HeapNumbers to avoid
29 // conditional branching. This works by making Hole::kRawNumericValueOffset
30 // the same as offsetof(HeapNumber, value_) and storing NaN at that offset in
31 // Holes. This way, a hole will look like a NaN HeapNumber to optimized code.
32 DECL_FIELD_OFFSET_TQ(RawNumericValue, HeapObject::kHeaderSize, "float64")
33 static constexpr int kSize = kRawNumericValueOffset + kDoubleSize;
34
36
38
40};
41
42} // namespace internal
43} // namespace v8
44
45#include "src/objects/object-macros-undef.h"
46
47#endif // V8_OBJECTS_HOLE_H_
static constexpr int kHeaderSize
void set_raw_numeric_value(uint64_t bits)
Definition hole-inl.h:26
static void Initialize(Isolate *isolate, DirectHandle< Hole > hole, DirectHandle< HeapNumber > numeric_value)
Definition hole-inl.h:31
static constexpr int kSize
Definition hole.h:33
constexpr int kDoubleSize
Definition globals.h:407
#define DECL_VERIFIER(Name)
#define DECL_PRINTER(Name)
#define DECL_FIELD_OFFSET_TQ(name, value, tq_type)
#define OBJECT_CONSTRUCTORS(Type,...)