Commit 399a6f53 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

Disallow JS during GC

R=mlippautz@chromium.org

Change-Id: Ic1d2fce007ddcb72f56ad257032e434c575a3f8d
Reviewed-on: https://chromium-review.googlesource.com/c/1456104
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59869}
parent 385aa80a
...@@ -1704,6 +1704,8 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) { ...@@ -1704,6 +1704,8 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
bool Heap::PerformGarbageCollection( bool Heap::PerformGarbageCollection(
GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) { GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags) {
DisallowJavascriptExecution no_js(isolate());
size_t freed_global_handles = 0; size_t freed_global_handles = 0;
if (!IsYoungGenerationCollector(collector)) { if (!IsYoungGenerationCollector(collector)) {
...@@ -1728,6 +1730,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1728,6 +1730,7 @@ bool Heap::PerformGarbageCollection(
EmbedderHeapTracer::EmbedderStackState::kUnknown); EmbedderHeapTracer::EmbedderStackState::kUnknown);
if (scope.CheckReenter()) { if (scope.CheckReenter()) {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
AllowJavascriptExecution allow_js(isolate());
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_PROLOGUE); TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_PROLOGUE);
VMState<EXTERNAL> state(isolate_); VMState<EXTERNAL> state(isolate_);
HandleScope handle_scope(isolate_); HandleScope handle_scope(isolate_);
...@@ -1817,6 +1820,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1817,6 +1820,7 @@ bool Heap::PerformGarbageCollection(
gc_post_processing_depth_++; gc_post_processing_depth_++;
{ {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
AllowJavascriptExecution allow_js(isolate());
freed_global_handles += freed_global_handles +=
isolate_->global_handles()->PostGarbageCollectionProcessing( isolate_->global_handles()->PostGarbageCollectionProcessing(
collector, gc_callback_flags); collector, gc_callback_flags);
...@@ -1866,6 +1870,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1866,6 +1870,7 @@ bool Heap::PerformGarbageCollection(
GCCallbacksScope scope(this); GCCallbacksScope scope(this);
if (scope.CheckReenter()) { if (scope.CheckReenter()) {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
AllowJavascriptExecution allow_js(isolate());
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_EPILOGUE); TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_EPILOGUE);
VMState<EXTERNAL> state(isolate_); VMState<EXTERNAL> state(isolate_);
HandleScope handle_scope(isolate_); HandleScope handle_scope(isolate_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment