| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 CHECK_EQ(current_address, value); | 69 CHECK_EQ(current_address, value); |
| 70 } | 70 } |
| 71 | 71 |
| 72 CHECK_EQ(original_address, current_address); | 72 CHECK_EQ(original_address, current_address); |
| 73 DeleteArray(mem); | 73 DeleteArray(mem); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 TEST(Promotion) { | 77 TEST(Promotion) { |
| 78 CcTest::InitializeVM(); | 78 CcTest::InitializeVM(); |
| 79 Heap* heap = CcTest::heap(); | 79 TestHeap* heap = CcTest::test_heap(); |
| 80 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); | 80 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); |
| 81 | 81 |
| 82 v8::HandleScope sc(CcTest::isolate()); | 82 v8::HandleScope sc(CcTest::isolate()); |
| 83 | 83 |
| 84 // Allocate a fixed array in the new space. | 84 // Allocate a fixed array in the new space. |
| 85 int array_length = | 85 int array_length = |
| 86 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | 86 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 87 (4 * kPointerSize); | 87 (4 * kPointerSize); |
| 88 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 88 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 89 Handle<FixedArray> array(FixedArray::cast(obj)); | 89 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 90 | 90 |
| 91 // Array should be in the new space. | 91 // Array should be in the new space. |
| 92 CHECK(heap->InSpace(*array, NEW_SPACE)); | 92 CHECK(heap->InSpace(*array, NEW_SPACE)); |
| 93 | 93 |
| 94 // Call mark compact GC, so array becomes an old object. | 94 // Call mark compact GC, so array becomes an old object. |
| 95 heap->CollectGarbage(OLD_POINTER_SPACE); | 95 heap->CollectGarbage(OLD_POINTER_SPACE); |
| 96 | 96 |
| 97 // Array now sits in the old space | 97 // Array now sits in the old space |
| 98 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); | 98 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 TEST(NoPromotion) { | 102 TEST(NoPromotion) { |
| 103 CcTest::InitializeVM(); | 103 CcTest::InitializeVM(); |
| 104 Heap* heap = CcTest::heap(); | 104 TestHeap* heap = CcTest::test_heap(); |
| 105 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); | 105 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); |
| 106 | 106 |
| 107 v8::HandleScope sc(CcTest::isolate()); | 107 v8::HandleScope sc(CcTest::isolate()); |
| 108 | 108 |
| 109 // Allocate a big fixed array in the new space. | 109 // Allocate a big fixed array in the new space. |
| 110 int array_length = | 110 int array_length = |
| 111 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | 111 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 112 (2 * kPointerSize); | 112 (2 * kPointerSize); |
| 113 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 113 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 114 Handle<FixedArray> array(FixedArray::cast(obj)); | 114 Handle<FixedArray> array(FixedArray::cast(obj)); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ASSERT_EQ(1234, p->second); | 246 ASSERT_EQ(1234, p->second); |
| 247 NumberOfWeakCalls++; | 247 NumberOfWeakCalls++; |
| 248 p->first->Reset(); | 248 p->first->Reset(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 TEST(ObjectGroups) { | 252 TEST(ObjectGroups) { |
| 253 FLAG_incremental_marking = false; | 253 FLAG_incremental_marking = false; |
| 254 CcTest::InitializeVM(); | 254 CcTest::InitializeVM(); |
| 255 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 255 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
| 256 Heap* heap = CcTest::heap(); | 256 TestHeap* heap = CcTest::test_heap(); |
| 257 NumberOfWeakCalls = 0; | 257 NumberOfWeakCalls = 0; |
| 258 v8::HandleScope handle_scope(CcTest::isolate()); | 258 v8::HandleScope handle_scope(CcTest::isolate()); |
| 259 | 259 |
| 260 Handle<Object> g1s1 = | 260 Handle<Object> g1s1 = |
| 261 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); | 261 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
| 262 Handle<Object> g1s2 = | 262 Handle<Object> g1s2 = |
| 263 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); | 263 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
| 264 Handle<Object> g1c1 = | 264 Handle<Object> g1c1 = |
| 265 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); | 265 global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
| 266 std::pair<Handle<Object>*, int> g1s1_and_id(&g1s1, 1234); | 266 std::pair<Handle<Object>*, int> g1s1_and_id(&g1s1, 1234); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 }; | 385 }; |
| 386 | 386 |
| 387 | 387 |
| 388 TEST(EmptyObjectGroups) { | 388 TEST(EmptyObjectGroups) { |
| 389 CcTest::InitializeVM(); | 389 CcTest::InitializeVM(); |
| 390 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); | 390 GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); |
| 391 | 391 |
| 392 v8::HandleScope handle_scope(CcTest::isolate()); | 392 v8::HandleScope handle_scope(CcTest::isolate()); |
| 393 | 393 |
| 394 Handle<Object> object = global_handles->Create( | 394 Handle<Object> object = global_handles->Create( |
| 395 CcTest::heap()->AllocateFixedArray(1)->ToObjectChecked()); | 395 CcTest::test_heap()->AllocateFixedArray(1)->ToObjectChecked()); |
| 396 | 396 |
| 397 TestRetainedObjectInfo info; | 397 TestRetainedObjectInfo info; |
| 398 global_handles->AddObjectGroup(NULL, 0, &info); | 398 global_handles->AddObjectGroup(NULL, 0, &info); |
| 399 ASSERT(info.has_been_disposed()); | 399 ASSERT(info.has_been_disposed()); |
| 400 | 400 |
| 401 global_handles->AddImplicitReferences( | 401 global_handles->AddImplicitReferences( |
| 402 Handle<HeapObject>::cast(object).location(), NULL, 0); | 402 Handle<HeapObject>::cast(object).location(), NULL, 0); |
| 403 } | 403 } |
| 404 | 404 |
| 405 | 405 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 | 523 |
| 524 TEST(RegressJoinThreadsOnIsolateDeinit) { | 524 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 525 intptr_t size_limit = ShortLivingIsolate() * 2; | 525 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 526 for (int i = 0; i < 10; i++) { | 526 for (int i = 0; i < 10; i++) { |
| 527 CHECK_GT(size_limit, ShortLivingIsolate()); | 527 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| 531 #endif // __linux__ and !USE_SIMULATOR | 531 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |