| 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 } | 69 } |
| 70 | 70 |
| 71 CHECK_EQ(original_address, current_address); | 71 CHECK_EQ(original_address, current_address); |
| 72 DeleteArray(mem); | 72 DeleteArray(mem); |
| 73 } | 73 } |
| 74 | 74 |
| 75 | 75 |
| 76 TEST(Promotion) { | 76 TEST(Promotion) { |
| 77 CcTest::InitializeVM(); | 77 CcTest::InitializeVM(); |
| 78 Heap* heap = CcTest::heap(); | 78 Heap* heap = CcTest::heap(); |
| 79 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); | 79 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); |
| 80 | 80 |
| 81 v8::HandleScope sc(CcTest::isolate()); | 81 v8::HandleScope sc(CcTest::isolate()); |
| 82 | 82 |
| 83 // Allocate a fixed array in the new space. | 83 // Allocate a fixed array in the new space. |
| 84 int array_length = | 84 int array_length = |
| 85 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | 85 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 86 (4 * kPointerSize); | 86 (4 * kPointerSize); |
| 87 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 87 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 88 Handle<FixedArray> array(FixedArray::cast(obj)); | 88 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 89 | 89 |
| 90 // Array should be in the new space. | 90 // Array should be in the new space. |
| 91 CHECK(heap->InSpace(*array, NEW_SPACE)); | 91 CHECK(heap->InSpace(*array, NEW_SPACE)); |
| 92 | 92 |
| 93 // Call mark compact GC, so array becomes an old object. | 93 // Call mark compact GC, so array becomes an old object. |
| 94 heap->CollectGarbage(OLD_POINTER_SPACE); | 94 heap->CollectGarbage(OLD_POINTER_SPACE); |
| 95 | 95 |
| 96 // Array now sits in the old space | 96 // Array now sits in the old space |
| 97 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); | 97 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 TEST(NoPromotion) { | 101 TEST(NoPromotion) { |
| 102 CcTest::InitializeVM(); | 102 CcTest::InitializeVM(); |
| 103 Heap* heap = CcTest::heap(); | 103 Heap* heap = CcTest::heap(); |
| 104 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); | 104 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); |
| 105 | 105 |
| 106 v8::HandleScope sc(CcTest::isolate()); | 106 v8::HandleScope sc(CcTest::isolate()); |
| 107 | 107 |
| 108 // Allocate a big fixed array in the new space. | 108 // Allocate a big fixed array in the new space. |
| 109 int array_length = | 109 int array_length = |
| 110 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / | 110 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 111 (2 * kPointerSize); | 111 (2 * kPointerSize); |
| 112 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 112 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 113 Handle<FixedArray> array(FixedArray::cast(obj)); | 113 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 114 | 114 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 | 525 |
| 526 TEST(RegressJoinThreadsOnIsolateDeinit) { | 526 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 527 intptr_t size_limit = ShortLivingIsolate() * 2; | 527 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 528 for (int i = 0; i < 10; i++) { | 528 for (int i = 0; i < 10; i++) { |
| 529 CHECK_GT(size_limit, ShortLivingIsolate()); | 529 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 530 } | 530 } |
| 531 } | 531 } |
| 532 | 532 |
| 533 #endif // __linux__ and !USE_SIMULATOR | 533 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |