| Index: src/debug.cc
|
| diff --git a/src/debug.cc b/src/debug.cc
|
| index c1c2aad68279b549005857c631e8d3999e6b610d..804aa6c562f6bd038f623768dab19615fc9503f6 100644
|
| --- a/src/debug.cc
|
| +++ b/src/debug.cc
|
| @@ -2424,7 +2424,19 @@ void Debug::RecordEvalCaller(Handle<Script> script) {
|
| MaybeHandle<Object> Debug::MakeJSObject(const char* constructor_name,
|
| int argc,
|
| Handle<Object> argv[]) {
|
| - AssertDebugContext();
|
| + if (in_debug_scope()) {
|
| + Handle<GlobalObject> debug_global(debug_context()->global_object());
|
| + Factory* factory = isolate_->factory();
|
| + Handle<JSFunction> constructor =
|
| + Handle<JSFunction>::cast(Object::GetProperty(
|
| + debug_global, factory->InternalizeUtf8String(constructor_name)).ToHandleChecked());
|
| + PostponeInterruptsScope no_interrupts(isolate_);
|
| + return Execution::TryCall(constructor,
|
| + handle(debug_context()->global_proxy()),
|
| + argc,
|
| + argv);
|
| + }
|
| +
|
| // Create the execution state object.
|
| Handle<GlobalObject> global(isolate_->global_object());
|
| Handle<Object> constructor = Object::GetProperty(
|
| @@ -2574,7 +2586,7 @@ 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;
|
| + if (ignore_events()) return;
|
|
|
| HandleScope scope(isolate_);
|
| DebugScope debug_scope(this);
|
| @@ -2636,7 +2648,17 @@ void Debug::OnAfterCompile(Handle<Script> script) {
|
| if (script_cache_ != NULL) script_cache_->Add(script);
|
|
|
| // No more to do if not debugging.
|
| - if (in_debug_scope() || ignore_events()) return;
|
| + if (ignore_events()) return;
|
| + if (in_debug_scope()) {
|
| + // 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;
|
| +
|
| + // Process debug event.
|
| + ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true);
|
| + return;
|
| + }
|
|
|
| HandleScope scope(isolate_);
|
| DebugScope debug_scope(this);
|
| @@ -2829,7 +2851,8 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event,
|
| // added. It should be enough to clear the flag only once while we are in the
|
| // debugger.
|
| DCHECK(in_debug_scope());
|
| - isolate_->stack_guard()->ClearDebugCommand();
|
| + if (!(in_debug_scope() && (event == v8::AfterCompile || event == v8::CompileError)))
|
| + isolate_->stack_guard()->ClearDebugCommand();
|
|
|
| // Notify the debugger that a debug event has occurred unless auto continue is
|
| // active in which case no event is send.
|
| @@ -2847,6 +2870,7 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event,
|
| // messages in the queue as the execution state might not be what is expected
|
| // by the client.
|
| if (auto_continue && !has_commands()) return;
|
| + if (in_debug_scope() && (event == v8::AfterCompile || event == v8::CompileError)) return;
|
|
|
| // DebugCommandProcessor goes here.
|
| bool running = auto_continue;
|
|
|