OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_EXTERNAL_REFERENCE_TABLE_H_ | 5 #ifndef V8_EXTERNAL_REFERENCE_TABLE_H_ |
6 #define V8_EXTERNAL_REFERENCE_TABLE_H_ | 6 #define V8_EXTERNAL_REFERENCE_TABLE_H_ |
7 | 7 |
8 #include "src/address-map.h" | 8 #include "src/address-map.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class Isolate; | 13 class Isolate; |
14 | 14 |
15 // ExternalReferenceTable is a helper class that defines the relationship | 15 // ExternalReferenceTable is a helper class that defines the relationship |
16 // between external references and their encodings. It is used to build | 16 // between external references and their encodings. It is used to build |
17 // hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder. | 17 // hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder. |
18 class ExternalReferenceTable { | 18 class ExternalReferenceTable { |
19 public: | 19 public: |
20 static ExternalReferenceTable* instance(Isolate* isolate); | 20 static ExternalReferenceTable* instance(Isolate* isolate); |
21 | 21 |
22 uint32_t size() const { return static_cast<uint32_t>(refs_.length()); } | 22 uint32_t size() const { return static_cast<uint32_t>(refs_.length()); } |
23 Address address(uint32_t i) { return refs_[i].address; } | 23 Address address(uint32_t i) { return refs_[i].address; } |
24 const char* name(uint32_t i) { return refs_[i].name; } | 24 const char* name(uint32_t i) { return refs_[i].name; } |
| 25 bool is_api_reference(uint32_t i) { return i >= api_refs_start_; } |
25 | 26 |
26 #ifdef DEBUG | 27 #ifdef DEBUG |
27 void increment_count(uint32_t i) { refs_[i].count++; } | 28 void increment_count(uint32_t i) { refs_[i].count++; } |
28 int count(uint32_t i) { return refs_[i].count; } | 29 int count(uint32_t i) { return refs_[i].count; } |
29 void ResetCount(); | 30 void ResetCount(); |
30 void PrintCount(); | 31 void PrintCount(); |
31 #endif // DEBUG | 32 #endif // DEBUG |
32 | 33 |
33 static const char* ResolveSymbol(void* address); | 34 static const char* ResolveSymbol(void* address); |
34 | 35 |
(...skipping 22 matching lines...) Expand all Loading... |
57 void AddReferences(Isolate* isolate); | 58 void AddReferences(Isolate* isolate); |
58 void AddBuiltins(Isolate* isolate); | 59 void AddBuiltins(Isolate* isolate); |
59 void AddRuntimeFunctions(Isolate* isolate); | 60 void AddRuntimeFunctions(Isolate* isolate); |
60 void AddIsolateAddresses(Isolate* isolate); | 61 void AddIsolateAddresses(Isolate* isolate); |
61 void AddAccessors(Isolate* isolate); | 62 void AddAccessors(Isolate* isolate); |
62 void AddStubCache(Isolate* isolate); | 63 void AddStubCache(Isolate* isolate); |
63 void AddDeoptEntries(Isolate* isolate); | 64 void AddDeoptEntries(Isolate* isolate); |
64 void AddApiReferences(Isolate* isolate); | 65 void AddApiReferences(Isolate* isolate); |
65 | 66 |
66 List<ExternalReferenceEntry> refs_; | 67 List<ExternalReferenceEntry> refs_; |
| 68 uint32_t api_refs_start_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); | 70 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace internal | 73 } // namespace internal |
72 } // namespace v8 | 74 } // namespace v8 |
73 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ | 75 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ |
OLD | NEW |