Index: src/execution.cc |
=================================================================== |
--- src/execution.cc (revision 9531) |
+++ src/execution.cc (working copy) |
@@ -33,6 +33,7 @@ |
#include "bootstrapper.h" |
#include "codegen.h" |
#include "debug.h" |
+#include "isolate-inl.h" |
#include "runtime-profiler.h" |
#include "simulator.h" |
#include "v8threads.h" |
@@ -88,11 +89,9 @@ |
Handle<Code> code; |
if (construct) { |
- JSConstructEntryStub stub; |
- code = stub.GetCode(); |
+ code = isolate->factory()->js_construct_entry_code(); |
} else { |
- JSEntryStub stub; |
- code = stub.GetCode(); |
+ code = isolate->factory()->js_entry_code(); |
} |
// Convert calls on global objects to be calls on the global |
@@ -151,6 +150,8 @@ |
Object*** args, |
bool* pending_exception, |
bool convert_receiver) { |
+ *pending_exception = false; |
+ |
if (!callable->IsJSFunction()) { |
callable = TryGetFunctionDelegate(callable, pending_exception); |
if (*pending_exception) return callable; |
@@ -195,6 +196,7 @@ |
v8::TryCatch catcher; |
catcher.SetVerbose(false); |
catcher.SetCaptureMessage(false); |
+ *caught_exception = false; |
Handle<Object> result = Invoke(false, func, receiver, argc, args, |
caught_exception); |
@@ -377,7 +379,7 @@ |
bool StackGuard::IsInterrupted() { |
ExecutionAccess access(isolate_); |
- return thread_local_.interrupt_flags_ & INTERRUPT; |
+ return (thread_local_.interrupt_flags_ & INTERRUPT) != 0; |
} |
@@ -403,7 +405,7 @@ |
bool StackGuard::IsTerminateExecution() { |
ExecutionAccess access(isolate_); |
- return thread_local_.interrupt_flags_ & TERMINATE; |
+ return (thread_local_.interrupt_flags_ & TERMINATE) != 0; |
} |
@@ -416,7 +418,7 @@ |
bool StackGuard::IsRuntimeProfilerTick() { |
ExecutionAccess access(isolate_); |
- return thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK; |
+ return (thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK) != 0; |
} |
@@ -433,6 +435,22 @@ |
} |
+bool StackGuard::IsGCRequest() { |
+ ExecutionAccess access(isolate_); |
+ return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0; |
+} |
+ |
+ |
+void StackGuard::RequestGC() { |
+ ExecutionAccess access(isolate_); |
+ thread_local_.interrupt_flags_ |= GC_REQUEST; |
+ if (thread_local_.postpone_interrupts_nesting_ == 0) { |
+ thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; |
+ isolate_->heap()->SetStackLimits(); |
+ } |
+} |
+ |
+ |
#ifdef ENABLE_DEBUGGER_SUPPORT |
bool StackGuard::IsDebugBreak() { |
ExecutionAccess access(isolate_); |
@@ -740,7 +758,7 @@ |
Handle<Object>::cast(fun).location(), |
pos.location(), |
is_global.location() }; |
- bool caught_exception = false; |
+ bool caught_exception; |
Handle<Object> result = |
TryCall(isolate->get_stack_trace_line_fun(), |
isolate->js_builtins_object(), argc, args, |
@@ -852,6 +870,12 @@ |
MaybeObject* Execution::HandleStackGuardInterrupt() { |
Isolate* isolate = Isolate::Current(); |
StackGuard* stack_guard = isolate->stack_guard(); |
+ |
+ if (stack_guard->IsGCRequest()) { |
+ isolate->heap()->CollectAllGarbage(false); |
+ stack_guard->Continue(GC_REQUEST); |
+ } |
+ |
isolate->counters()->stack_interrupts()->Increment(); |
if (stack_guard->IsRuntimeProfilerTick()) { |
isolate->counters()->runtime_profiler_ticks()->Increment(); |