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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 TestHeap* heap = CcTest::test_heap(); | 79 TestHeap* heap = CcTest::test_heap(); |
80 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); | 80 heap->ConfigureHeap(1, 1, 1, 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 TestHeap* heap = CcTest::test_heap(); | 104 TestHeap* heap = CcTest::test_heap(); |
105 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB, 0); | 105 heap->ConfigureHeap(1, 1, 1, 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)); |
115 | 115 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 | 496 |
497 TEST(RegressJoinThreadsOnIsolateDeinit) { | 497 TEST(RegressJoinThreadsOnIsolateDeinit) { |
498 intptr_t size_limit = ShortLivingIsolate() * 2; | 498 intptr_t size_limit = ShortLivingIsolate() * 2; |
499 for (int i = 0; i < 10; i++) { | 499 for (int i = 0; i < 10; i++) { |
500 CHECK_GT(size_limit, ShortLivingIsolate()); | 500 CHECK_GT(size_limit, ShortLivingIsolate()); |
501 } | 501 } |
502 } | 502 } |
503 | 503 |
504 #endif // __linux__ and !USE_SIMULATOR | 504 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |