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

Side by Side Diff: src/inspector/v8-debugger.cc

Issue 2493773003: [inspector] Introduce translation of wasm frames (Closed)
Patch Set: Address Alexey's comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-debugger.h" 5 #include "src/inspector/v8-debugger.h"
6 6
7 #include "src/inspector/debugger-script.h" 7 #include "src/inspector/debugger-script.h"
8 #include "src/inspector/protocol/Protocol.h" 8 #include "src/inspector/protocol/Protocol.h"
9 #include "src/inspector/script-breakpoint.h" 9 #include "src/inspector/script-breakpoint.h"
10 #include "src/inspector/string-util.h" 10 #include "src/inspector/string-util.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 if (event == v8::AsyncTaskEvent) { 568 if (event == v8::AsyncTaskEvent) {
569 v8::HandleScope scope(m_isolate); 569 v8::HandleScope scope(m_isolate);
570 handleV8AsyncTaskEvent(eventContext, eventDetails.GetExecutionState(), 570 handleV8AsyncTaskEvent(eventContext, eventDetails.GetExecutionState(),
571 eventDetails.GetEventData()); 571 eventDetails.GetEventData());
572 return; 572 return;
573 } 573 }
574 574
575 V8DebuggerAgentImpl* agent = 575 V8DebuggerAgentImpl* agent =
576 m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext)); 576 m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext));
577 if (agent) { 577 if (!agent) return;
578 v8::HandleScope scope(m_isolate); 578
579 if (m_ignoreScriptParsedEventsCounter == 0 && 579 v8::HandleScope scope(m_isolate);
580 (event == v8::AfterCompile || event == v8::CompileError)) { 580 if (event == v8::AfterCompile || event == v8::CompileError) {
581 v8::Local<v8::Context> context = debuggerContext(); 581 v8::Context::Scope contextScope(debuggerContext());
582 v8::Context::Scope contextScope(context); 582 // Determine if it is a wasm script by checking whether the source url
583 // starts with "wasm://".
584 v8::Local<v8::Value> scriptMirror =
585 callInternalGetterFunction(eventDetails.GetEventData(), "script");
586 DCHECK(scriptMirror->IsObject());
587 v8::Local<v8::Value> scriptWrapper =
588 callInternalGetterFunction(scriptMirror.As<v8::Object>(), "value");
589 DCHECK(scriptWrapper->IsObject());
590 v8::Local<v8::Boolean> isWasmScript =
591 callInternalGetterFunction(scriptWrapper.As<v8::Object>(), "isWasm")
592 .As<v8::Boolean>();
593 if (isWasmScript->Value()) {
594 agent->newWasmScript(scriptWrapper.As<v8::Object>());
dgozman 2016/11/16 19:00:10 I think we should use v8::DebugInterface::Script i
Clemens Hammacher 2016/11/16 20:31:30 Done.
595 } else if (m_ignoreScriptParsedEventsCounter == 0) {
583 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; 596 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()};
584 v8::Local<v8::Value> value = 597 v8::Local<v8::Value> value =
585 callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); 598 callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked();
586 if (value->IsNull()) return; 599 if (value->IsNull()) return;
587 DCHECK(value->IsObject()); 600 DCHECK(value->IsObject());
588 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); 601 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value);
589 v8::Local<v8::DebugInterface::Script> script; 602 v8::Local<v8::DebugInterface::Script> script;
590 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) 603 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject)
591 .ToLocal(&script)) 604 .ToLocal(&script))
592 return; 605 return;
593 agent->didParseSource( 606 agent->didParseSource(
594 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), 607 wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)),
595 event == v8::AfterCompile); 608 event == v8::AfterCompile);
596 } else if (event == v8::Exception) {
597 v8::Local<v8::Context> context = debuggerContext();
598 v8::Local<v8::Object> eventData = eventDetails.GetEventData();
599 v8::Local<v8::Value> exception =
600 callInternalGetterFunction(eventData, "exception");
601 v8::Local<v8::Value> promise =
602 callInternalGetterFunction(eventData, "promise");
603 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
604 v8::Local<v8::Value> uncaught =
605 callInternalGetterFunction(eventData, "uncaught");
606 bool isUncaught = uncaught->BooleanValue(context).FromJust();
607 handleProgramBreak(eventContext, eventDetails.GetExecutionState(),
608 exception, v8::Local<v8::Array>(), isPromiseRejection,
609 isUncaught);
610 } else if (event == v8::Break) {
611 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()};
612 v8::Local<v8::Value> hitBreakpoints =
613 callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked();
614 DCHECK(hitBreakpoints->IsArray());
615 handleProgramBreak(eventContext, eventDetails.GetExecutionState(),
616 v8::Local<v8::Value>(),
617 hitBreakpoints.As<v8::Array>());
618 } 609 }
610 } else if (event == v8::Exception) {
611 v8::Local<v8::Context> context = debuggerContext();
612 v8::Local<v8::Object> eventData = eventDetails.GetEventData();
613 v8::Local<v8::Value> exception =
614 callInternalGetterFunction(eventData, "exception");
615 v8::Local<v8::Value> promise =
616 callInternalGetterFunction(eventData, "promise");
617 bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject();
618 v8::Local<v8::Value> uncaught =
619 callInternalGetterFunction(eventData, "uncaught");
620 bool isUncaught = uncaught->BooleanValue(context).FromJust();
621 handleProgramBreak(eventContext, eventDetails.GetExecutionState(),
622 exception, v8::Local<v8::Array>(), isPromiseRejection,
623 isUncaught);
624 } else if (event == v8::Break) {
625 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()};
626 v8::Local<v8::Value> hitBreakpoints =
627 callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked();
628 DCHECK(hitBreakpoints->IsArray());
629 handleProgramBreak(eventContext, eventDetails.GetExecutionState(),
630 v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>());
619 } 631 }
620 } 632 }
621 633
622 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, 634 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context,
623 v8::Local<v8::Object> executionState, 635 v8::Local<v8::Object> executionState,
624 v8::Local<v8::Object> eventData) { 636 v8::Local<v8::Object> eventData) {
625 if (!m_maxAsyncCallStackDepth) return; 637 if (!m_maxAsyncCallStackDepth) return;
626 638
627 String16 type = toProtocolStringWithTypeCheck( 639 String16 type = toProtocolStringWithTypeCheck(
628 callInternalGetterFunction(eventData, "type")); 640 callInternalGetterFunction(eventData, "type"));
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 989
978 size_t stackSize = 990 size_t stackSize =
979 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; 991 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1;
980 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) 992 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId))
981 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; 993 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture;
982 994
983 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); 995 return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
984 } 996 }
985 997
986 } // namespace v8_inspector 998 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698