Lines Matching refs:v8
28 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { in v8Boolean()
29 return value ? v8::True(isolate) : v8::False(isolate); in v8Boolean()
36 v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod( in callDebuggerMethod()
37 const char* functionName, int argc, v8::Local<v8::Value> argv[]) { in callDebuggerMethod()
38 v8::MicrotasksScope microtasks(m_isolate, in callDebuggerMethod()
39 v8::MicrotasksScope::kDoNotRunMicrotasks); in callDebuggerMethod()
41 v8::Local<v8::Context> context = m_isolate->GetCurrentContext(); in callDebuggerMethod()
42 v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); in callDebuggerMethod()
43 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( in callDebuggerMethod()
50 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) in V8Debugger()
59 m_pauseOnExceptionsState(v8::DebugInterface::NoBreakOnException) {} in V8Debugger()
66 v8::HandleScope scope(m_isolate); in enable()
67 v8::DebugInterface::SetDebugEventListener(m_isolate, in enable()
69 v8::External::New(m_isolate, this)); in enable()
71 v8::DebugInterface::GetDebugContext(m_isolate)); in enable()
72 v8::DebugInterface::ChangeBreakOnException( in enable()
73 m_isolate, v8::DebugInterface::NoBreakOnException); in enable()
74 m_pauseOnExceptionsState = v8::DebugInterface::NoBreakOnException; in enable()
85 v8::DebugInterface::SetDebugEventListener(m_isolate, nullptr); in disable()
91 int V8Debugger::contextId(v8::Local<v8::Context> context) { in contextId()
92 v8::Local<v8::Value> data = in contextId()
93 context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); in contextId()
95 String16 dataString = toProtocolString(data.As<v8::String>()); in contextId()
106 int V8Debugger::getGroupId(v8::Local<v8::Context> context) { in getGroupId()
107 v8::Local<v8::Value> data = in getGroupId()
108 context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); in getGroupId()
110 String16 dataString = toProtocolString(data.As<v8::String>()); in getGroupId()
120 v8::HandleScope scope(m_isolate); in getCompiledScripts()
121 v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); in getCompiledScripts()
122 v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); in getCompiledScripts()
125 v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); in getCompiledScripts()
127 v8::ScriptOriginOptions origin = script->OriginOptions(); in getCompiledScripts()
129 v8::Local<v8::String> v8ContextData; in getCompiledScripts()
142 v8::HandleScope scope(m_isolate); in setBreakpoint()
143 v8::Local<v8::Context> context = debuggerContext(); in setBreakpoint()
144 v8::Context::Scope contextScope(context); in setBreakpoint()
146 v8::Local<v8::Object> info = v8::Object::New(m_isolate); in setBreakpoint()
153 v8::Integer::New(m_isolate, scriptBreakpoint.lineNumber)) in setBreakpoint()
158 v8::Integer::New(m_isolate, scriptBreakpoint.columnNumber)) in setBreakpoint()
166 v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( in setBreakpoint()
170 v8::Local<v8::Value> breakpointId = in setBreakpoint()
171 v8::DebugInterface::Call(debuggerContext(), setBreakpointFunction, info) in setBreakpoint()
184 return toProtocolString(breakpointId.As<v8::String>()); in setBreakpoint()
188 v8::HandleScope scope(m_isolate); in removeBreakpoint()
189 v8::Local<v8::Context> context = debuggerContext(); in removeBreakpoint()
190 v8::Context::Scope contextScope(context); in removeBreakpoint()
192 v8::Local<v8::Object> info = v8::Object::New(m_isolate); in removeBreakpoint()
200 v8::Local<v8::Function> removeBreakpointFunction = in removeBreakpoint()
201 v8::Local<v8::Function>::Cast( in removeBreakpoint()
206 v8::DebugInterface::Call(debuggerContext(), removeBreakpointFunction, info) in removeBreakpoint()
211 v8::HandleScope scope(m_isolate); in clearBreakpoints()
212 v8::Local<v8::Context> context = debuggerContext(); in clearBreakpoints()
213 v8::Context::Scope contextScope(context); in clearBreakpoints()
215 v8::Local<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast( in clearBreakpoints()
219 v8::DebugInterface::Call(debuggerContext(), clearBreakpoints) in clearBreakpoints()
228 v8::HandleScope scope(m_isolate); in setBreakpointsActivated()
229 v8::Local<v8::Context> context = debuggerContext(); in setBreakpointsActivated()
230 v8::Context::Scope contextScope(context); in setBreakpointsActivated()
232 v8::Local<v8::Object> info = v8::Object::New(m_isolate); in setBreakpointsActivated()
235 v8::Boolean::New(m_isolate, activated)) in setBreakpointsActivated()
238 v8::Local<v8::Function> setBreakpointsActivated = in setBreakpointsActivated()
239 v8::Local<v8::Function>::Cast( in setBreakpointsActivated()
244 v8::DebugInterface::Call(debuggerContext(), setBreakpointsActivated, info) in setBreakpointsActivated()
250 v8::DebugInterface::ExceptionBreakState
257 v8::DebugInterface::ExceptionBreakState pauseOnExceptionsState) { in setPauseOnExceptionsState()
260 v8::DebugInterface::ChangeBreakOnException(m_isolate, pauseOnExceptionsState); in setPauseOnExceptionsState()
267 v8::DebugInterface::DebugBreak(m_isolate); in setPauseOnNextStatement()
269 v8::DebugInterface::CancelDebugBreak(m_isolate); in setPauseOnNextStatement()
280 v8::Local<v8::Value> exception; in breakProgram()
281 v8::Local<v8::Array> hitBreakpoints; in breakProgram()
289 v8::HandleScope scope(m_isolate); in breakProgram()
290 v8::Local<v8::Function> breakFunction; in breakProgram()
291 if (!v8::Function::New(m_isolate->GetCurrentContext(), in breakProgram()
293 v8::External::New(m_isolate, this), 0, in breakProgram()
294 v8::ConstructorBehavior::kThrow) in breakProgram()
297 v8::DebugInterface::Call(debuggerContext(), breakFunction).ToLocalChecked(); in breakProgram()
309 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn); in stepIntoStatement()
316 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepNext); in stepOverStatement()
323 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut); in stepOutOfFunction()
329 v8::DebugInterface::ClearStepping(m_isolate); in clearStepping()
333 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, in setScriptSource()
339 explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { in setScriptSource()
340 v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); in setScriptSource()
344 v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); in setScriptSource()
349 v8::Isolate* m_isolate; in setScriptSource()
354 v8::HandleScope scope(m_isolate); in setScriptSource()
356 std::unique_ptr<v8::Context::Scope> contextScope; in setScriptSource()
358 contextScope = wrapUnique(new v8::Context::Scope(debuggerContext())); in setScriptSource()
360 v8::Local<v8::Value> argv[] = {toV8String(m_isolate, sourceID), newSource, in setScriptSource()
363 v8::Local<v8::Value> v8result; in setScriptSource()
366 v8::TryCatch tryCatch(m_isolate); in setScriptSource()
368 v8::MaybeLocal<v8::Value> maybeResult = in setScriptSource()
371 v8::Local<v8::Message> message = tryCatch.Message(); in setScriptSource()
380 v8::Local<v8::Context> context = m_isolate->GetCurrentContext(); in setScriptSource()
381 v8::Local<v8::Object> resultTuple = in setScriptSource()
431 v8::Local<v8::Value> currentCallFramesV8; in currentCallFrames()
433 v8::Local<v8::Function> currentCallFramesFunction = in currentCallFrames()
434 v8::Local<v8::Function>::Cast( in currentCallFrames()
440 v8::DebugInterface::Call(debuggerContext(), currentCallFramesFunction, in currentCallFrames()
441 v8::Integer::New(m_isolate, limit)) in currentCallFrames()
444 v8::Local<v8::Value> argv[] = {m_executionState, in currentCallFrames()
445 v8::Integer::New(m_isolate, limit)}; in currentCallFrames()
452 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); in currentCallFrames()
455 v8::Local<v8::Value> callFrameValue; in currentCallFrames()
459 v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); in currentCallFrames()
461 debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); in currentCallFrames()
466 static V8Debugger* toV8Debugger(v8::Local<v8::Value> data) { in toV8Debugger()
467 void* p = v8::Local<v8::External>::Cast(data)->Value(); in toV8Debugger()
472 const v8::FunctionCallbackInfo<v8::Value>& info) { in breakProgramCallback()
476 v8::Local<v8::Context> pausedContext = in breakProgramCallback()
478 v8::Local<v8::Value> exception; in breakProgramCallback()
479 v8::Local<v8::Array> hitBreakpoints; in breakProgramCallback()
481 v8::Local<v8::Object>::Cast(info[0]), exception, in breakProgramCallback()
485 void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext, in handleProgramBreak()
486 v8::Local<v8::Object> executionState, in handleProgramBreak()
487 v8::Local<v8::Value> exception, in handleProgramBreak()
488 v8::Local<v8::Array> hitBreakpointNumbers, in handleProgramBreak()
501 v8::Local<v8::Value> hitBreakpointNumber = in handleProgramBreak()
528 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepFrame); in handleProgramBreak()
530 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn); in handleProgramBreak()
532 v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut); in handleProgramBreak()
537 const v8::DebugInterface::EventDetails& eventDetails) { in v8DebugEventCallback()
542 v8::Local<v8::Value> V8Debugger::callInternalGetterFunction( in callInternalGetterFunction()
543 v8::Local<v8::Object> object, const char* functionName) { in callInternalGetterFunction()
544 v8::MicrotasksScope microtasks(m_isolate, in callInternalGetterFunction()
545 v8::MicrotasksScope::kDoNotRunMicrotasks); in callInternalGetterFunction()
546 v8::Local<v8::Value> getterValue = in callInternalGetterFunction()
552 return v8::Local<v8::Function>::Cast(getterValue) in callInternalGetterFunction()
558 const v8::DebugInterface::EventDetails& eventDetails) { in handleV8DebugEvent()
560 v8::DebugEvent event = eventDetails.GetEvent(); in handleV8DebugEvent()
561 if (event != v8::AsyncTaskEvent && event != v8::Break && in handleV8DebugEvent()
562 event != v8::Exception && event != v8::AfterCompile && in handleV8DebugEvent()
563 event != v8::BeforeCompile && event != v8::CompileError) in handleV8DebugEvent()
566 v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); in handleV8DebugEvent()
569 if (event == v8::AsyncTaskEvent) { in handleV8DebugEvent()
570 v8::HandleScope scope(m_isolate); in handleV8DebugEvent()
579 v8::HandleScope scope(m_isolate); in handleV8DebugEvent()
581 (event == v8::AfterCompile || event == v8::CompileError)) { in handleV8DebugEvent()
582 v8::Local<v8::Context> context = debuggerContext(); in handleV8DebugEvent()
583 v8::Context::Scope contextScope(context); in handleV8DebugEvent()
584 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; in handleV8DebugEvent()
585 v8::Local<v8::Value> value = in handleV8DebugEvent()
589 v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); in handleV8DebugEvent()
590 v8::Local<v8::DebugInterface::Script> script; in handleV8DebugEvent()
591 if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) in handleV8DebugEvent()
596 event == v8::AfterCompile); in handleV8DebugEvent()
597 } else if (event == v8::Exception) { in handleV8DebugEvent()
598 v8::Local<v8::Context> context = debuggerContext(); in handleV8DebugEvent()
599 v8::Local<v8::Object> eventData = eventDetails.GetEventData(); in handleV8DebugEvent()
600 v8::Local<v8::Value> exception = in handleV8DebugEvent()
602 v8::Local<v8::Value> promise = in handleV8DebugEvent()
605 v8::Local<v8::Value> uncaught = in handleV8DebugEvent()
609 exception, v8::Local<v8::Array>(), isPromiseRejection, in handleV8DebugEvent()
611 } else if (event == v8::Break) { in handleV8DebugEvent()
612 v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; in handleV8DebugEvent()
613 v8::Local<v8::Value> hitBreakpoints = in handleV8DebugEvent()
617 v8::Local<v8::Value>(), in handleV8DebugEvent()
618 hitBreakpoints.As<v8::Array>()); in handleV8DebugEvent()
623 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, in handleV8AsyncTaskEvent()
624 v8::Local<v8::Object> executionState, in handleV8AsyncTaskEvent()
625 v8::Local<v8::Object> eventData) { in handleV8AsyncTaskEvent()
665 v8::HandleScope scope(m_isolate); in compileDebuggerScript()
666 v8::Context::Scope contextScope(debuggerContext()); in compileDebuggerScript()
668 v8::Local<v8::String> scriptValue = in compileDebuggerScript()
669 v8::String::NewFromUtf8(m_isolate, DebuggerScript_js, in compileDebuggerScript()
670 v8::NewStringType::kInternalized, in compileDebuggerScript()
673 v8::Local<v8::Value> value; in compileDebuggerScript()
680 m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); in compileDebuggerScript()
683 v8::Local<v8::Context> V8Debugger::debuggerContext() const { in debuggerContext()
688 v8::MaybeLocal<v8::Value> V8Debugger::functionScopes( in functionScopes()
689 v8::Local<v8::Context> context, v8::Local<v8::Function> function) { in functionScopes()
692 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); in functionScopes()
694 v8::Local<v8::Value> argv[] = {function}; in functionScopes()
695 v8::Local<v8::Value> scopesValue; in functionScopes()
697 return v8::MaybeLocal<v8::Value>(); in functionScopes()
698 v8::Local<v8::Value> copied; in functionScopes()
703 return v8::MaybeLocal<v8::Value>(); in functionScopes()
704 if (!markAsInternal(context, v8::Local<v8::Array>::Cast(copied), in functionScopes()
706 return v8::MaybeLocal<v8::Value>(); in functionScopes()
707 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied), in functionScopes()
709 return v8::MaybeLocal<v8::Value>(); in functionScopes()
713 v8::MaybeLocal<v8::Array> V8Debugger::internalProperties( in internalProperties()
714 v8::Local<v8::Context> context, v8::Local<v8::Value> value) { in internalProperties()
715 v8::Local<v8::Array> properties; in internalProperties()
716 if (!v8::DebugInterface::GetInternalProperties(m_isolate, value) in internalProperties()
718 return v8::MaybeLocal<v8::Array>(); in internalProperties()
720 v8::Local<v8::Function> function = value.As<v8::Function>(); in internalProperties()
721 v8::Local<v8::Value> location = functionLocation(context, function); in internalProperties()
732 v8::True(m_isolate)); in internalProperties()
738 v8::Local<v8::Value> entries = in internalProperties()
739 collectionEntries(context, v8::Local<v8::Object>::Cast(value)); in internalProperties()
747 v8::Local<v8::Value> location = in internalProperties()
748 generatorObjectLocation(context, v8::Local<v8::Object>::Cast(value)); in internalProperties()
757 v8::Local<v8::Function> function = value.As<v8::Function>(); in internalProperties()
758 v8::Local<v8::Value> boundFunction = function->GetBoundFunction(); in internalProperties()
759 v8::Local<v8::Value> scopes; in internalProperties()
770 v8::Local<v8::Value> V8Debugger::collectionEntries( in collectionEntries()
771 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { in collectionEntries()
774 return v8::Undefined(m_isolate); in collectionEntries()
776 v8::Local<v8::Value> argv[] = {object}; in collectionEntries()
777 v8::Local<v8::Value> entriesValue = in collectionEntries()
779 if (!entriesValue->IsArray()) return v8::Undefined(m_isolate); in collectionEntries()
781 v8::Local<v8::Array> entries = entriesValue.As<v8::Array>(); in collectionEntries()
782 v8::Local<v8::Array> copiedArray = in collectionEntries()
783 v8::Array::New(m_isolate, entries->Length()); in collectionEntries()
784 if (!copiedArray->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) in collectionEntries()
785 return v8::Undefined(m_isolate); in collectionEntries()
787 v8::Local<v8::Value> item; in collectionEntries()
789 return v8::Undefined(m_isolate); in collectionEntries()
790 v8::Local<v8::Value> copied; in collectionEntries()
794 return v8::Undefined(m_isolate); in collectionEntries()
796 return v8::Undefined(m_isolate); in collectionEntries()
799 v8::Local<v8::Array>::Cast(copiedArray), in collectionEntries()
801 return v8::Undefined(m_isolate); in collectionEntries()
805 v8::Local<v8::Value> V8Debugger::generatorObjectLocation( in generatorObjectLocation()
806 v8::Local<v8::Context> context, v8::Local<v8::Object> object) { in generatorObjectLocation()
809 return v8::Null(m_isolate); in generatorObjectLocation()
811 v8::Local<v8::Value> argv[] = {object}; in generatorObjectLocation()
812 v8::Local<v8::Value> location = in generatorObjectLocation()
815 v8::Local<v8::Value> copied; in generatorObjectLocation()
820 return v8::Null(m_isolate); in generatorObjectLocation()
821 if (!markAsInternal(context, v8::Local<v8::Object>::Cast(copied), in generatorObjectLocation()
823 return v8::Null(m_isolate); in generatorObjectLocation()
827 v8::Local<v8::Value> V8Debugger::functionLocation( in functionLocation()
828 v8::Local<v8::Context> context, v8::Local<v8::Function> function) { in functionLocation()
830 if (scriptId == v8::UnboundScript::kNoScriptId) return v8::Null(m_isolate); in functionLocation()
833 if (lineNumber == v8::Function::kLineOffsetNotFound || in functionLocation()
834 columnNumber == v8::Function::kLineOffsetNotFound) in functionLocation()
835 return v8::Null(m_isolate); in functionLocation()
836 v8::Local<v8::Object> location = v8::Object::New(m_isolate); in functionLocation()
837 if (!location->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) in functionLocation()
838 return v8::Null(m_isolate); in functionLocation()
843 return v8::Null(m_isolate); in functionLocation()
846 v8::Integer::New(m_isolate, lineNumber)) in functionLocation()
848 return v8::Null(m_isolate); in functionLocation()
851 v8::Integer::New(m_isolate, columnNumber)) in functionLocation()
853 return v8::Null(m_isolate); in functionLocation()
855 return v8::Null(m_isolate); in functionLocation()
862 v8::Local<v8::StackTrace> stackTrace) { in createStackTrace()
875 v8::Context::Scope contextScope(info.context); in markContext()
876 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), in markContext()
907 v8::HandleScope scope(m_isolate); in asyncTaskScheduled()
975 v8::HandleScope handles(m_isolate); in captureStackTrace()