Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: src/execution.cc

Issue 13783: * Made preemption work in Irregexp-native-ia32 (Closed)
Patch Set: Addressed review comments Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/execution.h ('k') | src/jsregexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index 941712a70a8337fd5a01073cb87c7730a979ae29..7ccef5ebf86c81d7d04d1986d1c116296176cdc4 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -38,6 +38,9 @@
#include "simulator-ia32.h"
#endif
+#include "debug.h"
+#include "v8threads.h"
+
namespace v8 { namespace internal {
@@ -500,6 +503,69 @@ Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
}
+static Object* RuntimePreempt() {
+ // Clear the preempt request flag.
+ StackGuard::Continue(PREEMPT);
+
+ ContextSwitcher::PreemptionReceived();
+
+ {
+ v8::Unlocker unlocker;
+ Thread::YieldCPU();
+ }
+
+ return Heap::undefined_value();
+}
+
+
+Object* Execution::DebugBreakHelper() {
+ // Just continue if breaks are disabled.
+ if (Debug::disable_break()) {
+ return Heap::undefined_value();
+ }
+
+ // Don't break in system functions. If the current function is
+ // either in the builtins object of some context or is in the debug
+ // context just return with the debug break stack guard active.
+ JavaScriptFrameIterator it;
+ JavaScriptFrame* frame = it.frame();
+ Object* fun = frame->function();
+ if (fun->IsJSFunction()) {
+ GlobalObject* global = JSFunction::cast(fun)->context()->global();
+ if (global->IsJSBuiltinsObject() || Debug::IsDebugGlobal(global)) {
+ return Heap::undefined_value();
+ }
+ }
+
+ // Clear the debug request flag.
+ StackGuard::Continue(DEBUGBREAK);
+
+ HandleScope scope;
+ // Enter the debugger. Just continue if we fail to enter the debugger.
+ EnterDebugger debugger;
+ if (debugger.FailedToEnter()) {
+ return Heap::undefined_value();
+ }
+
+ // Notify the debug event listeners.
+ Debugger::OnDebugBreak(Factory::undefined_value());
+
+ // Return to continue execution.
+ return Heap::undefined_value();
+}
+
+
+Object* Execution::HandleStackGuardInterrupt() {
+ if (StackGuard::IsDebugBreak()) DebugBreakHelper();
+ if (StackGuard::IsPreempted()) RuntimePreempt();
+ if (StackGuard::IsInterrupted()) {
+ // interrupt
+ StackGuard::Continue(INTERRUPT);
+ return Top::StackOverflow();
+ }
+ return Heap::undefined_value();
+}
+
// --- G C E x t e n s i o n ---
const char* GCExtension::kSource = "native function gc();";
« no previous file with comments | « src/execution.h ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698