Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: src/external-reference-table.h

Issue 2490783004: [serializer] small fixes for blink snapshot. (Closed)
Patch Set: rebase and fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/external-reference-table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 int size() const { return refs_.length(); } 22 uint32_t size() const { return static_cast<uint32_t>(refs_.length()); }
23 Address address(int i) { return refs_[i].address; } 23 Address address(uint32_t i) { return refs_[i].address; }
24 const char* name(int i) { return refs_[i].name; } 24 const char* name(uint32_t i) { return refs_[i].name; }
25
26 inline static Address NotAvailable() { return NULL; }
27 25
28 static const int kDeoptTableSerializeEntryCount = 64; 26 static const int kDeoptTableSerializeEntryCount = 64;
29 27
30 private: 28 private:
31 struct ExternalReferenceEntry { 29 struct ExternalReferenceEntry {
32 Address address; 30 Address address;
33 const char* name; 31 const char* name;
34 }; 32 };
35 33
36 explicit ExternalReferenceTable(Isolate* isolate); 34 explicit ExternalReferenceTable(Isolate* isolate);
37 35
38 void Add(Address address, const char* name) { 36 void Add(Address address, const char* name) {
39 ExternalReferenceEntry entry = {address, name}; 37 ExternalReferenceEntry entry = {address, name};
40 refs_.Add(entry); 38 refs_.Add(entry);
41 } 39 }
42 40
43 void AddReferences(Isolate* isolate); 41 void AddReferences(Isolate* isolate);
44 void AddBuiltins(Isolate* isolate); 42 void AddBuiltins(Isolate* isolate);
45 void AddRuntimeFunctions(Isolate* isolate); 43 void AddRuntimeFunctions(Isolate* isolate);
46 void AddStatCounters(Isolate* isolate);
47 void AddIsolateAddresses(Isolate* isolate); 44 void AddIsolateAddresses(Isolate* isolate);
48 void AddAccessors(Isolate* isolate); 45 void AddAccessors(Isolate* isolate);
49 void AddStubCache(Isolate* isolate); 46 void AddStubCache(Isolate* isolate);
50 void AddDeoptEntries(Isolate* isolate); 47 void AddDeoptEntries(Isolate* isolate);
51 void AddApiReferences(Isolate* isolate); 48 void AddApiReferences(Isolate* isolate);
52 49
53 List<ExternalReferenceEntry> refs_; 50 List<ExternalReferenceEntry> refs_;
54 51
55 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); 52 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable);
56 }; 53 };
57 54
58 } // namespace internal 55 } // namespace internal
59 } // namespace v8 56 } // namespace v8
60 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ 57 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/external-reference-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698