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

Side by Side Diff: src/snapshot/serialize.h

Issue 1074943002: Split TemplateHashMapImpl::Lookup into two methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm (and ppc) builds Created 5 years, 8 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
OLDNEW
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/hashmap.h" 8 #include "src/hashmap.h"
9 #include "src/heap-profiler.h" 9 #include "src/heap-profiler.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 static void SetValue(HashMap::Entry* entry, uint32_t v) { 74 static void SetValue(HashMap::Entry* entry, uint32_t v) {
75 entry->value = reinterpret_cast<void*>(v); 75 entry->value = reinterpret_cast<void*>(v);
76 } 76 }
77 77
78 static uint32_t GetValue(HashMap::Entry* entry) { 78 static uint32_t GetValue(HashMap::Entry* entry) {
79 return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value)); 79 return static_cast<uint32_t>(reinterpret_cast<intptr_t>(entry->value));
80 } 80 }
81 81
82 inline static HashMap::Entry* LookupEntry(HashMap* map, HeapObject* obj, 82 inline static HashMap::Entry* LookupEntry(HashMap* map, HeapObject* obj,
83 bool insert) { 83 bool insert) {
84 return map->Lookup(Key(obj), Hash(obj), insert); 84 if (insert) {
85 map->LookupOrInsert(Key(obj), Hash(obj));
86 }
87 return map->Lookup(Key(obj), Hash(obj));
85 } 88 }
86 89
87 private: 90 private:
88 static uint32_t Hash(HeapObject* obj) { 91 static uint32_t Hash(HeapObject* obj) {
89 return static_cast<int32_t>(reinterpret_cast<intptr_t>(obj->address())); 92 return static_cast<int32_t>(reinterpret_cast<intptr_t>(obj->address()));
90 } 93 }
91 94
92 static void* Key(HeapObject* obj) { 95 static void* Key(HeapObject* obj) {
93 return reinterpret_cast<void*>(obj->address()); 96 return reinterpret_cast<void*>(obj->address());
94 } 97 }
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 kNumInternalizedStringsOffset + kInt32Size; 974 kNumInternalizedStringsOffset + kInt32Size;
972 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; 975 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size;
973 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; 976 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
974 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; 977 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
975 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; 978 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
976 static const int kHeaderSize = kChecksum2Offset + kInt32Size; 979 static const int kHeaderSize = kChecksum2Offset + kInt32Size;
977 }; 980 };
978 } } // namespace v8::internal 981 } } // namespace v8::internal
979 982
980 #endif // V8_SERIALIZE_H_ 983 #endif // V8_SERIALIZE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698