5 #ifndef V8_EXTERNAL_REFERENCE_TABLE_H_ 6 #define V8_EXTERNAL_REFERENCE_TABLE_H_ 10 #include "src/accessors.h" 11 #include "src/builtins/builtins.h" 12 #include "src/external-reference.h" 25 static constexpr
int kSpecialReferenceCount = 1;
26 static constexpr
int kExternalReferenceCount =
27 ExternalReference::kExternalReferenceCount;
28 static constexpr
int kBuiltinsReferenceCount =
29 #define COUNT_C_BUILTIN(...) +1 30 BUILTIN_LIST_C(COUNT_C_BUILTIN);
31 #undef COUNT_C_BUILTIN 32 static constexpr
int kRuntimeReferenceCount =
33 Runtime::kNumFunctions -
34 Runtime::kNumInlineFunctions;
35 static constexpr
int kIsolateAddressReferenceCount = kIsolateAddressCount;
36 static constexpr
int kAccessorReferenceCount =
37 Accessors::kAccessorInfoCount + Accessors::kAccessorSetterCount;
39 static constexpr
int kStubCacheReferenceCount = 12;
40 static constexpr
int kSize =
41 kSpecialReferenceCount + kExternalReferenceCount +
42 kBuiltinsReferenceCount + kRuntimeReferenceCount +
43 kIsolateAddressReferenceCount + kAccessorReferenceCount +
44 kStubCacheReferenceCount;
48 const char* name(
uint32_t i) {
return refs_[
i].name; }
50 bool is_initialized()
const {
return is_initialized_ != 0; }
52 static const char* ResolveSymbol(
void* address);
54 static constexpr
uint32_t EntrySize() {
55 return sizeof(ExternalReferenceEntry);
60 STATIC_ASSERT(offsetof(ExternalReferenceEntry, address) == 0);
61 return i * EntrySize();
64 const char* NameFromOffset(
uint32_t offset) {
65 DCHECK_EQ(offset % EntrySize(), 0);
66 DCHECK_LT(offset, SizeInBytes());
67 int index = offset / EntrySize();
71 static constexpr
uint32_t SizeInBytes() {
72 STATIC_ASSERT(OffsetOfEntry(size()) + 2 * kUInt32Size ==
74 return OffsetOfEntry(size()) + 2 * kUInt32Size;
81 struct ExternalReferenceEntry {
85 ExternalReferenceEntry() : address(kNullAddress), name(
nullptr) {}
86 ExternalReferenceEntry(
Address address,
const char* name)
87 : address(address), name(name) {}
90 void Add(
Address address,
const char* name,
int* index);
92 void AddReferences(
Isolate* isolate,
int* index);
93 void AddBuiltins(
int* index);
94 void AddRuntimeFunctions(
int* index);
95 void AddIsolateAddresses(
Isolate* isolate,
int* index);
96 void AddAccessors(
int* index);
97 void AddStubCache(
Isolate* isolate,
int* index);
99 ExternalReferenceEntry refs_[kSize];
108 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_