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 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2334 // marking | 2334 // marking |
2335 // since the completion threshold is not reached | 2335 // since the completion threshold is not reached |
2336 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; | 2336 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; |
2337 i++) { | 2337 i++) { |
2338 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2338 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2339 IncrementalMarking::FORCE_MARKING, | 2339 IncrementalMarking::FORCE_MARKING, |
2340 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2340 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2341 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2341 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2342 } | 2342 } |
2343 | 2343 |
| 2344 marking->SetWeakClosureWasOverApproximatedForTesting(true); |
| 2345 |
2344 // The next idle notification has to finish incremental marking. | 2346 // The next idle notification has to finish incremental marking. |
2345 const int kLongIdleTime = 1000000; | 2347 const int kLongIdleTime = 1000000; |
2346 CcTest::isolate()->IdleNotification(kLongIdleTime); | 2348 CcTest::isolate()->IdleNotification(kLongIdleTime); |
2347 CHECK_EQ(CcTest::heap()->gc_count(), 1); | 2349 CHECK_EQ(CcTest::heap()->gc_count(), 1); |
2348 } | 2350 } |
2349 | 2351 |
2350 | 2352 |
2351 // Test that HAllocateObject will always return an object in new-space. | 2353 // Test that HAllocateObject will always return an object in new-space. |
2352 TEST(OptimizedAllocationAlwaysInNewSpace) { | 2354 TEST(OptimizedAllocationAlwaysInNewSpace) { |
2353 i::FLAG_allow_natives_syntax = true; | 2355 i::FLAG_allow_natives_syntax = true; |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4058 v8::HandleScope scope(CcTest::isolate()); | 4060 v8::HandleScope scope(CcTest::isolate()); |
4059 CompileRun("function f(n) {" | 4061 CompileRun("function f(n) {" |
4060 " var a = new Array(n);" | 4062 " var a = new Array(n);" |
4061 " for (var i = 0; i < n; i += 100) a[i] = i;" | 4063 " for (var i = 0; i < n; i += 100) a[i] = i;" |
4062 "};" | 4064 "};" |
4063 "f(10 * 1024 * 1024);"); | 4065 "f(10 * 1024 * 1024);"); |
4064 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 4066 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
4065 if (marking->IsStopped()) marking->Start(); | 4067 if (marking->IsStopped()) marking->Start(); |
4066 // This big step should be sufficient to mark the whole array. | 4068 // This big step should be sufficient to mark the whole array. |
4067 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4069 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
4068 DCHECK(marking->IsComplete()); | 4070 DCHECK(marking->IsComplete() || |
| 4071 marking->IsReadyToOverApproximateWeakClosure()); |
4069 } | 4072 } |
4070 | 4073 |
4071 | 4074 |
4072 TEST(DisableInlineAllocation) { | 4075 TEST(DisableInlineAllocation) { |
4073 i::FLAG_allow_natives_syntax = true; | 4076 i::FLAG_allow_natives_syntax = true; |
4074 CcTest::InitializeVM(); | 4077 CcTest::InitializeVM(); |
4075 v8::HandleScope scope(CcTest::isolate()); | 4078 v8::HandleScope scope(CcTest::isolate()); |
4076 CompileRun("function test() {" | 4079 CompileRun("function test() {" |
4077 " var x = [];" | 4080 " var x = [];" |
4078 " for (var i = 0; i < 10; i++) {" | 4081 " for (var i = 0; i < 10; i++) {" |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5138 | 5141 |
5139 TEST(WritableVsImmortalRoots) { | 5142 TEST(WritableVsImmortalRoots) { |
5140 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { | 5143 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { |
5141 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); | 5144 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); |
5142 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); | 5145 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); |
5143 bool immortal = Heap::RootIsImmortalImmovable(root_index); | 5146 bool immortal = Heap::RootIsImmortalImmovable(root_index); |
5144 // A root value can be writable, immortal, or neither, but not both. | 5147 // A root value can be writable, immortal, or neither, but not both. |
5145 CHECK(!immortal || !writable); | 5148 CHECK(!immortal || !writable); |
5146 } | 5149 } |
5147 } | 5150 } |
OLD | NEW |