Lines Matching refs:V8
1 // Copyright 2012 the V8 project authors. All rights reserved.
17 #include "src/third_party/vtune/v8-vtune.h"
24 #include "include/libplatform/v8-tracing.h"
40 #include "src/v8.h"
43 #include "include/v8-inspector.h"
63 namespace v8 {
77 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
144 class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
158 // Predictable v8::Platform implementation. All background and foreground
170 void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override {
175 void CallDelayedOnForegroundThread(v8::Isolate* isolate, Task* task,
180 void CallIdleOnForegroundThread(v8::Isolate* isolate,
185 bool IdleTasksEnabled(v8::Isolate* isolate) override { return false; }
221 v8::Platform* g_platform = NULL;
265 static void FillTraceConfig(v8::Isolate* isolate,
277 Local<v8::Object> trace_config_object = Local<v8::Object>::Cast(result);
294 static bool GetBoolean(v8::Isolate* isolate, Local<Context> context,
295 Local<v8::Object> object, const char* property) {
305 v8::Isolate* isolate, Local<Context> context, Local<v8::Object> object,
325 v8::Isolate* isolate, Local<Context> context, Local<v8::Object> object) {
341 static Local<Value> GetValue(v8::Isolate* isolate, Local<Context> context,
342 Local<v8::Object> object, const char* property) {
353 v8::Isolate* isolate, const char* json_str) {
395 int RealmIndexOrThrow(const v8::FunctionCallbackInfo<v8::Value>& args,
449 v8::String::NewFromTwoByte(temp_isolate, source_buffer,
450 v8::NewStringType::kNormal,
454 name_copy = v8::String::NewFromTwoByte(temp_isolate, name_buffer,
455 v8::NewStringType::kNormal,
458 name_copy = v8::Undefined(temp_isolate);
478 // Compile a string within the current v8 context.
507 // Executes a string within the current v8 context.
545 v8::String::Utf8Value str(result);
550 v8::String::Utf8Value str(Stringify(isolate, result));
797 const v8::FunctionCallbackInfo<v8::Value>& args,
816 // v8::Platform::MonotonicallyIncreasingTime().
817 void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) {
829 void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) {
839 void Shell::RealmOwner(const v8::FunctionCallbackInfo<v8::Value>& args) {
857 void Shell::RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
866 const v8::FunctionCallbackInfo<v8::Value>& args, int index,
867 v8::MaybeLocal<Value> global_object) {
895 void Shell::DisposeRealm(const v8::FunctionCallbackInfo<v8::Value>& args,
907 void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) {
908 CreateRealm(args, -1, v8::MaybeLocal<Value>());
914 const v8::FunctionCallbackInfo<v8::Value>& args) {
916 if (CreateRealm(args, -1, v8::MaybeLocal<Value>()).ToLocal(&context)) {
924 void Shell::RealmNavigate(const v8::FunctionCallbackInfo<v8::Value>& args) {
931 v8::MaybeLocal<Value> global_object = context->Global();
937 void Shell::RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args) {
952 void Shell::RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args) {
962 void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) {
1007 void WriteToFile(FILE* file, const v8::FunctionCallbackInfo<v8::Value>& args) {
1015 v8::TryCatch try_catch(args.GetIsolate());
1028 v8::String::Utf8Value str(str_obj);
1038 const v8::FunctionCallbackInfo<v8::Value>& args) {
1044 void Shell::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
1048 void Shell::PrintErr(const v8::FunctionCallbackInfo<v8::Value>& args) {
1052 void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) {
1056 void Shell::Read(const v8::FunctionCallbackInfo<v8::Value>& args) {
1108 void Shell::Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
1133 void Shell::WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args) {
1174 void Shell::WorkerPostMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
1199 void Shell::WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
1217 void Shell::WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
1229 void Shell::QuitOnce(v8::FunctionCallbackInfo<v8::Value>* args) {
1240 void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
1242 const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args));
1246 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
1248 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion(),
1253 void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) {
1261 // Converts a V8 value to a C string.
1262 auto ToCString = [](const v8::String::Utf8Value& value) {
1266 v8::String::Utf8Value exception(try_catch->Exception());
1270 // V8 didn't provide any extra information about this error; just
1280 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName());
1287 v8::String::Utf8Value sourcelinevalue(sourceline);
1305 v8::String::Utf8Value stack_trace(Local<String>::Cast(stack_trace_string));
1343 void Shell::MapCounters(v8::Isolate* isolate, const char* name) {
1412 v8::Local<v8::Context> context =
1413 v8::Local<v8::Context>::New(isolate, evaluation_context_);
1436 v8::TryCatch try_catch(isolate);
1595 case v8::Isolate::kMessageWarning:
1596 case v8::Isolate::kMessageLog:
1597 case v8::Isolate::kMessageInfo:
1598 case v8::Isolate::kMessageDebug: {
1602 case v8::Isolate::kMessageError: {
1612 // Converts a V8 value to a C string.
1613 auto ToCString = [](const v8::String::Utf8Value& value) {
1617 v8::String::Utf8Value msg(message->Get());
1620 v8::String::Utf8Value filename(message->GetScriptOrigin().ResourceName());
1634 v8::Isolate::kMessageError | v8::Isolate::kMessageWarning |
1635 v8::Isolate::kMessageInfo | v8::Isolate::kMessageDebug |
1636 v8::Isolate::kMessageLog);
1681 void Shell::WriteIgnitionDispatchCountersFile(v8::Isolate* isolate) {
1696 void Shell::WriteLcovData(v8::Isolate* isolate, const char* file) {
1748 void Shell::OnExit(v8::Isolate* isolate) {
1868 const v8::WeakCallbackInfo<DataAndPersistent>& data) {
1879 void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
1898 Local<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data->data, length);
1901 v8::WeakCallbackType::kParameter);
1909 // Reads a file into a v8 string.
1924 v8::Local<v8::Context> context =
1925 v8::Local<v8::Context>::New(isolate, evaluation_context_);
1926 v8::Context::Scope context_scope(context);
1931 printf("V8 version %s\n", V8::GetVersion());
1965 DCHECK(length < v8::String::kMaxLength);
1968 ? v8::String::NewFromOneByte(
1971 v8::NewStringType::kNormal, length)
1972 : v8::String::NewFromTwoByte(
1975 v8::NewStringType::kNormal, length))
1978 v8::String::NewFromUtf8(isolate_, "receive", v8::NewStringType::kNormal)
1984 v8::TryCatch try_catch(isolate_);
1991 Local<String> key = v8::String::NewFromUtf8(isolate_, "message",
1992 v8::NewStringType::kNormal)
1995 v8::String::NewFromUtf8(isolate_,
1997 v8::NewStringType::kNormal)
2049 const v8::FunctionCallbackInfo<v8::Value>& args) {
2051 v8::HandleScope handle_scope(isolate);
2351 v8::TryCatch try_catch(isolate);
2377 void Worker::PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args) {
2401 v8::V8::SetFlagsFromString(flags, static_cast<int>(strlen(flags)));
2477 options.compile_options = v8::ScriptCompiler::kProduceCodeCache;
2479 options.compile_options = v8::ScriptCompiler::kProduceParserCache;
2481 options.compile_options = v8::ScriptCompiler::kNoCompileOptions;
2502 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
2587 while (v8::platform::PumpMessageLoop(g_platform, isolate)) continue;
2588 v8::platform::RunIdleTasks(g_platform, isolate,
2828 printf("# List of known V8 instance types.\n");
2836 printf("\n# List of known V8 maps.\n");
2858 printf("\n# List of known V8 objects.\n");
2881 v8::base::debug::EnableInProcessStackDumping();
2898 v8::V8::InitializeICUDefaultLocation(argv[0], options.icu_data_file);
2901 : v8::platform::CreateDefaultPlatform();
2917 v8::V8::InitializePlatform(g_platform);
2918 v8::V8::Initialize();
2920 v8::V8::InitializeExternalStartupData(options.natives_blob,
2923 v8::V8::InitializeExternalStartupData(argv[0]);
3023 V8::Dispose();
3024 V8::ShutdownPlatform();
3033 } // namespace v8
3038 return v8::Shell::Main(argc, argv);