| Index: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
|
| index 51b46863fe6f60466fabb4b5e84b14e09973575b..79d307f440c26953872839edc9041cf9c63bf3e8 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
|
| @@ -351,7 +351,8 @@ void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal
|
| if (BlameContext* blameContext = Platform::current()->topLevelBlameContext())
|
| blameContext->Leave();
|
|
|
| - if (ThreadState::current() && !ThreadState::current()->isGCForbidden()) {
|
| + ThreadState* currentThreadState = ThreadState::current();
|
| + if (currentThreadState && !currentThreadState->isGCForbidden()) {
|
| // v8::kGCCallbackFlagForced forces a Blink heap garbage collection
|
| // when a garbage collection was forced from V8. This is either used
|
| // for tests that force GCs from JavaScript to verify that objects die
|
| @@ -367,11 +368,11 @@ void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal
|
| // to collect all garbage, you need to wait until the next event loop.
|
| // Regarding (2), it would be OK in practice to trigger only one GC per gcEpilogue, because
|
| // GCController.collectAll() forces multiple V8's GC.
|
| - ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC);
|
| + currentThreadState->collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC);
|
|
|
| // Forces a precise GC at the end of the current event loop.
|
| - RELEASE_ASSERT(!ThreadState::current()->isInGC());
|
| - ThreadState::current()->setGCState(ThreadState::FullGCScheduled);
|
| + RELEASE_ASSERT(!currentThreadState->isInGC());
|
| + currentThreadState->setGCState(ThreadState::FullGCScheduled);
|
| }
|
|
|
| // v8::kGCCallbackFlagCollectAllAvailableGarbage is used when V8 handles
|
| @@ -379,12 +380,11 @@ void V8GCController::gcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCal
|
| if ((flags & v8::kGCCallbackFlagCollectAllAvailableGarbage)
|
| || (flags & v8::kGCCallbackFlagCollectAllExternalMemory)) {
|
| // This single GC is not enough. See the above comment.
|
| - ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC);
|
| + currentThreadState->collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC);
|
|
|
| // The conservative GC might have left floating garbage. Schedule
|
| // precise GC to ensure that we collect all available garbage.
|
| - if (ThreadState::current())
|
| - ThreadState::current()->schedulePreciseGC();
|
| + currentThreadState->schedulePreciseGC();
|
| }
|
| }
|
|
|
|
|