v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
call-site-info-inl.h
Go to the documentation of this file.
1// Copyright 2018 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_CALL_SITE_INFO_INL_H_
6#define V8_OBJECTS_CALL_SITE_INFO_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
14
15// Has to be the last include (doesn't have include guards):
17
18namespace v8 {
19namespace internal {
20
21#include "torque-generated/src/objects/call-site-info-tq-inl.inc"
22
25
26#if V8_ENABLE_WEBASSEMBLY
27BOOL_GETTER(CallSiteInfo, flags, IsWasm, IsWasmBit::kShift)
28BOOL_GETTER(CallSiteInfo, flags, IsAsmJsWasm, IsAsmJsWasmBit::kShift)
29BOOL_GETTER(CallSiteInfo, flags, IsAsmJsAtNumberConversion,
30 IsAsmJsAtNumberConversionBit::kShift)
31#if V8_ENABLE_DRUMBRAKE
32BOOL_GETTER(CallSiteInfo, flags, IsWasmInterpretedFrame,
33 IsWasmInterpretedFrameBit::kShift)
34#endif // V8_ENABLE_DRUMBRAKE
35BOOL_GETTER(CallSiteInfo, flags, IsBuiltin, IsBuiltinBit::kShift)
36#endif // V8_ENABLE_WEBASSEMBLY
37BOOL_GETTER(CallSiteInfo, flags, IsStrict, IsStrictBit::kShift)
38BOOL_GETTER(CallSiteInfo, flags, IsConstructor, IsConstructorBit::kShift)
39BOOL_GETTER(CallSiteInfo, flags, IsAsync, IsAsyncBit::kShift)
40
41Tagged<HeapObject> CallSiteInfo::code_object(IsolateForSandbox isolate) const {
42 DCHECK(!IsTrustedPointerFieldEmpty(kCodeObjectOffset));
43 // The field can contain either a Code or a BytecodeArray, so we need to use
44 // the kUnknownIndirectPointerTag. Since we can then no longer rely on the
45 // type-checking mechanism of trusted pointers we need to perform manual type
46 // checks afterwards.
47 Tagged<HeapObject> code_object =
48 ReadTrustedPointerField<kUnknownIndirectPointerTag>(kCodeObjectOffset,
49 isolate);
50 CHECK(IsCode(code_object) || IsBytecodeArray(code_object));
51 return code_object;
52}
53
55 WriteBarrierMode mode) {
56 DCHECK(IsCode(code) || IsBytecodeArray(code) || IsUndefined(code));
57 if (IsCode(code) || IsBytecodeArray(code)) {
58 WriteTrustedPointerField<kUnknownIndirectPointerTag>(
59 kCodeObjectOffset, Cast<ExposedTrustedObject>(code));
61 *this, kCodeObjectOffset, kUnknownIndirectPointerTag, code, mode);
62 } else {
63 DCHECK(IsUndefined(code));
64 ClearTrustedPointerField(kCodeObjectOffset);
65 }
66}
67
68} // namespace internal
69} // namespace v8
70
72
73#endif // V8_OBJECTS_CALL_SITE_INFO_INL_H_
void set_code_object(Tagged< HeapObject > code, WriteBarrierMode mode)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
#define CONDITIONAL_TRUSTED_POINTER_WRITE_BARRIER(object, offset, tag, value, mode)
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)
#define BOOL_GETTER(holder, field, name, offset)
#define NEVER_READ_ONLY_SPACE_IMPL(Type)
#define CHECK(condition)
Definition logging.h:124
#define DCHECK(condition)
Definition logging.h:482