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

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

Issue 910333004: Contribution of PowerPC port (continuation of 422063005) - PPC opt 2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated to remove non-test changes 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-heap.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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_data_space()->anchor()->next_page();
285 { 285 {
286 HandleScope scope(isolate); 286 HandleScope scope(isolate);
287 int dummy_array_size = Page::kMaxRegularHeapObjectSize - 92 * KB;
287 Handle<HeapObject> temp = 288 Handle<HeapObject> temp =
288 factory->NewFixedDoubleArray(900 * KB / kDoubleSize, TENURED); 289 factory->NewFixedDoubleArray(dummy_array_size / kDoubleSize, TENURED);
289 CHECK(heap->InOldDataSpace(temp->address())); 290 CHECK(heap->InOldDataSpace(temp->address()));
290 Handle<HeapObject> heap_ptr = 291 Handle<HeapObject> heap_ptr =
291 factory->NewHeapNumber(5.0, IMMUTABLE, TENURED); 292 factory->NewHeapNumber(5.0, IMMUTABLE, TENURED);
292 CHECK(heap->InOldDataSpace(heap_ptr->address())); 293 CHECK(heap->InOldDataSpace(heap_ptr->address()));
293 CHECK(!first_page->Contains(heap_ptr->address())); 294 CHECK(!first_page->Contains(heap_ptr->address()));
294 array->set(0, *heap_ptr); 295 array->set(0, *heap_ptr);
295 array->set(1, *heap_ptr); 296 array->set(1, *heap_ptr);
296 } 297 }
297 298
298 // Check heap pointers are correctly updated on GC. 299 // Check heap pointers are correctly updated on GC.
299 Object* old_ptr = array->get_heap_ptr_entry(0); 300 Object* old_ptr = array->get_heap_ptr_entry(0);
300 Handle<Object> object(old_ptr, isolate); 301 Handle<Object> object(old_ptr, isolate);
301 CHECK_EQ(old_ptr, *object); 302 CHECK_EQ(old_ptr, *object);
302 CHECK_EQ(old_ptr, array->get_heap_ptr_entry(1)); 303 CHECK_EQ(old_ptr, array->get_heap_ptr_entry(1));
303 304
304 // Force compacting garbage collection. 305 // Force compacting garbage collection.
305 CHECK(FLAG_always_compact); 306 CHECK(FLAG_always_compact);
306 heap->CollectAllGarbage(Heap::kNoGCFlags); 307 heap->CollectAllGarbage(Heap::kNoGCFlags);
307 308
308 CHECK_NE(old_ptr, *object); 309 CHECK_NE(old_ptr, *object);
309 CHECK_EQ(*object, array->get_heap_ptr_entry(0)); 310 CHECK_EQ(*object, array->get_heap_ptr_entry(0));
310 CHECK_EQ(*object, array->get_heap_ptr_entry(1)); 311 CHECK_EQ(*object, array->get_heap_ptr_entry(1));
311 } 312 }
OLDNEW
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698