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

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

Issue 2495213003: [serializer] print use count of external references. (Closed)
Patch Set: fix build 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 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 25
26 #ifdef DEBUG
27 void increment_count(uint32_t i) { refs_[i].count++; }
28 int count(uint32_t i) { return refs_[i].count; }
29 void ResetCount();
30 void PrintCount();
31 #endif // DEBUG
32
33 static const char* ResolveSymbol(void* address);
34
26 static const int kDeoptTableSerializeEntryCount = 64; 35 static const int kDeoptTableSerializeEntryCount = 64;
27 36
28 private: 37 private:
29 struct ExternalReferenceEntry { 38 struct ExternalReferenceEntry {
30 Address address; 39 Address address;
31 const char* name; 40 const char* name;
41 #ifdef DEBUG
42 int count;
43 #endif // DEBUG
32 }; 44 };
33 45
34 explicit ExternalReferenceTable(Isolate* isolate); 46 explicit ExternalReferenceTable(Isolate* isolate);
35 47
36 void Add(Address address, const char* name) { 48 void Add(Address address, const char* name) {
49 #ifdef DEBUG
50 ExternalReferenceEntry entry = {address, name, 0};
51 #else
37 ExternalReferenceEntry entry = {address, name}; 52 ExternalReferenceEntry entry = {address, name};
53 #endif // DEBUG
38 refs_.Add(entry); 54 refs_.Add(entry);
39 } 55 }
40 56
41 void AddReferences(Isolate* isolate); 57 void AddReferences(Isolate* isolate);
42 void AddBuiltins(Isolate* isolate); 58 void AddBuiltins(Isolate* isolate);
43 void AddRuntimeFunctions(Isolate* isolate); 59 void AddRuntimeFunctions(Isolate* isolate);
44 void AddIsolateAddresses(Isolate* isolate); 60 void AddIsolateAddresses(Isolate* isolate);
45 void AddAccessors(Isolate* isolate); 61 void AddAccessors(Isolate* isolate);
46 void AddStubCache(Isolate* isolate); 62 void AddStubCache(Isolate* isolate);
47 void AddDeoptEntries(Isolate* isolate); 63 void AddDeoptEntries(Isolate* isolate);
48 void AddApiReferences(Isolate* isolate); 64 void AddApiReferences(Isolate* isolate);
49 65
50 List<ExternalReferenceEntry> refs_; 66 List<ExternalReferenceEntry> refs_;
51 67
52 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable); 68 DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable);
53 }; 69 };
54 70
55 } // namespace internal 71 } // namespace internal
56 } // namespace v8 72 } // namespace v8
57 #endif // V8_EXTERNAL_REFERENCE_TABLE_H_ 73 #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