| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 735 |
| 736 CHECK(WeakPointerCleared); | 736 CHECK(WeakPointerCleared); |
| 737 } | 737 } |
| 738 | 738 |
| 739 TEST(BytecodeArray) { | 739 TEST(BytecodeArray) { |
| 740 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; | 740 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |
| 741 static const int kRawBytesSize = sizeof(kRawBytes); | 741 static const int kRawBytesSize = sizeof(kRawBytes); |
| 742 static const int kFrameSize = 32; | 742 static const int kFrameSize = 32; |
| 743 static const int kParameterCount = 2; | 743 static const int kParameterCount = 2; |
| 744 | 744 |
| 745 FLAG_concurrent_marking = false; |
| 745 FLAG_manual_evacuation_candidates_selection = true; | 746 FLAG_manual_evacuation_candidates_selection = true; |
| 746 FLAG_stress_incremental_marking = false; | 747 FLAG_stress_incremental_marking = false; |
| 747 CcTest::InitializeVM(); | 748 CcTest::InitializeVM(); |
| 748 Isolate* isolate = CcTest::i_isolate(); | 749 Isolate* isolate = CcTest::i_isolate(); |
| 749 Heap* heap = isolate->heap(); | 750 Heap* heap = isolate->heap(); |
| 750 Factory* factory = isolate->factory(); | 751 Factory* factory = isolate->factory(); |
| 751 HandleScope scope(isolate); | 752 HandleScope scope(isolate); |
| 752 | 753 |
| 753 heap::SimulateFullSpace(heap->old_space()); | 754 heap::SimulateFullSpace(heap->old_space()); |
| 754 Handle<FixedArray> constant_pool = factory->NewFixedArray(5, TENURED); | 755 Handle<FixedArray> constant_pool = factory->NewFixedArray(5, TENURED); |
| (...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 TEST(ReleaseOverReservedPages) { | 3151 TEST(ReleaseOverReservedPages) { |
| 3151 if (FLAG_never_compact) return; | 3152 if (FLAG_never_compact) return; |
| 3152 FLAG_trace_gc = true; | 3153 FLAG_trace_gc = true; |
| 3153 // The optimizer can allocate stuff, messing up the test. | 3154 // The optimizer can allocate stuff, messing up the test. |
| 3154 FLAG_opt = false; | 3155 FLAG_opt = false; |
| 3155 FLAG_always_opt = false; | 3156 FLAG_always_opt = false; |
| 3156 // Parallel compaction increases fragmentation, depending on how existing | 3157 // Parallel compaction increases fragmentation, depending on how existing |
| 3157 // memory is distributed. Since this is non-deterministic because of | 3158 // memory is distributed. Since this is non-deterministic because of |
| 3158 // concurrent sweeping, we disable it for this test. | 3159 // concurrent sweeping, we disable it for this test. |
| 3159 FLAG_parallel_compaction = false; | 3160 FLAG_parallel_compaction = false; |
| 3161 FLAG_concurrent_marking = false; |
| 3160 // Concurrent sweeping adds non determinism, depending on when memory is | 3162 // Concurrent sweeping adds non determinism, depending on when memory is |
| 3161 // available for further reuse. | 3163 // available for further reuse. |
| 3162 FLAG_concurrent_sweeping = false; | 3164 FLAG_concurrent_sweeping = false; |
| 3163 // Fast evacuation of pages may result in a different page count in old space. | 3165 // Fast evacuation of pages may result in a different page count in old space. |
| 3164 FLAG_page_promotion = false; | 3166 FLAG_page_promotion = false; |
| 3165 CcTest::InitializeVM(); | 3167 CcTest::InitializeVM(); |
| 3166 Isolate* isolate = CcTest::i_isolate(); | 3168 Isolate* isolate = CcTest::i_isolate(); |
| 3167 // If there's snapshot available, we don't know whether 20 small arrays will | 3169 // If there's snapshot available, we don't know whether 20 small arrays will |
| 3168 // fit on the initial pages. | 3170 // fit on the initial pages. |
| 3169 if (!isolate->snapshot_available()) return; | 3171 if (!isolate->snapshot_available()) return; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 CcTest::CollectAllGarbage(); | 3862 CcTest::CollectAllGarbage(); |
| 3861 | 3863 |
| 3862 // Make a new closure that will get code installed from the code map. | 3864 // Make a new closure that will get code installed from the code map. |
| 3863 // Unoptimized code is missing and the deoptimizer will go ballistic. | 3865 // Unoptimized code is missing and the deoptimizer will go ballistic. |
| 3864 CompileRun("var h = mkClosure(); h('bozo');"); | 3866 CompileRun("var h = mkClosure(); h('bozo');"); |
| 3865 } | 3867 } |
| 3866 | 3868 |
| 3867 | 3869 |
| 3868 TEST(LargeObjectSlotRecording) { | 3870 TEST(LargeObjectSlotRecording) { |
| 3869 if (!FLAG_incremental_marking) return; | 3871 if (!FLAG_incremental_marking) return; |
| 3872 FLAG_concurrent_marking = false; |
| 3870 FLAG_manual_evacuation_candidates_selection = true; | 3873 FLAG_manual_evacuation_candidates_selection = true; |
| 3871 FLAG_stress_incremental_marking = false; | 3874 FLAG_stress_incremental_marking = false; |
| 3872 CcTest::InitializeVM(); | 3875 CcTest::InitializeVM(); |
| 3873 Isolate* isolate = CcTest::i_isolate(); | 3876 Isolate* isolate = CcTest::i_isolate(); |
| 3874 Heap* heap = isolate->heap(); | 3877 Heap* heap = isolate->heap(); |
| 3875 HandleScope scope(isolate); | 3878 HandleScope scope(isolate); |
| 3876 | 3879 |
| 3877 // Create an object on an evacuation candidate. | 3880 // Create an object on an evacuation candidate. |
| 3878 heap::SimulateFullSpace(heap->old_space()); | 3881 heap::SimulateFullSpace(heap->old_space()); |
| 3879 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); | 3882 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4851 | 4854 |
| 4852 | 4855 |
| 4853 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { } | 4856 static void InterruptCallback357137(v8::Isolate* isolate, void* data) { } |
| 4854 | 4857 |
| 4855 | 4858 |
| 4856 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { | 4859 static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 4857 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); | 4860 CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); |
| 4858 } | 4861 } |
| 4859 | 4862 |
| 4860 HEAP_TEST(Regress538257) { | 4863 HEAP_TEST(Regress538257) { |
| 4864 FLAG_concurrent_marking = false; |
| 4861 FLAG_manual_evacuation_candidates_selection = true; | 4865 FLAG_manual_evacuation_candidates_selection = true; |
| 4862 v8::Isolate::CreateParams create_params; | 4866 v8::Isolate::CreateParams create_params; |
| 4863 // Set heap limits. | 4867 // Set heap limits. |
| 4864 create_params.constraints.set_max_semi_space_size(1); | 4868 create_params.constraints.set_max_semi_space_size(1); |
| 4865 create_params.constraints.set_max_old_space_size(6); | 4869 create_params.constraints.set_max_old_space_size(6); |
| 4866 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 4870 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 4867 v8::Isolate* isolate = v8::Isolate::New(create_params); | 4871 v8::Isolate* isolate = v8::Isolate::New(create_params); |
| 4868 isolate->Enter(); | 4872 isolate->Enter(); |
| 4869 { | 4873 { |
| 4870 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 4874 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5649 | 5653 |
| 5650 { | 5654 { |
| 5651 SharedFunctionInfo::GlobalIterator iterator(isolate); | 5655 SharedFunctionInfo::GlobalIterator iterator(isolate); |
| 5652 while (iterator.Next()) sfi_count--; | 5656 while (iterator.Next()) sfi_count--; |
| 5653 } | 5657 } |
| 5654 | 5658 |
| 5655 CHECK_EQ(0, sfi_count); | 5659 CHECK_EQ(0, sfi_count); |
| 5656 } | 5660 } |
| 5657 | 5661 |
| 5658 HEAP_TEST(Regress587004) { | 5662 HEAP_TEST(Regress587004) { |
| 5663 FLAG_concurrent_marking = false; |
| 5659 FLAG_concurrent_sweeping = false; | 5664 FLAG_concurrent_sweeping = false; |
| 5660 #ifdef VERIFY_HEAP | 5665 #ifdef VERIFY_HEAP |
| 5661 FLAG_verify_heap = false; | 5666 FLAG_verify_heap = false; |
| 5662 #endif | 5667 #endif |
| 5663 CcTest::InitializeVM(); | 5668 CcTest::InitializeVM(); |
| 5664 v8::HandleScope scope(CcTest::isolate()); | 5669 v8::HandleScope scope(CcTest::isolate()); |
| 5665 Heap* heap = CcTest::heap(); | 5670 Heap* heap = CcTest::heap(); |
| 5666 Isolate* isolate = CcTest::i_isolate(); | 5671 Isolate* isolate = CcTest::i_isolate(); |
| 5667 Factory* factory = isolate->factory(); | 5672 Factory* factory = isolate->factory(); |
| 5668 const int N = | 5673 const int N = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 5691 // Re-enable old space expansion to avoid OOM crash. | 5696 // Re-enable old space expansion to avoid OOM crash. |
| 5692 heap->set_force_oom(false); | 5697 heap->set_force_oom(false); |
| 5693 CcTest::CollectGarbage(NEW_SPACE); | 5698 CcTest::CollectGarbage(NEW_SPACE); |
| 5694 } | 5699 } |
| 5695 | 5700 |
| 5696 HEAP_TEST(Regress589413) { | 5701 HEAP_TEST(Regress589413) { |
| 5697 if (!FLAG_incremental_marking) return; | 5702 if (!FLAG_incremental_marking) return; |
| 5698 FLAG_stress_compaction = true; | 5703 FLAG_stress_compaction = true; |
| 5699 FLAG_manual_evacuation_candidates_selection = true; | 5704 FLAG_manual_evacuation_candidates_selection = true; |
| 5700 FLAG_parallel_compaction = false; | 5705 FLAG_parallel_compaction = false; |
| 5706 FLAG_concurrent_marking = false; |
| 5701 FLAG_concurrent_sweeping = false; | 5707 FLAG_concurrent_sweeping = false; |
| 5702 CcTest::InitializeVM(); | 5708 CcTest::InitializeVM(); |
| 5703 v8::HandleScope scope(CcTest::isolate()); | 5709 v8::HandleScope scope(CcTest::isolate()); |
| 5704 Heap* heap = CcTest::heap(); | 5710 Heap* heap = CcTest::heap(); |
| 5705 // Get the heap in clean state. | 5711 // Get the heap in clean state. |
| 5706 CcTest::CollectGarbage(OLD_SPACE); | 5712 CcTest::CollectGarbage(OLD_SPACE); |
| 5707 CcTest::CollectGarbage(OLD_SPACE); | 5713 CcTest::CollectGarbage(OLD_SPACE); |
| 5708 Isolate* isolate = CcTest::i_isolate(); | 5714 Isolate* isolate = CcTest::i_isolate(); |
| 5709 Factory* factory = isolate->factory(); | 5715 Factory* factory = isolate->factory(); |
| 5710 // Fill the new space with byte arrays with elements looking like pointers. | 5716 // Fill the new space with byte arrays with elements looking like pointers. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5938 size_t length() const { return strlen(data_); } | 5944 size_t length() const { return strlen(data_); } |
| 5939 | 5945 |
| 5940 private: | 5946 private: |
| 5941 const char* data_; | 5947 const char* data_; |
| 5942 }; | 5948 }; |
| 5943 | 5949 |
| 5944 TEST(Regress631969) { | 5950 TEST(Regress631969) { |
| 5945 if (!FLAG_incremental_marking) return; | 5951 if (!FLAG_incremental_marking) return; |
| 5946 FLAG_manual_evacuation_candidates_selection = true; | 5952 FLAG_manual_evacuation_candidates_selection = true; |
| 5947 FLAG_parallel_compaction = false; | 5953 FLAG_parallel_compaction = false; |
| 5954 FLAG_concurrent_marking = false; |
| 5948 FLAG_concurrent_sweeping = false; | 5955 FLAG_concurrent_sweeping = false; |
| 5949 CcTest::InitializeVM(); | 5956 CcTest::InitializeVM(); |
| 5950 v8::HandleScope scope(CcTest::isolate()); | 5957 v8::HandleScope scope(CcTest::isolate()); |
| 5951 Heap* heap = CcTest::heap(); | 5958 Heap* heap = CcTest::heap(); |
| 5952 // Get the heap in clean state. | 5959 // Get the heap in clean state. |
| 5953 CcTest::CollectGarbage(OLD_SPACE); | 5960 CcTest::CollectGarbage(OLD_SPACE); |
| 5954 CcTest::CollectGarbage(OLD_SPACE); | 5961 CcTest::CollectGarbage(OLD_SPACE); |
| 5955 Isolate* isolate = CcTest::i_isolate(); | 5962 Isolate* isolate = CcTest::i_isolate(); |
| 5956 Factory* factory = isolate->factory(); | 5963 Factory* factory = isolate->factory(); |
| 5957 // Allocate two strings in a fresh page and mark the page as evacuation | 5964 // Allocate two strings in a fresh page and mark the page as evacuation |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6341 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); | 6348 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); |
| 6342 | 6349 |
| 6343 // Ensure it's not in large object space. | 6350 // Ensure it's not in large object space. |
| 6344 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); | 6351 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); |
| 6345 CHECK(chunk->owner()->identity() != LO_SPACE); | 6352 CHECK(chunk->owner()->identity() != LO_SPACE); |
| 6346 CHECK(chunk->NeverEvacuate()); | 6353 CHECK(chunk->NeverEvacuate()); |
| 6347 } | 6354 } |
| 6348 | 6355 |
| 6349 } // namespace internal | 6356 } // namespace internal |
| 6350 } // namespace v8 | 6357 } // namespace v8 |
| OLD | NEW |