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 { |
(...skipping 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 #ifdef DEBUG | 28 #ifdef DEBUG |
29 void increment_count(uint32_t i) { refs_[i].count++; } | 29 void increment_count(uint32_t i) { refs_[i].count++; } |
30 int count(uint32_t i) { return refs_[i].count; } | 30 int count(uint32_t i) { return refs_[i].count; } |
31 void ResetCount(); | 31 void ResetCount(); |
32 void PrintCount(); | 32 void PrintCount(); |
33 #endif // DEBUG | 33 #endif // DEBUG |
34 | 34 |
35 static const char* ResolveSymbol(void* address); | 35 static const char* ResolveSymbol(void* address); |
36 | 36 |
37 static const int kDeoptTableSerializeEntryCount = 64; | 37 // NOTE: SnapshotByteSink::PutInt reserves top 2 bits of integer |
38 static const uint32_t kSpecialIdMask = 7 << 27; | |
39 static const uint32_t kEagerDeoptFlag = 1 << 27; | |
40 static const uint32_t kLazyDeoptFlag = 2 << 27; | |
41 static const uint32_t kSoftDeoptFlag = 3 << 27; | |
Yang
2017/03/31 06:58:16
We can have at most 16k entries. See Deoptimizer::
| |
38 | 42 |
39 private: | 43 private: |
40 struct ExternalReferenceEntry { | 44 struct ExternalReferenceEntry { |
41 Address address; | 45 Address address; |
42 const char* name; | 46 const char* name; |
43 #ifdef DEBUG | 47 #ifdef DEBUG |
44 int count; | 48 int count; |
45 #endif // DEBUG | 49 #endif // DEBUG |
46 }; | 50 }; |
47 | 51 |
48 explicit ExternalReferenceTable(Isolate* isolate); | 52 explicit ExternalReferenceTable(Isolate* isolate); |
49 | 53 |
50 void Add(Address address, const char* name) { | 54 void Add(Address address, const char* name) { |
51 #ifdef DEBUG | 55 #ifdef DEBUG |
52 ExternalReferenceEntry entry = {address, name, 0}; | 56 ExternalReferenceEntry entry = {address, name, 0}; |
53 #else | 57 #else |
54 ExternalReferenceEntry entry = {address, name}; | 58 ExternalReferenceEntry entry = {address, name}; |
55 #endif // DEBUG | 59 #endif // DEBUG |
56 refs_.Add(entry); | 60 refs_.Add(entry); |
57 } | 61 } |
58 | 62 |
59 void AddReferences(Isolate* isolate); | 63 void AddReferences(Isolate* isolate); |
60 void AddBuiltins(Isolate* isolate); | 64 void AddBuiltins(Isolate* isolate); |
61 void AddRuntimeFunctions(Isolate* isolate); | 65 void AddRuntimeFunctions(Isolate* isolate); |
62 void AddIsolateAddresses(Isolate* isolate); | 66 void AddIsolateAddresses(Isolate* isolate); |
63 void AddAccessors(Isolate* isolate); | 67 void AddAccessors(Isolate* isolate); |
64 void AddStubCache(Isolate* isolate); | 68 void AddStubCache(Isolate* isolate); |
65 void AddDeoptEntries(Isolate* isolate); | |
66 void AddApiReferences(Isolate* isolate); | 69 void AddApiReferences(Isolate* isolate); |
67 | 70 |
68 List<ExternalReferenceEntry> refs_; | 71 List<ExternalReferenceEntry> refs_; |
69 uint32_t api_refs_start_; | 72 uint32_t api_refs_start_; |
70 | 73 |
71 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); | 74 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); |
72 }; | 75 }; |
73 | 76 |
74 } // namespace internal | 77 } // namespace internal |
75 } // namespace v8 | 78 } // namespace v8 |
76 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ | 79 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ |
OLD | NEW |