| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 static void InitializeVM() { | 44 static void InitializeVM() { |
| 45 if (env.IsEmpty()) env = v8::Context::New(); | 45 if (env.IsEmpty()) env = v8::Context::New(); |
| 46 v8::HandleScope scope; | 46 v8::HandleScope scope; |
| 47 env->Enter(); | 47 env->Enter(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 // Go through all incremental marking steps in one swoop. | 51 // Go through all incremental marking steps in one swoop. |
| 52 static void SimulateIncrementalMarking() { | 52 static void SimulateIncrementalMarking() { |
| 53 MarkCompactCollector* collector = HEAP->mark_compact_collector(); |
| 53 IncrementalMarking* marking = HEAP->incremental_marking(); | 54 IncrementalMarking* marking = HEAP->incremental_marking(); |
| 55 if (collector->IsConcurrentSweepingInProgress()) { |
| 56 collector->WaitUntilSweepingCompleted(); |
| 57 } |
| 54 CHECK(marking->IsMarking() || marking->IsStopped()); | 58 CHECK(marking->IsMarking() || marking->IsStopped()); |
| 55 if (marking->IsStopped()) { | 59 if (marking->IsStopped()) { |
| 56 marking->Start(); | 60 marking->Start(); |
| 57 } | 61 } |
| 58 CHECK(marking->IsMarking()); | 62 CHECK(marking->IsMarking()); |
| 59 while (!marking->IsComplete()) { | 63 while (!marking->IsComplete()) { |
| 60 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 64 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 61 } | 65 } |
| 62 CHECK(marking->IsComplete()); | 66 CHECK(marking->IsComplete()); |
| 63 } | 67 } |
| (...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 // explicitly enqueued. | 3012 // explicitly enqueued. |
| 3009 SimulateIncrementalMarking(); | 3013 SimulateIncrementalMarking(); |
| 3010 | 3014 |
| 3011 // Now enable the debugger which in turn will disable code flushing. | 3015 // Now enable the debugger which in turn will disable code flushing. |
| 3012 CHECK(isolate->debug()->Load()); | 3016 CHECK(isolate->debug()->Load()); |
| 3013 | 3017 |
| 3014 // This cycle will bust the heap and subsequent cycles will go ballistic. | 3018 // This cycle will bust the heap and subsequent cycles will go ballistic. |
| 3015 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3019 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3016 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3020 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3017 } | 3021 } |
| OLD | NEW |