OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "execution.h" | 7 #include "execution.h" |
8 #include "factory.h" | 8 #include "factory.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 #include "global-handles.h" | 10 #include "global-handles.h" |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1207 for (int i = 1; i <= 100; i++) { | 1207 for (int i = 1; i <= 100; i++) { |
1208 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked(); | 1208 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked(); |
1209 CHECK_EQ(initial_size + i * filler_size, | 1209 CHECK_EQ(initial_size + i * filler_size, |
1210 static_cast<int>(HEAP->SizeOfObjects())); | 1210 static_cast<int>(HEAP->SizeOfObjects())); |
1211 } | 1211 } |
1212 } | 1212 } |
1213 | 1213 |
1214 // The heap size should go back to initial size after a full GC, even | 1214 // The heap size should go back to initial size after a full GC, even |
1215 // though sweeping didn't finish yet. | 1215 // though sweeping didn't finish yet. |
1216 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1216 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1217 CHECK(!HEAP->old_pointer_space()->IsSweepingComplete()); | 1217 |
1218 // Normally sweeping would not be complete here, but no guarantees. | |
1219 | |
1218 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects())); | 1220 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects())); |
1219 | 1221 |
1220 // Advancing the sweeper step-wise should not change the heap size. | 1222 // Advancing the sweeper step-wise should not change the heap size. |
1221 while (!HEAP->old_pointer_space()->IsSweepingComplete()) { | 1223 while (!HEAP->old_pointer_space()->IsSweepingComplete()) { |
1222 HEAP->old_pointer_space()->AdvanceSweeper(KB); | 1224 HEAP->old_pointer_space()->AdvanceSweeper(KB); |
1223 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects())); | 1225 CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects())); |
1224 } | 1226 } |
1225 } | 1227 } |
1226 | 1228 |
1227 | 1229 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1642 marking->Start(); | 1644 marking->Start(); |
1643 | 1645 |
1644 // The following two calls will increment HEAP->global_ic_age(). | 1646 // The following two calls will increment HEAP->global_ic_age(). |
1645 const int kLongIdlePauseInMs = 1000; | 1647 const int kLongIdlePauseInMs = 1000; |
1646 v8::V8::ContextDisposedNotification(); | 1648 v8::V8::ContextDisposedNotification(); |
1647 v8::V8::IdleNotification(kLongIdlePauseInMs); | 1649 v8::V8::IdleNotification(kLongIdlePauseInMs); |
1648 | 1650 |
1649 while (!marking->IsStopped() && !marking->IsComplete()) { | 1651 while (!marking->IsStopped() && !marking->IsComplete()) { |
1650 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 1652 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
1651 } | 1653 } |
1654 if (!marking->IsStopped() || marking->should_hurry()) { | |
1655 // We don't normally finish a GC via Step(), we normally finish by | |
1656 // setting the stack guard and then do the final steps in the stack | |
1657 // guard interrupt. But here we didn't ask for that, and there is no | |
1658 // JS code running to trigger the interrupt, so we explicitly finalize | |
1659 // here. | |
1660 HEAP->CollectAllGarbage(Heap::kNoGCFlags, | |
Vyacheslav Egorov (Chromium)
2012/04/30 11:10:41
It seems that if !IsStopped() and !should_hurry()
| |
1661 "Test finalizing incremental mark-sweep"); | |
1662 } | |
1652 | 1663 |
1653 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); | 1664 CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age()); |
1654 CHECK_EQ(0, f->shared()->opt_count()); | 1665 CHECK_EQ(0, f->shared()->opt_count()); |
1655 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); | 1666 CHECK_EQ(0, f->shared()->code()->profiler_ticks()); |
1656 } | 1667 } |
1657 | 1668 |
1658 | 1669 |
1659 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { | 1670 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { |
1660 i::FLAG_allow_natives_syntax = true; | 1671 i::FLAG_allow_natives_syntax = true; |
1661 #ifdef DEBUG | 1672 #ifdef DEBUG |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 "f(1); f(2); f(3);" | 1728 "f(1); f(2); f(3);" |
1718 "%OptimizeFunctionOnNextCall(f);" | 1729 "%OptimizeFunctionOnNextCall(f);" |
1719 "f(4);"); | 1730 "f(4);"); |
1720 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); | 1731 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); |
1721 | 1732 |
1722 Handle<JSObject> o = | 1733 Handle<JSObject> o = |
1723 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 1734 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
1724 | 1735 |
1725 CHECK(HEAP->InNewSpace(*o)); | 1736 CHECK(HEAP->InNewSpace(*o)); |
1726 } | 1737 } |
OLD | NEW |