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
8 #include "src/heap/heap-write-barrier-inl.h"
9 #include "src/objects/call-site-info.h"
10 #include "src/objects/objects-inl.h"
11 #include "src/objects/struct-inl.h"
12
13 // Has to be the last include (doesn't have include guards):
14 #include "src/objects/object-macros.h"
15
16 namespace v8 {
17 namespace internal {
18
19 #include "torque-generated/src/objects/call-site-info-tq-inl.inc"
20
21 TQ_OBJECT_CONSTRUCTORS_IMPL(CallSiteInfo)
NEVER_READ_ONLY_SPACE_IMPL(CallSiteInfo)22 NEVER_READ_ONLY_SPACE_IMPL(CallSiteInfo)
23
24 #if V8_ENABLE_WEBASSEMBLY
25 BOOL_GETTER(CallSiteInfo, flags, IsWasm, IsWasmBit::kShift)
26 BOOL_GETTER(CallSiteInfo, flags, IsAsmJsWasm, IsAsmJsWasmBit::kShift)
27 BOOL_GETTER(CallSiteInfo, flags, IsAsmJsAtNumberConversion,
28 IsAsmJsAtNumberConversionBit::kShift)
29 #endif // V8_ENABLE_WEBASSEMBLY
30 BOOL_GETTER(CallSiteInfo, flags, IsStrict, IsStrictBit::kShift)
31 BOOL_GETTER(CallSiteInfo, flags, IsConstructor, IsConstructorBit::kShift)
32 BOOL_GETTER(CallSiteInfo, flags, IsAsync, IsAsyncBit::kShift)
33
34 DEF_GETTER(CallSiteInfo, code_object, HeapObject) {
35 HeapObject value = TorqueGeneratedClass::code_object(cage_base);
36 // The |code_object| field can contain many types of objects, but only CodeT
37 // values have to be converted to Code.
38 if (V8_EXTERNAL_CODE_SPACE_BOOL && value.IsCodeT()) {
39 return FromCodeT(CodeT::cast(value));
40 }
41 return value;
42 }
43
set_code_object(HeapObject code,WriteBarrierMode mode)44 void CallSiteInfo::set_code_object(HeapObject code, WriteBarrierMode mode) {
45 // The |code_object| field can contain many types of objects, but only Code
46 // values have to be converted to CodeT.
47 if (V8_EXTERNAL_CODE_SPACE_BOOL && code.IsCode()) {
48 TorqueGeneratedClass::set_code_object(ToCodeT(Code::cast(code)), mode);
49 } else {
50 TorqueGeneratedClass::set_code_object(code, mode);
51 }
52 }
53
54 } // namespace internal
55 } // namespace v8
56
57 #include "src/objects/object-macros-undef.h"
58
59 #endif // V8_OBJECTS_CALL_SITE_INFO_INL_H_
60