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

Unified Diff: src/debug.cc

Issue 264333007: Add OnCompileError handler and v8::CompileError debug event (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 6 months 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/debug.h ('k') | src/debug-debugger.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index cf5cf435d42f1c53b14fe5097dec4f12ac770e10..943d547e19a59a0c933c802eb6204f667c61e9e9 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -2554,11 +2554,11 @@ MaybeHandle<Object> Debug::MakeExceptionEvent(Handle<Object> exception,
MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
- bool before) {
+ v8::DebugEvent type) {
// Create the compile event object.
Handle<Object> script_wrapper = Script::GetWrapper(script);
Handle<Object> argv[] = { script_wrapper,
- isolate_->factory()->ToBoolean(before) };
+ isolate_->factory()->NewNumberFromInt(type) };
return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
}
@@ -2607,6 +2607,24 @@ void Debug::OnException(Handle<Object> exception, bool uncaught) {
}
+void Debug::OnCompileError(Handle<Script> script) {
+ // No more to do if not debugging.
+ if (in_debug_scope() || ignore_events()) return;
+
+ HandleScope scope(isolate_);
+ DebugScope debug_scope(this);
+ if (debug_scope.failed()) return;
+
+ // Create the compile state object.
+ Handle<Object> event_data;
+ // Bail out and don't call debugger if exception.
+ if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return;
+
+ // Process debug event.
+ ProcessDebugEvent(v8::CompileError, Handle<JSObject>::cast(event_data), true);
+}
+
+
void Debug::OnDebugBreak(Handle<Object> break_points_hit,
bool auto_continue) {
// The caller provided for DebugScope.
@@ -2637,7 +2655,8 @@ void Debug::OnBeforeCompile(Handle<Script> script) {
// Create the event data object.
Handle<Object> event_data;
// Bail out and don't call debugger if exception.
- if (!MakeCompileEvent(script, true).ToHandle(&event_data)) return;
+ if (!MakeCompileEvent(script, v8::BeforeCompile).ToHandle(&event_data))
+ return;
// Process debug event.
ProcessDebugEvent(v8::BeforeCompile,
@@ -2696,7 +2715,7 @@ void Debug::OnAfterCompile(Handle<Script> script,
// Create the compile state object.
Handle<Object> event_data;
// Bail out and don't call debugger if exception.
- if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return;
+ if (!MakeCompileEvent(script, v8::AfterCompile).ToHandle(&event_data)) return;
// Process debug event.
ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true);
« no previous file with comments | « src/debug.h ('k') | src/debug-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698