OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // For a few types of references, we can get their address from their id. | 75 // For a few types of references, we can get their address from their id. |
76 void AddFromId(TypeCode type, | 76 void AddFromId(TypeCode type, |
77 uint16_t id, | 77 uint16_t id, |
78 const char* name, | 78 const char* name, |
79 Isolate* isolate); | 79 Isolate* isolate); |
80 | 80 |
81 // For other types of references, the caller will figure out the address. | 81 // For other types of references, the caller will figure out the address. |
82 void Add(Address address, TypeCode type, uint16_t id, const char* name); | 82 void Add(Address address, TypeCode type, uint16_t id, const char* name); |
83 | 83 |
| 84 static int Compare(const ExternalReferenceEntry* a, |
| 85 const ExternalReferenceEntry* b) { |
| 86 return static_cast<int>(a->code) - static_cast<int>(b->code); |
| 87 } |
| 88 |
84 List<ExternalReferenceEntry> refs_; | 89 List<ExternalReferenceEntry> refs_; |
85 int max_id_[kTypeCodeCount]; | 90 int max_id_[kTypeCodeCount]; |
86 }; | 91 }; |
87 | 92 |
88 | 93 |
89 class ExternalReferenceEncoder { | 94 class ExternalReferenceEncoder { |
90 public: | 95 public: |
91 explicit ExternalReferenceEncoder(Isolate* isolate); | 96 explicit ExternalReferenceEncoder(Isolate* isolate); |
92 | 97 |
93 uint32_t Encode(Address key) const; | 98 uint32_t Encode(Address key) const; |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 static const int kCheckSumOffset = 0; | 672 static const int kCheckSumOffset = 0; |
668 static const int kReservationsOffset = 1; | 673 static const int kReservationsOffset = 1; |
669 static const int kHeaderEntries = 8; | 674 static const int kHeaderEntries = 8; |
670 | 675 |
671 ScriptData* script_data_; | 676 ScriptData* script_data_; |
672 bool owns_script_data_; | 677 bool owns_script_data_; |
673 }; | 678 }; |
674 } } // namespace v8::internal | 679 } } // namespace v8::internal |
675 | 680 |
676 #endif // V8_SERIALIZE_H_ | 681 #endif // V8_SERIALIZE_H_ |
OLD | NEW |