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

Unified Diff: src/serialize.cc

Issue 974273002: Serializer: fix false negative in hashmap lookups. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index d5d06a0677f51daa36381a3181ff073d94886d44..0b39d25642a324f68ca766fc2223a98c2bc2e4ba 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -480,16 +480,14 @@ ExternalReferenceDecoder::~ExternalReferenceDecoder() {
RootIndexMap::RootIndexMap(Isolate* isolate) {
map_ = new HashMap(HashMap::PointersMatch);
Object** root_array = isolate->heap()->roots_array_start();
- for (int i = 0; i < Heap::kStrongRootListLength; i++) {
+ for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) {
Object* root = root_array[i];
if (root->IsHeapObject() && !isolate->heap()->InNewSpace(root)) {
HeapObject* heap_object = HeapObject::cast(root);
- if (LookupEntry(map_, heap_object, false) != NULL) {
- // Some root values are initialized to the empty FixedArray();
- // Do not add them to the map.
- // TODO(yangguo): This assert is not true. Some roots like
- // instanceof_cache_answer can be e.g. null.
- // DCHECK_EQ(isolate->heap()->empty_fixed_array(), heap_object);
+ HashMap::Entry* entry = LookupEntry(map_, heap_object, false);
+ if (entry != NULL) {
+ // Some are initialized to a previous value in the root list.
+ DCHECK_LT(GetValue(entry), i);
} else {
SetValue(LookupEntry(map_, heap_object, true), i);
}
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698