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

Side by Side Diff: src/snapshot/serializer-common.h

Issue 1812853002: Moved the ExternalReferenceTable class to src/external-reference-table.cc/.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 9 months 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/snapshot/deserializer.cc ('k') | src/snapshot/serializer-common.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_SNAPSHOT_SERIALIZER_COMMON_H_ 5 #ifndef V8_SNAPSHOT_SERIALIZER_COMMON_H_
6 #define V8_SNAPSHOT_SERIALIZER_COMMON_H_ 6 #define V8_SNAPSHOT_SERIALIZER_COMMON_H_
7 7
8 #include "src/address-map.h" 8 #include "src/address-map.h"
9 #include "src/external-reference-table.h"
9 #include "src/globals.h" 10 #include "src/globals.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 class Isolate; 15 class Isolate;
15 16
16 // ExternalReferenceTable is a helper class that defines the relationship
17 // between external references and their encodings. It is used to build
18 // hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder.
19 class ExternalReferenceTable {
20 public:
21 static ExternalReferenceTable* instance(Isolate* isolate);
22
23 int size() const { return refs_.length(); }
24 Address address(int i) { return refs_[i].address; }
25 const char* name(int i) { return refs_[i].name; }
26
27 inline static Address NotAvailable() { return NULL; }
28
29 static const int kDeoptTableSerializeEntryCount = 64;
30
31 private:
32 struct ExternalReferenceEntry {
33 Address address;
34 const char* name;
35 };
36
37 explicit ExternalReferenceTable(Isolate* isolate);
38
39 void Add(Address address, const char* name) {
40 ExternalReferenceEntry entry = {address, name};
41 refs_.Add(entry);
42 }
43
44 List<ExternalReferenceEntry> refs_;
45
46 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable);
47 };
48
49 class ExternalReferenceEncoder { 17 class ExternalReferenceEncoder {
50 public: 18 public:
51 explicit ExternalReferenceEncoder(Isolate* isolate); 19 explicit ExternalReferenceEncoder(Isolate* isolate);
52 20
53 uint32_t Encode(Address key) const; 21 uint32_t Encode(Address key) const;
54 22
55 const char* NameOfAddress(Isolate* isolate, Address address) const; 23 const char* NameOfAddress(Isolate* isolate, Address address) const;
56 24
57 private: 25 private:
58 static uint32_t Hash(Address key) { 26 static uint32_t Hash(Address key) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 281
314 byte* data_; 282 byte* data_;
315 int size_; 283 int size_;
316 bool owns_data_; 284 bool owns_data_;
317 }; 285 };
318 286
319 } // namespace internal 287 } // namespace internal
320 } // namespace v8 288 } // namespace v8
321 289
322 #endif // V8_SNAPSHOT_SERIALIZER_COMMON_H_ 290 #endif // V8_SNAPSHOT_SERIALIZER_COMMON_H_
OLDNEW
« no previous file with comments | « src/snapshot/deserializer.cc ('k') | src/snapshot/serializer-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698