Lines Matching refs:v8

5 #include "src/inspector/v8-console.h"
7 #include "include/v8-container.h"
8 #include "include/v8-context.h"
9 #include "include/v8-function.h"
10 #include "include/v8-inspector.h"
11 #include "include/v8-microtask-queue.h"
16 #include "src/inspector/v8-console-message.h"
17 #include "src/inspector/v8-debugger-agent-impl.h"
18 #include "src/inspector/v8-inspector-impl.h"
19 #include "src/inspector/v8-inspector-session-impl.h"
20 #include "src/inspector/v8-profiler-agent-impl.h"
21 #include "src/inspector/v8-runtime-agent-impl.h"
22 #include "src/inspector/v8-stack-trace-impl.h"
23 #include "src/inspector/v8-value-utils.h"
31 v8::Isolate* isolate, const v8::debug::ConsoleContext& consoleContext) {
39 ConsoleHelper(const v8::debug::ConsoleCallArguments& info,
40 const v8::debug::ConsoleContext& consoleContext,
72 std::vector<v8::Local<v8::Value>> arguments;
80 std::vector<v8::Local<v8::Value>> arguments;
89 std::vector<v8::Local<v8::Value>> arguments;
96 std::vector<v8::Local<v8::Value>> arguments(1,
102 const std::vector<v8::Local<v8::Value>>& arguments) {
118 std::vector<v8::Local<v8::Value>> arguments(1,
125 if (m_info[0]->IsBoolean()) return m_info[0].As<v8::Boolean>()->Value();
134 v8::Local<v8::String> titleValue;
140 v8::MaybeLocal<v8::Object> firstArgAsObject() {
142 return v8::MaybeLocal<v8::Object>();
143 return m_info[0].As<v8::Object>();
146 v8::MaybeLocal<v8::Function> firstArgAsFunction() {
148 return v8::MaybeLocal<v8::Function>();
149 v8::Local<v8::Function> func = m_info[0].As<v8::Function>();
151 func = func->GetBoundFunction().As<v8::Function>();
160 const v8::debug::ConsoleCallArguments& m_info;
161 const v8::debug::ConsoleContext& m_consoleContext;
162 v8::Isolate* m_isolate;
163 v8::Local<v8::Context> m_context;
170 v8::Local<v8::Context> context, v8::Local<v8::Object> console,
171 v8::Local<v8::Value> data, const char* name, v8::FunctionCallback callback,
172 v8::SideEffectType side_effect_type = v8::SideEffectType::kHasSideEffect) {
173 v8::Local<v8::String> funcName =
175 v8::Local<v8::Function> func;
176 if (!v8::Function::New(context, callback, data, 0,
177 v8::ConstructorBehavior::kThrow, side_effect_type)
190 void V8Console::Debug(const v8::debug::ConsoleCallArguments& info,
191 const v8::debug::ConsoleContext& consoleContext) {
192 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Debug");
197 void V8Console::Error(const v8::debug::ConsoleCallArguments& info,
198 const v8::debug::ConsoleContext& consoleContext) {
199 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Error");
204 void V8Console::Info(const v8::debug::ConsoleCallArguments& info,
205 const v8::debug::ConsoleContext& consoleContext) {
206 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Info");
211 void V8Console::Log(const v8::debug::ConsoleCallArguments& info,
212 const v8::debug::ConsoleContext& consoleContext) {
213 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Log");
218 void V8Console::Warn(const v8::debug::ConsoleCallArguments& info,
219 const v8::debug::ConsoleContext& consoleContext) {
220 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Warn");
225 void V8Console::Dir(const v8::debug::ConsoleCallArguments& info,
226 const v8::debug::ConsoleContext& consoleContext) {
227 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Dir");
232 void V8Console::DirXml(const v8::debug::ConsoleCallArguments& info,
233 const v8::debug::ConsoleContext& consoleContext) {
234 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::DirXml");
239 void V8Console::Table(const v8::debug::ConsoleCallArguments& info,
240 const v8::debug::ConsoleContext& consoleContext) {
241 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Table");
246 void V8Console::Trace(const v8::debug::ConsoleCallArguments& info,
247 const v8::debug::ConsoleContext& consoleContext) {
248 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Trace");
254 void V8Console::Group(const v8::debug::ConsoleCallArguments& info,
255 const v8::debug::ConsoleContext& consoleContext) {
256 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Group");
263 const v8::debug::ConsoleCallArguments& info,
264 const v8::debug::ConsoleContext& consoleContext) {
265 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
272 void V8Console::GroupEnd(const v8::debug::ConsoleCallArguments& info,
273 const v8::debug::ConsoleContext& consoleContext) {
274 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
281 void V8Console::Clear(const v8::debug::ConsoleCallArguments& info,
282 const v8::debug::ConsoleContext& consoleContext) {
283 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Clear");
293 const v8::debug::ConsoleContext& consoleContext,
312 void V8Console::Count(const v8::debug::ConsoleCallArguments& info,
313 const v8::debug::ConsoleContext& consoleContext) {
314 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
327 TRACE_EVENT_END2(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
332 void V8Console::CountReset(const v8::debug::ConsoleCallArguments& info,
333 const v8::debug::ConsoleContext& consoleContext) {
334 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
346 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
351 void V8Console::Assert(const v8::debug::ConsoleCallArguments& info,
352 const v8::debug::ConsoleContext& consoleContext) {
353 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Assert");
357 std::vector<v8::Local<v8::Value>> arguments;
366 void V8Console::Profile(const v8::debug::ConsoleCallArguments& info,
367 const v8::debug::ConsoleContext& consoleContext) {
368 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
375 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
380 void V8Console::ProfileEnd(const v8::debug::ConsoleCallArguments& info,
381 const v8::debug::ConsoleContext& consoleContext) {
382 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
389 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
394 static void timeFunction(const v8::debug::ConsoleCallArguments& info,
395 const v8::debug::ConsoleContext& consoleContext,
413 static void timeEndFunction(const v8::debug::ConsoleCallArguments& info,
414 const v8::debug::ConsoleContext& consoleContext,
446 void V8Console::Time(const v8::debug::ConsoleCallArguments& info,
447 const v8::debug::ConsoleContext& consoleContext) {
448 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::Time");
452 void V8Console::TimeLog(const v8::debug::ConsoleCallArguments& info,
453 const v8::debug::ConsoleContext& consoleContext) {
454 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::TimeLog");
458 void V8Console::TimeEnd(const v8::debug::ConsoleCallArguments& info,
459 const v8::debug::ConsoleContext& consoleContext) {
460 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"), "V8Console::TimeEnd");
464 void V8Console::TimeStamp(const v8::debug::ConsoleCallArguments& info,
465 const v8::debug::ConsoleContext& consoleContext) {
466 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.inspector"),
474 const v8::FunctionCallbackInfo<v8::Value>& info) {
475 v8::Local<v8::Value> memoryValue;
485 const v8::FunctionCallbackInfo<v8::Value>& info) {
491 v8::Maybe<int64_t> V8Console::ValidateAndGetTaskId(
492 const v8::FunctionCallbackInfo<v8::Value>& info) {
495 return v8::Nothing<int64_t>();
500 !v8::Just(info[0].As<v8::Integer>()->Value()).To(&argId)) {
502 return v8::Nothing<int64_t>();
508 return v8::Nothing<int64_t>();
511 return v8::Just(argId);
515 const v8::FunctionCallbackInfo<v8::Value>& info) {
525 v8::debug::ConsoleCallArguments args(info);
526 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
529 info.Length() == 2 ? info[1].As<v8::Boolean>()->Value() : false;
546 info.GetReturnValue().Set(v8::Number::New(info.GetIsolate(), id));
550 const v8::FunctionCallbackInfo<v8::Value>& info) {
551 v8::Maybe<int64_t> maybeArgId = ValidateAndGetTaskId(info);
560 const v8::FunctionCallbackInfo<v8::Value>& info) {
561 v8::Maybe<int64_t> maybeArgId = ValidateAndGetTaskId(info);
577 const v8::FunctionCallbackInfo<v8::Value>& info) {
578 v8::Maybe<int64_t> maybeArgId = ValidateAndGetTaskId(info);
589 void V8Console::keysCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
591 v8::Isolate* isolate = info.GetIsolate();
592 info.GetReturnValue().Set(v8::Array::New(isolate));
594 v8::debug::ConsoleCallArguments args(info);
595 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
596 v8::Local<v8::Object> obj;
598 v8::Local<v8::Array> names;
604 void V8Console::valuesCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
606 v8::Isolate* isolate = info.GetIsolate();
607 info.GetReturnValue().Set(v8::Array::New(isolate));
609 v8::debug::ConsoleCallArguments args(info);
610 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
611 v8::Local<v8::Object> obj;
613 v8::Local<v8::Array> names;
614 v8::Local<v8::Context> context = isolate->GetCurrentContext();
616 v8::Local<v8::Array> values = v8::Array::New(isolate, names->Length());
618 v8::Local<v8::Value> key;
620 v8::Local<v8::Value> value;
628 v8::Local<v8::Function> function,
630 v8::Local<v8::String> condition,
643 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
644 v8::debug::ConsoleCallArguments args(info);
645 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
646 v8::Local<v8::Function> function;
647 v8::Local<v8::String> condition;
650 condition = args[1].As<v8::String>();
658 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
659 v8::debug::ConsoleCallArguments args(info);
660 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
661 v8::Local<v8::Function> function;
665 v8::Local<v8::String>(), false);
669 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
670 v8::debug::ConsoleCallArguments args(info);
671 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
672 v8::Local<v8::Function> function;
674 v8::Local<v8::Value> name = function->GetName();
675 if (!name->IsString() || !name.As<v8::String>()->Length())
696 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
697 v8::debug::ConsoleCallArguments args(info);
698 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
699 v8::Local<v8::Function> function;
703 v8::Local<v8::String>(), false);
707 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
708 v8::debug::ConsoleCallArguments args(info);
709 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
715 static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
716 v8::Local<v8::Value> value, int sessionId,
720 v8::debug::ConsoleCallArguments args(info);
721 ConsoleHelper helper(args, v8::debug::ConsoleContext(), inspector);
742 void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
748 void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
755 const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) {
757 v8::Local<v8::Value> arg = info[0];
759 v8::Isolate* isolate = info.GetIsolate();
760 v8::TryCatch tryCatch(isolate);
761 v8::Local<v8::Value> prototype;
762 if (arg.As<v8::Function>()
777 void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info,
780 v8::debug::ConsoleCallArguments args(info);
781 ConsoleHelper helper(args, v8::debug::ConsoleContext(), m_inspector);
784 v8::Isolate* isolate = info.GetIsolate();
788 info.GetReturnValue().Set(v8::Undefined(isolate));
792 void V8Console::installMemoryGetter(v8::Local<v8::Context> context,
793 v8::Local<v8::Object> console) {
794 v8::Isolate* isolate = context->GetIsolate();
795 v8::Local<v8::External> data = v8::External::New(isolate, this);
798 v8::Function::New(
800 v8::ConstructorBehavior::kThrow, v8::SideEffectType::kHasNoSideEffect)
802 v8::Function::New(context,
804 data, 0, v8::ConstructorBehavior::kThrow)
806 static_cast<v8::PropertyAttribute>(v8::None), v8::DEFAULT);
809 void V8Console::installAsyncStackTaggingAPI(v8::Local<v8::Context> context,
810 v8::Local<v8::Object> console) {
811 v8::Isolate* isolate = context->GetIsolate();
812 v8::Local<v8::External> data = v8::External::New(isolate, this);
814 v8::MicrotasksScope microtasksScope(isolate,
815 v8::MicrotasksScope::kDoNotRunMicrotasks);
819 v8::Function::New(context,
821 data, 0, v8::ConstructorBehavior::kThrow,
822 v8::SideEffectType::kHasSideEffect)
827 v8::Function::New(context,
829 data, 0, v8::ConstructorBehavior::kThrow,
830 v8::SideEffectType::kHasSideEffect)
835 v8::Function::New(context,
837 data, 0, v8::ConstructorBehavior::kThrow,
838 v8::SideEffectType::kHasSideEffect)
843 v8::Function::New(context,
845 data, 0, v8::ConstructorBehavior::kThrow,
846 v8::SideEffectType::kHasSideEffect)
851 v8::Local<v8::Object> V8Console::createCommandLineAPI(
852 v8::Local<v8::Context> context, int sessionId) {
853 v8::Isolate* isolate = context->GetIsolate();
854 v8::MicrotasksScope microtasksScope(isolate,
855 v8::MicrotasksScope::kDoNotRunMicrotasks);
857 v8::Local<v8::Object> commandLineAPI = v8::Object::New(isolate);
859 commandLineAPI->SetPrototype(context, v8::Null(isolate)).FromMaybe(false);
863 v8::Local<v8::ArrayBuffer> data =
864 v8::ArrayBuffer::New(isolate, sizeof(CommandLineAPIData));
882 v8::SideEffectType::kHasNoSideEffect);
885 v8::SideEffectType::kHasNoSideEffect);
908 v8::SideEffectType::kHasNoSideEffect);
911 v8::SideEffectType::kHasNoSideEffect);
914 v8::SideEffectType::kHasNoSideEffect);
917 v8::SideEffectType::kHasNoSideEffect);
920 v8::SideEffectType::kHasNoSideEffect);
923 v8::SideEffectType::kHasNoSideEffect);
938 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
940 info.Data().As<v8::ArrayBuffer>()->GetBackingStore()->Data());
941 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
946 v8::Local<v8::Object> commandLineAPI = scope->m_commandLineAPI;
948 v8::Local<v8::Value> value;
953 v8::MicrotasksScope microtasks(info.GetIsolate(),
954 v8::MicrotasksScope::kDoNotRunMicrotasks);
955 if (value.As<v8::Function>()
965 v8::Local<v8::Name> name, v8::Local<v8::Value> value,
966 const v8::PropertyCallbackInfo<void>& info) {
968 info.Data().As<v8::ArrayBuffer>()->GetBackingStore()->Data());
970 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
978 v8::Local<v8::Context> context, v8::Local<v8::Object> commandLineAPI,
979 v8::Local<v8::Object> global)
983 m_installedMethods(v8::Set::New(context->GetIsolate())) {
984 v8::MicrotasksScope microtasksScope(context->GetIsolate(),
985 v8::MicrotasksScope::kDoNotRunMicrotasks);
986 v8::Local<v8::Array> names;
989 v8::ArrayBuffer::New(context->GetIsolate(), sizeof(CommandLineAPIScope*));
993 v8::Local<v8::Value> name;
999 ->SetAccessor(context, name.As<v8::Name>(),
1002 m_thisReference, v8::DEFAULT, v8::DontEnum,
1003 v8::SideEffectType::kHasNoSideEffect)
1014 v8::MicrotasksScope microtasksScope(m_context->GetIsolate(),
1015 v8::MicrotasksScope::kDoNotRunMicrotasks);
1018 v8::Local<v8::Array> names = m_installedMethods->AsArray();
1020 v8::Local<v8::Value> name;
1023 v8::Local<v8::Value> descriptor;
1025 m_global->GetOwnPropertyDescriptor(m_context, name.As<v8::String>())