| Index: src/debug.cc
|
| diff --git a/src/debug.cc b/src/debug.cc
|
| index fa5318b7aabf04480cbacecb4d526944766ae8fa..cf5cf435d42f1c53b14fe5097dec4f12ac770e10 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,
|
| - v8::DebugEvent type) {
|
| + bool before) {
|
| // Create the compile event object.
|
| Handle<Object> script_wrapper = Script::GetWrapper(script);
|
| Handle<Object> argv[] = { script_wrapper,
|
| - isolate_->factory()->NewNumberFromInt(type) };
|
| + isolate_->factory()->ToBoolean(before) };
|
| return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
|
| }
|
|
|
| @@ -2607,24 +2607,6 @@ 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.
|
| @@ -2655,8 +2637,7 @@ 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, v8::BeforeCompile).ToHandle(&event_data))
|
| - return;
|
| + if (!MakeCompileEvent(script, true).ToHandle(&event_data)) return;
|
|
|
| // Process debug event.
|
| ProcessDebugEvent(v8::BeforeCompile,
|
| @@ -2666,7 +2647,8 @@ void Debug::OnBeforeCompile(Handle<Script> script) {
|
|
|
|
|
| // Handle debugger actions when a new script is compiled.
|
| -void Debug::OnAfterCompile(Handle<Script> script) {
|
| +void Debug::OnAfterCompile(Handle<Script> script,
|
| + AfterCompileFlags after_compile_flags) {
|
| // Add the newly compiled script to the script cache.
|
| if (script_cache_ != NULL) script_cache_->Add(script);
|
|
|
| @@ -2674,6 +2656,9 @@ void Debug::OnAfterCompile(Handle<Script> script) {
|
| if (in_debug_scope() || ignore_events()) return;
|
|
|
| HandleScope scope(isolate_);
|
| + // Store whether in debugger before entering debugger.
|
| + bool was_in_scope = in_debug_scope();
|
| +
|
| DebugScope debug_scope(this);
|
| if (debug_scope.failed()) return;
|
|
|
| @@ -2705,11 +2690,13 @@ void Debug::OnAfterCompile(Handle<Script> script) {
|
| argv).is_null()) {
|
| return;
|
| }
|
| + // Bail out based on state or if there is no listener for this event
|
| + if (was_in_scope && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return;
|
|
|
| // Create the compile state object.
|
| Handle<Object> event_data;
|
| // Bail out and don't call debugger if exception.
|
| - if (!MakeCompileEvent(script, v8::AfterCompile).ToHandle(&event_data)) return;
|
| + if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return;
|
|
|
| // Process debug event.
|
| ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true);
|
|
|