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

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

Issue 1376413005: Revert of [heap] Prepare code for smaller large object allocation limit than max allocatable memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Factory* factory = isolate->factory(); 180 Factory* factory = isolate->factory();
181 Heap* heap = isolate->heap(); 181 Heap* heap = isolate->heap();
182 HandleScope scope(isolate); 182 HandleScope scope(isolate);
183 Handle<JSFunction> function = factory->NewFunction( 183 Handle<JSFunction> function = factory->NewFunction(
184 factory->function_string()); 184 factory->function_string());
185 Handle<JSObject> key = factory->NewJSObject(function); 185 Handle<JSObject> key = factory->NewJSObject(function);
186 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); 186 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
187 187
188 // Start second old-space page so that values land on evacuation candidate. 188 // Start second old-space page so that values land on evacuation candidate.
189 Page* first_page = heap->old_space()->anchor()->next_page(); 189 Page* first_page = heap->old_space()->anchor()->next_page();
190 SimulateFullSpace(heap->old_space()); 190 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
191 factory->NewFixedArray(dummy_array_size / kPointerSize, TENURED);
191 192
192 // Fill up weak set with values on an evacuation candidate. 193 // Fill up weak set with values on an evacuation candidate.
193 { 194 {
194 HandleScope scope(isolate); 195 HandleScope scope(isolate);
195 for (int i = 0; i < 32; i++) { 196 for (int i = 0; i < 32; i++) {
196 Handle<JSObject> object = factory->NewJSObject(function, TENURED); 197 Handle<JSObject> object = factory->NewJSObject(function, TENURED);
197 CHECK(!heap->InNewSpace(object->address())); 198 CHECK(!heap->InNewSpace(object->address()));
198 CHECK(!first_page->Contains(object->address())); 199 CHECK(!first_page->Contains(object->address()));
199 int32_t hash = Object::GetOrCreateHash(isolate, key)->value(); 200 int32_t hash = Object::GetOrCreateHash(isolate, key)->value();
200 JSWeakCollection::Set(weakset, key, object, hash); 201 JSWeakCollection::Set(weakset, key, object, hash);
(...skipping 18 matching lines...) Expand all
219 LocalContext context; 220 LocalContext context;
220 Isolate* isolate = GetIsolateFrom(&context); 221 Isolate* isolate = GetIsolateFrom(&context);
221 Factory* factory = isolate->factory(); 222 Factory* factory = isolate->factory();
222 Heap* heap = isolate->heap(); 223 Heap* heap = isolate->heap();
223 HandleScope scope(isolate); 224 HandleScope scope(isolate);
224 Handle<JSFunction> function = factory->NewFunction( 225 Handle<JSFunction> function = factory->NewFunction(
225 factory->function_string()); 226 factory->function_string());
226 227
227 // Start second old-space page so that keys land on evacuation candidate. 228 // Start second old-space page so that keys land on evacuation candidate.
228 Page* first_page = heap->old_space()->anchor()->next_page(); 229 Page* first_page = heap->old_space()->anchor()->next_page();
229 SimulateFullSpace(heap->old_space()); 230 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
231 factory->NewFixedArray(dummy_array_size / kPointerSize, TENURED);
230 232
231 // Fill up weak set with keys on an evacuation candidate. 233 // Fill up weak set with keys on an evacuation candidate.
232 Handle<JSObject> keys[32]; 234 Handle<JSObject> keys[32];
233 for (int i = 0; i < 32; i++) { 235 for (int i = 0; i < 32; i++) {
234 keys[i] = factory->NewJSObject(function, TENURED); 236 keys[i] = factory->NewJSObject(function, TENURED);
235 CHECK(!heap->InNewSpace(keys[i]->address())); 237 CHECK(!heap->InNewSpace(keys[i]->address()));
236 CHECK(!first_page->Contains(keys[i]->address())); 238 CHECK(!first_page->Contains(keys[i]->address()));
237 } 239 }
238 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); 240 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
239 for (int i = 0; i < 32; i++) { 241 for (int i = 0; i < 32; i++) {
240 Handle<Smi> smi(Smi::FromInt(i), isolate); 242 Handle<Smi> smi(Smi::FromInt(i), isolate);
241 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value(); 243 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value();
242 JSWeakCollection::Set(weakset, keys[i], smi, hash); 244 JSWeakCollection::Set(weakset, keys[i], smi, hash);
243 } 245 }
244 246
245 // Force compacting garbage collection. The subsequent collections are used 247 // Force compacting garbage collection. The subsequent collections are used
246 // to verify that key references were actually updated. 248 // to verify that key references were actually updated.
247 CHECK(FLAG_always_compact); 249 CHECK(FLAG_always_compact);
248 heap->CollectAllGarbage(); 250 heap->CollectAllGarbage();
249 heap->CollectAllGarbage(); 251 heap->CollectAllGarbage();
250 heap->CollectAllGarbage(); 252 heap->CollectAllGarbage();
251 } 253 }
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