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

Side by Side Diff: test/cctest/test-weakmaps.cc

Issue 1891863003: Revert of Rehash and clear deleted entries in weak collections during GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-weaksets.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Perform two consecutive GCs because the first one will only clear 117 // Perform two consecutive GCs because the first one will only clear
118 // weak references whereas the second one will also clear weak maps. 118 // weak references whereas the second one will also clear weak maps.
119 heap->CollectAllGarbage(false); 119 heap->CollectAllGarbage(false);
120 CHECK_EQ(1, NumberOfWeakCalls); 120 CHECK_EQ(1, NumberOfWeakCalls);
121 CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); 121 CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
122 CHECK_EQ( 122 CHECK_EQ(
123 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); 123 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
124 heap->CollectAllGarbage(false); 124 heap->CollectAllGarbage(false);
125 CHECK_EQ(1, NumberOfWeakCalls); 125 CHECK_EQ(1, NumberOfWeakCalls);
126 CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); 126 CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
127 CHECK_EQ(0, 127 CHECK_EQ(2,
128 ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); 128 ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
129 } 129 }
130 130
131 131
132 TEST(Shrinking) { 132 TEST(Shrinking) {
133 LocalContext context; 133 LocalContext context;
134 Isolate* isolate = GetIsolateFrom(&context); 134 Isolate* isolate = GetIsolateFrom(&context);
135 Factory* factory = isolate->factory(); 135 Factory* factory = isolate->factory();
136 Heap* heap = isolate->heap(); 136 Heap* heap = isolate->heap();
137 HandleScope scope(isolate); 137 HandleScope scope(isolate);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { 258 {
259 HandleScope scope(isolate); 259 HandleScope scope(isolate);
260 AllocateJSWeakMap(isolate); 260 AllocateJSWeakMap(isolate);
261 SimulateIncrementalMarking(heap); 261 SimulateIncrementalMarking(heap);
262 } 262 }
263 // The weak map is marked black here but leaving the handle scope will make 263 // The weak map is marked black here but leaving the handle scope will make
264 // the object unreachable. Aborting incremental marking will clear all the 264 // the object unreachable. Aborting incremental marking will clear all the
265 // marking bits which makes the weak map garbage. 265 // marking bits which makes the weak map garbage.
266 heap->CollectAllGarbage(); 266 heap->CollectAllGarbage();
267 } 267 }
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-weaksets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698