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

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

Issue 1051233002: Reland "Merge old data and pointer space." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-dictionary.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 2
3 // Test constant pool array code. 3 // Test constant pool array code.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/factory.h" 7 #include "src/factory.h"
8 #include "src/objects.h" 8 #include "src/objects.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Factory* factory = isolate->factory(); 274 Factory* factory = isolate->factory();
275 v8::HandleScope scope(context->GetIsolate()); 275 v8::HandleScope scope(context->GetIsolate());
276 276
277 ConstantPoolArray::NumberOfEntries small(0, 0, 1, 0); 277 ConstantPoolArray::NumberOfEntries small(0, 0, 1, 0);
278 ConstantPoolArray::NumberOfEntries extended(0, 0, 1, 0); 278 ConstantPoolArray::NumberOfEntries extended(0, 0, 1, 0);
279 Handle<ConstantPoolArray> array = 279 Handle<ConstantPoolArray> array =
280 factory->NewExtendedConstantPoolArray(small, extended); 280 factory->NewExtendedConstantPoolArray(small, extended);
281 281
282 // Start a second old-space page so that the heap pointer added to the 282 // Start a second old-space page so that the heap pointer added to the
283 // constant pool array ends up on the an evacuation candidate page. 283 // constant pool array ends up on the an evacuation candidate page.
284 Page* first_page = heap->old_data_space()->anchor()->next_page(); 284 Page* first_page = heap->old_space()->anchor()->next_page();
285 { 285 {
286 HandleScope scope(isolate); 286 HandleScope scope(isolate);
287 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB; 287 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
288 Handle<HeapObject> temp = 288 Handle<HeapObject> temp =
289 factory->NewFixedDoubleArray(dummy_array_size / kDoubleSize, TENURED); 289 factory->NewFixedDoubleArray(dummy_array_size / kDoubleSize, TENURED);
290 CHECK(heap->InOldDataSpace(temp->address())); 290 CHECK(heap->InOldSpace(temp->address()));
291 Handle<HeapObject> heap_ptr = 291 Handle<HeapObject> heap_ptr =
292 factory->NewHeapNumber(5.0, IMMUTABLE, TENURED); 292 factory->NewHeapNumber(5.0, IMMUTABLE, TENURED);
293 CHECK(heap->InOldDataSpace(heap_ptr->address())); 293 CHECK(heap->InOldSpace(heap_ptr->address()));
294 CHECK(!first_page->Contains(heap_ptr->address())); 294 CHECK(!first_page->Contains(heap_ptr->address()));
295 array->set(0, *heap_ptr); 295 array->set(0, *heap_ptr);
296 array->set(1, *heap_ptr); 296 array->set(1, *heap_ptr);
297 } 297 }
298 298
299 // Check heap pointers are correctly updated on GC. 299 // Check heap pointers are correctly updated on GC.
300 Object* old_ptr = array->get_heap_ptr_entry(0); 300 Object* old_ptr = array->get_heap_ptr_entry(0);
301 Handle<Object> object(old_ptr, isolate); 301 Handle<Object> object(old_ptr, isolate);
302 CHECK_EQ(old_ptr, *object); 302 CHECK_EQ(old_ptr, *object);
303 CHECK_EQ(old_ptr, array->get_heap_ptr_entry(1)); 303 CHECK_EQ(old_ptr, array->get_heap_ptr_entry(1));
304 304
305 // Force compacting garbage collection. 305 // Force compacting garbage collection.
306 CHECK(FLAG_always_compact); 306 CHECK(FLAG_always_compact);
307 heap->CollectAllGarbage(Heap::kNoGCFlags); 307 heap->CollectAllGarbage(Heap::kNoGCFlags);
308 308
309 CHECK_NE(old_ptr, *object); 309 CHECK_NE(old_ptr, *object);
310 CHECK_EQ(*object, array->get_heap_ptr_entry(0)); 310 CHECK_EQ(*object, array->get_heap_ptr_entry(0));
311 CHECK_EQ(*object, array->get_heap_ptr_entry(1)); 311 CHECK_EQ(*object, array->get_heap_ptr_entry(1));
312 } 312 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698