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

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

Issue 1632913003: [heap] Move to page lookups for SemiSpace, NewSpace, and Heap containment methods (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips ports Created 4 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-weakmaps.cc ('k') | no next file » | 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 // Start second old-space page so that values land on evacuation candidate. 186 // Start second old-space page so that values land on evacuation candidate.
187 Page* first_page = heap->old_space()->anchor()->next_page(); 187 Page* first_page = heap->old_space()->anchor()->next_page();
188 SimulateFullSpace(heap->old_space()); 188 SimulateFullSpace(heap->old_space());
189 189
190 // Fill up weak set with values on an evacuation candidate. 190 // Fill up weak set with values on an evacuation candidate.
191 { 191 {
192 HandleScope scope(isolate); 192 HandleScope scope(isolate);
193 for (int i = 0; i < 32; i++) { 193 for (int i = 0; i < 32; i++) {
194 Handle<JSObject> object = factory->NewJSObject(function, TENURED); 194 Handle<JSObject> object = factory->NewJSObject(function, TENURED);
195 CHECK(!heap->InNewSpace(object->address())); 195 CHECK(!heap->InNewSpace(*object));
196 CHECK(!first_page->Contains(object->address())); 196 CHECK(!first_page->Contains(object->address()));
197 int32_t hash = Object::GetOrCreateHash(isolate, key)->value(); 197 int32_t hash = Object::GetOrCreateHash(isolate, key)->value();
198 JSWeakCollection::Set(weakset, key, object, hash); 198 JSWeakCollection::Set(weakset, key, object, hash);
199 } 199 }
200 } 200 }
201 201
202 // Force compacting garbage collection. 202 // Force compacting garbage collection.
203 CHECK(FLAG_always_compact); 203 CHECK(FLAG_always_compact);
204 heap->CollectAllGarbage(); 204 heap->CollectAllGarbage();
205 } 205 }
(...skipping 17 matching lines...) Expand all
223 factory->function_string()); 223 factory->function_string());
224 224
225 // Start second old-space page so that keys land on evacuation candidate. 225 // Start second old-space page so that keys land on evacuation candidate.
226 Page* first_page = heap->old_space()->anchor()->next_page(); 226 Page* first_page = heap->old_space()->anchor()->next_page();
227 SimulateFullSpace(heap->old_space()); 227 SimulateFullSpace(heap->old_space());
228 228
229 // Fill up weak set with keys on an evacuation candidate. 229 // Fill up weak set with keys on an evacuation candidate.
230 Handle<JSObject> keys[32]; 230 Handle<JSObject> keys[32];
231 for (int i = 0; i < 32; i++) { 231 for (int i = 0; i < 32; i++) {
232 keys[i] = factory->NewJSObject(function, TENURED); 232 keys[i] = factory->NewJSObject(function, TENURED);
233 CHECK(!heap->InNewSpace(keys[i]->address())); 233 CHECK(!heap->InNewSpace(*keys[i]));
234 CHECK(!first_page->Contains(keys[i]->address())); 234 CHECK(!first_page->Contains(keys[i]->address()));
235 } 235 }
236 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); 236 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
237 for (int i = 0; i < 32; i++) { 237 for (int i = 0; i < 32; i++) {
238 Handle<Smi> smi(Smi::FromInt(i), isolate); 238 Handle<Smi> smi(Smi::FromInt(i), isolate);
239 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value(); 239 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value();
240 JSWeakCollection::Set(weakset, keys[i], smi, hash); 240 JSWeakCollection::Set(weakset, keys[i], smi, hash);
241 } 241 }
242 242
243 // Force compacting garbage collection. The subsequent collections are used 243 // Force compacting garbage collection. The subsequent collections are used
244 // to verify that key references were actually updated. 244 // to verify that key references were actually updated.
245 CHECK(FLAG_always_compact); 245 CHECK(FLAG_always_compact);
246 heap->CollectAllGarbage(); 246 heap->CollectAllGarbage();
247 heap->CollectAllGarbage(); 247 heap->CollectAllGarbage();
248 heap->CollectAllGarbage(); 248 heap->CollectAllGarbage();
249 } 249 }
OLDNEW
« no previous file with comments | « test/cctest/test-weakmaps.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698