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 5537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5548 i::FLAG_manual_evacuation_candidates_selection = true; | 5548 i::FLAG_manual_evacuation_candidates_selection = true; |
5549 v8::Isolate::CreateParams create_params; | 5549 v8::Isolate::CreateParams create_params; |
5550 // Set heap limits. | 5550 // Set heap limits. |
5551 create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB); | 5551 create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB); |
5552 create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB); | 5552 create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB); |
5553 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 5553 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
5554 v8::Isolate* isolate = v8::Isolate::New(create_params); | 5554 v8::Isolate* isolate = v8::Isolate::New(create_params); |
5555 isolate->Enter(); | 5555 isolate->Enter(); |
5556 { | 5556 { |
5557 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5557 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5558 Heap* heap = i_isolate->heap(); |
5558 HandleScope handle_scope(i_isolate); | 5559 HandleScope handle_scope(i_isolate); |
5559 PagedSpace* old_space = i_isolate->heap()->old_space(); | 5560 PagedSpace* old_space = heap->old_space(); |
5560 const int kMaxObjects = 10000; | 5561 const int kMaxObjects = 10000; |
5561 const int kFixedArrayLen = 512; | 5562 const int kFixedArrayLen = 512; |
5562 Handle<FixedArray> objects[kMaxObjects]; | 5563 Handle<FixedArray> objects[kMaxObjects]; |
5563 for (int i = 0; (i < kMaxObjects) && old_space->CanExpand(Page::kPageSize); | 5564 for (int i = 0; (i < kMaxObjects) && |
| 5565 heap->CanExpandOldGeneration(old_space->AreaSize()); |
5564 i++) { | 5566 i++) { |
5565 objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED); | 5567 objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED); |
5566 Page::FromAddress(objects[i]->address()) | 5568 Page::FromAddress(objects[i]->address()) |
5567 ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 5569 ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
5568 } | 5570 } |
5569 SimulateFullSpace(old_space); | 5571 SimulateFullSpace(old_space); |
5570 i_isolate->heap()->CollectGarbage(OLD_SPACE); | 5572 heap->CollectGarbage(OLD_SPACE); |
5571 // If we get this far, we've successfully aborted compaction. Any further | 5573 // If we get this far, we've successfully aborted compaction. Any further |
5572 // allocations might trigger OOM. | 5574 // allocations might trigger OOM. |
5573 } | 5575 } |
5574 isolate->Exit(); | 5576 isolate->Exit(); |
5575 isolate->Dispose(); | 5577 isolate->Dispose(); |
5576 } | 5578 } |
5577 | 5579 |
5578 | 5580 |
5579 TEST(Regress357137) { | 5581 TEST(Regress357137) { |
5580 CcTest::InitializeVM(); | 5582 CcTest::InitializeVM(); |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6607 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); | 6609 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); |
6608 } | 6610 } |
6609 } | 6611 } |
6610 // Force allocation from the free list. | 6612 // Force allocation from the free list. |
6611 heap->set_force_oom(true); | 6613 heap->set_force_oom(true); |
6612 heap->CollectGarbage(OLD_SPACE); | 6614 heap->CollectGarbage(OLD_SPACE); |
6613 } | 6615 } |
6614 | 6616 |
6615 } // namespace internal | 6617 } // namespace internal |
6616 } // namespace v8 | 6618 } // namespace v8 |
OLD | NEW |