OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 int name_length = 0; | 474 int name_length = 0; |
475 uint16_t* name_buffer = NULL; | 475 uint16_t* name_buffer = NULL; |
476 if (name->IsString()) { | 476 if (name->IsString()) { |
477 Local<String> name_string = Local<String>::Cast(name); | 477 Local<String> name_string = Local<String>::Cast(name); |
478 name_length = name_string->Length(); | 478 name_length = name_string->Length(); |
479 name_buffer = new uint16_t[name_length]; | 479 name_buffer = new uint16_t[name_length]; |
480 name_string->Write(name_buffer, 0, name_length); | 480 name_string->Write(name_buffer, 0, name_length); |
481 } | 481 } |
482 Isolate::CreateParams create_params; | 482 Isolate::CreateParams create_params; |
483 create_params.array_buffer_allocator = Shell::array_buffer_allocator; | 483 create_params.array_buffer_allocator = Shell::array_buffer_allocator; |
484 create_params.host_import_module_dynamically_callback_ = | |
485 Shell::HostImportModuleDynamically; | |
486 Isolate* temp_isolate = Isolate::New(create_params); | 484 Isolate* temp_isolate = Isolate::New(create_params); |
485 temp_isolate->SetHostImportModuleDynamicallyCallback( | |
486 Shell::HostImportModuleDynamically); | |
487 ScriptCompiler::CachedData* result = NULL; | 487 ScriptCompiler::CachedData* result = NULL; |
488 { | 488 { |
489 Isolate::Scope isolate_scope(temp_isolate); | 489 Isolate::Scope isolate_scope(temp_isolate); |
490 HandleScope handle_scope(temp_isolate); | 490 HandleScope handle_scope(temp_isolate); |
491 Context::Scope context_scope(Context::New(temp_isolate)); | 491 Context::Scope context_scope(Context::New(temp_isolate)); |
492 Local<String> source_copy = | 492 Local<String> source_copy = |
493 v8::String::NewFromTwoByte(temp_isolate, source_buffer, | 493 v8::String::NewFromTwoByte(temp_isolate, source_buffer, |
494 v8::NewStringType::kNormal, source_length) | 494 v8::NewStringType::kNormal, source_length) |
495 .ToLocalChecked(); | 495 .ToLocalChecked(); |
496 Local<Value> name_copy; | 496 Local<Value> name_copy; |
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2306 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less | 2306 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less |
2307 // which is not enough to parse the big literal expressions used in tests. | 2307 // which is not enough to parse the big literal expressions used in tests. |
2308 // The stack size should be at least StackGuard::kLimitSize + some | 2308 // The stack size should be at least StackGuard::kLimitSize + some |
2309 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. | 2309 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. |
2310 return base::Thread::Options("IsolateThread", 2 * MB); | 2310 return base::Thread::Options("IsolateThread", 2 * MB); |
2311 } | 2311 } |
2312 | 2312 |
2313 void SourceGroup::ExecuteInThread() { | 2313 void SourceGroup::ExecuteInThread() { |
2314 Isolate::CreateParams create_params; | 2314 Isolate::CreateParams create_params; |
2315 create_params.array_buffer_allocator = Shell::array_buffer_allocator; | 2315 create_params.array_buffer_allocator = Shell::array_buffer_allocator; |
2316 create_params.host_import_module_dynamically_callback_ = | |
2317 Shell::HostImportModuleDynamically; | |
2318 Isolate* isolate = Isolate::New(create_params); | 2316 Isolate* isolate = Isolate::New(create_params); |
2317 isolate->SetHostImportModuleDynamicallyCallback( | |
2318 Shell::HostImportModuleDynamically); | |
2319 | 2319 |
2320 Shell::EnsureEventLoopInitialized(isolate); | 2320 Shell::EnsureEventLoopInitialized(isolate); |
2321 D8Console console(isolate); | 2321 D8Console console(isolate); |
2322 debug::SetConsoleDelegate(isolate, &console); | 2322 debug::SetConsoleDelegate(isolate, &console); |
2323 for (int i = 0; i < Shell::options.stress_runs; ++i) { | 2323 for (int i = 0; i < Shell::options.stress_runs; ++i) { |
2324 next_semaphore_.Wait(); | 2324 next_semaphore_.Wait(); |
2325 { | 2325 { |
2326 Isolate::Scope iscope(isolate); | 2326 Isolate::Scope iscope(isolate); |
2327 { | 2327 { |
2328 HandleScope scope(isolate); | 2328 HandleScope scope(isolate); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2451 | 2451 |
2452 void Worker::WaitForThread() { | 2452 void Worker::WaitForThread() { |
2453 Terminate(); | 2453 Terminate(); |
2454 thread_->Join(); | 2454 thread_->Join(); |
2455 } | 2455 } |
2456 | 2456 |
2457 | 2457 |
2458 void Worker::ExecuteInThread() { | 2458 void Worker::ExecuteInThread() { |
2459 Isolate::CreateParams create_params; | 2459 Isolate::CreateParams create_params; |
2460 create_params.array_buffer_allocator = Shell::array_buffer_allocator; | 2460 create_params.array_buffer_allocator = Shell::array_buffer_allocator; |
2461 create_params.host_import_module_dynamically_callback_ = | |
2462 Shell::HostImportModuleDynamically; | |
2463 Isolate* isolate = Isolate::New(create_params); | 2461 Isolate* isolate = Isolate::New(create_params); |
2462 isolate->SetHostImportModuleDynamicallyCallback( | |
2463 Shell::HostImportModuleDynamically); | |
2464 D8Console console(isolate); | 2464 D8Console console(isolate); |
2465 debug::SetConsoleDelegate(isolate, &console); | 2465 debug::SetConsoleDelegate(isolate, &console); |
2466 { | 2466 { |
2467 Isolate::Scope iscope(isolate); | 2467 Isolate::Scope iscope(isolate); |
2468 { | 2468 { |
2469 HandleScope scope(isolate); | 2469 HandleScope scope(isolate); |
2470 PerIsolateData data(isolate); | 2470 PerIsolateData data(isolate); |
2471 Local<Context> context = Shell::CreateEvaluationContext(isolate); | 2471 Local<Context> context = Shell::CreateEvaluationContext(isolate); |
2472 { | 2472 { |
2473 Context::Scope cscope(context); | 2473 Context::Scope cscope(context); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3100 base::SysInfo::AmountOfPhysicalMemory(), | 3100 base::SysInfo::AmountOfPhysicalMemory(), |
3101 base::SysInfo::AmountOfVirtualMemory()); | 3101 base::SysInfo::AmountOfVirtualMemory()); |
3102 | 3102 |
3103 Shell::counter_map_ = new CounterMap(); | 3103 Shell::counter_map_ = new CounterMap(); |
3104 if (i::FLAG_dump_counters || i::FLAG_dump_counters_nvp || i::FLAG_gc_stats) { | 3104 if (i::FLAG_dump_counters || i::FLAG_dump_counters_nvp || i::FLAG_gc_stats) { |
3105 create_params.counter_lookup_callback = LookupCounter; | 3105 create_params.counter_lookup_callback = LookupCounter; |
3106 create_params.create_histogram_callback = CreateHistogram; | 3106 create_params.create_histogram_callback = CreateHistogram; |
3107 create_params.add_histogram_sample_callback = AddHistogramSample; | 3107 create_params.add_histogram_sample_callback = AddHistogramSample; |
3108 } | 3108 } |
3109 | 3109 |
3110 create_params.host_import_module_dynamically_callback_ = | |
3111 Shell::HostImportModuleDynamically; | |
3112 | |
3113 if (i::trap_handler::UseTrapHandler()) { | 3110 if (i::trap_handler::UseTrapHandler()) { |
3114 if (!v8::V8::RegisterDefaultSignalHandler()) { | 3111 if (!v8::V8::RegisterDefaultSignalHandler()) { |
3115 fprintf(stderr, "Could not register signal handler"); | 3112 fprintf(stderr, "Could not register signal handler"); |
3116 exit(1); | 3113 exit(1); |
3117 } | 3114 } |
3118 } | 3115 } |
3119 | 3116 |
3120 Isolate* isolate = Isolate::New(create_params); | 3117 Isolate* isolate = Isolate::New(create_params); |
3118 isolate->SetHostImportModuleDynamicallyCallback( | |
3119 Shell::HostImportModuleDynamically); | |
3121 | 3120 |
jkrems
2017/05/26 15:55:31
This new-line is the only change from before - it
| |
3122 D8Console console(isolate); | 3121 D8Console console(isolate); |
3123 { | 3122 { |
3124 Isolate::Scope scope(isolate); | 3123 Isolate::Scope scope(isolate); |
3125 Initialize(isolate); | 3124 Initialize(isolate); |
3126 PerIsolateData data(isolate); | 3125 PerIsolateData data(isolate); |
3127 debug::SetConsoleDelegate(isolate, &console); | 3126 debug::SetConsoleDelegate(isolate, &console); |
3128 | 3127 |
3129 if (options.trace_enabled) { | 3128 if (options.trace_enabled) { |
3130 platform::tracing::TraceConfig* trace_config; | 3129 platform::tracing::TraceConfig* trace_config; |
3131 if (options.trace_config) { | 3130 if (options.trace_config) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3193 } | 3192 } |
3194 | 3193 |
3195 } // namespace v8 | 3194 } // namespace v8 |
3196 | 3195 |
3197 | 3196 |
3198 #ifndef GOOGLE3 | 3197 #ifndef GOOGLE3 |
3199 int main(int argc, char* argv[]) { | 3198 int main(int argc, char* argv[]) { |
3200 return v8::Shell::Main(argc, argv); | 3199 return v8::Shell::Main(argc, argv); |
3201 } | 3200 } |
3202 #endif | 3201 #endif |
OLD | NEW |