Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index f484d8d9b819af699e25786c8b66b8167441afe1..d1ada882c68a138e9197fc28d5089da3c86841d8 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -260,7 +260,7 @@ void StackGuard::DisableInterrupts() { |
bool StackGuard::IsInterrupted() { |
ExecutionAccess access; |
- return thread_local_.interrupt_flags_ & INTERRUPT; |
+ return (thread_local_.interrupt_flags_ & INTERRUPT) != 0; |
} |
@@ -286,7 +286,7 @@ void StackGuard::Preempt() { |
bool StackGuard::IsTerminateExecution() { |
ExecutionAccess access; |
- return thread_local_.interrupt_flags_ & TERMINATE; |
+ return (thread_local_.interrupt_flags_ & TERMINATE) != 0; |
} |
@@ -299,7 +299,7 @@ void StackGuard::TerminateExecution() { |
bool StackGuard::IsRuntimeProfilerTick() { |
ExecutionAccess access; |
- return thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK; |
+ return (thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK) != 0; |
} |
@@ -316,6 +316,22 @@ void StackGuard::RequestRuntimeProfilerTick() { |
} |
+bool StackGuard::IsGCRequest() { |
+ ExecutionAccess access; |
+ return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; |
+} |
+ |
+ |
+void StackGuard::RequestGC() { |
+ ExecutionAccess access; |
+ thread_local_.interrupt_flags_ |= GC_REQUEST; |
+ if (thread_local_.postpone_interrupts_nesting_ == 0) { |
+ thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
+ Heap::SetStackLimits(); |
+ } |
+} |
+ |
+ |
#ifdef ENABLE_DEBUGGER_SUPPORT |
bool StackGuard::IsDebugBreak() { |
ExecutionAccess access; |
@@ -704,6 +720,11 @@ void Execution::ProcessDebugMesssages(bool debug_command_only) { |
#endif |
MaybeObject* Execution::HandleStackGuardInterrupt() { |
+ if (StackGuard::IsGCRequest()) { |
+ Heap::CollectAllGarbage(false); |
+ StackGuard::Continue(GC_REQUEST); |
+ } |
+ |
Counters::stack_interrupts.Increment(); |
if (StackGuard::IsRuntimeProfilerTick()) { |
Counters::runtime_profiler_ticks.Increment(); |