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

Side by Side Diff: src/d8.cc

Issue 2840543002: [d8] implement console for d8. (Closed)
Patch Set: no stress Created 3 years, 8 months 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
« no previous file with comments | « BUILD.gn ('k') | src/d8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <fstream> 11 #include <fstream>
12 #include <unordered_map> 12 #include <unordered_map>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #ifdef ENABLE_VTUNE_JIT_INTERFACE 16 #ifdef ENABLE_VTUNE_JIT_INTERFACE
17 #include "src/third_party/vtune/v8-vtune.h" 17 #include "src/third_party/vtune/v8-vtune.h"
18 #endif 18 #endif
19 19
20 #include "src/d8-console.h"
20 #include "src/d8.h" 21 #include "src/d8.h"
21 #include "src/ostreams.h" 22 #include "src/ostreams.h"
22 23
23 #include "include/libplatform/libplatform.h" 24 #include "include/libplatform/libplatform.h"
24 #include "include/libplatform/v8-tracing.h" 25 #include "include/libplatform/v8-tracing.h"
25 #include "include/v8-inspector.h" 26 #include "include/v8-inspector.h"
26 #include "src/api.h" 27 #include "src/api.h"
27 #include "src/base/cpu.h" 28 #include "src/base/cpu.h"
28 #include "src/base/logging.h" 29 #include "src/base/logging.h"
29 #include "src/base/platform/platform.h" 30 #include "src/base/platform/platform.h"
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. 2255 // OS-specific padding for thread startup code. 2Mbytes seems to be enough.
2255 return base::Thread::Options("IsolateThread", 2 * MB); 2256 return base::Thread::Options("IsolateThread", 2 * MB);
2256 } 2257 }
2257 2258
2258 void SourceGroup::ExecuteInThread() { 2259 void SourceGroup::ExecuteInThread() {
2259 Isolate::CreateParams create_params; 2260 Isolate::CreateParams create_params;
2260 create_params.array_buffer_allocator = Shell::array_buffer_allocator; 2261 create_params.array_buffer_allocator = Shell::array_buffer_allocator;
2261 create_params.host_import_module_dynamically_callback_ = 2262 create_params.host_import_module_dynamically_callback_ =
2262 Shell::HostImportModuleDynamically; 2263 Shell::HostImportModuleDynamically;
2263 Isolate* isolate = Isolate::New(create_params); 2264 Isolate* isolate = Isolate::New(create_params);
2265 D8Console console(isolate);
2266 debug::SetConsoleDelegate(isolate, &console);
2264 for (int i = 0; i < Shell::options.stress_runs; ++i) { 2267 for (int i = 0; i < Shell::options.stress_runs; ++i) {
2265 next_semaphore_.Wait(); 2268 next_semaphore_.Wait();
2266 { 2269 {
2267 Isolate::Scope iscope(isolate); 2270 Isolate::Scope iscope(isolate);
2268 { 2271 {
2269 HandleScope scope(isolate); 2272 HandleScope scope(isolate);
2270 PerIsolateData data(isolate); 2273 PerIsolateData data(isolate);
2271 Local<Context> context = Shell::CreateEvaluationContext(isolate); 2274 Local<Context> context = Shell::CreateEvaluationContext(isolate);
2272 { 2275 {
2273 Context::Scope cscope(context); 2276 Context::Scope cscope(context);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 thread_->Join(); 2397 thread_->Join();
2395 } 2398 }
2396 2399
2397 2400
2398 void Worker::ExecuteInThread() { 2401 void Worker::ExecuteInThread() {
2399 Isolate::CreateParams create_params; 2402 Isolate::CreateParams create_params;
2400 create_params.array_buffer_allocator = Shell::array_buffer_allocator; 2403 create_params.array_buffer_allocator = Shell::array_buffer_allocator;
2401 create_params.host_import_module_dynamically_callback_ = 2404 create_params.host_import_module_dynamically_callback_ =
2402 Shell::HostImportModuleDynamically; 2405 Shell::HostImportModuleDynamically;
2403 Isolate* isolate = Isolate::New(create_params); 2406 Isolate* isolate = Isolate::New(create_params);
2407 D8Console console(isolate);
2408 debug::SetConsoleDelegate(isolate, &console);
2404 { 2409 {
2405 Isolate::Scope iscope(isolate); 2410 Isolate::Scope iscope(isolate);
2406 { 2411 {
2407 HandleScope scope(isolate); 2412 HandleScope scope(isolate);
2408 PerIsolateData data(isolate); 2413 PerIsolateData data(isolate);
2409 Local<Context> context = Shell::CreateEvaluationContext(isolate); 2414 Local<Context> context = Shell::CreateEvaluationContext(isolate);
2410 { 2415 {
2411 Context::Scope cscope(context); 2416 Context::Scope cscope(context);
2412 PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate)); 2417 PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate));
2413 2418
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 Shell::HostImportModuleDynamically; 3015 Shell::HostImportModuleDynamically;
3011 3016
3012 if (i::trap_handler::UseTrapHandler()) { 3017 if (i::trap_handler::UseTrapHandler()) {
3013 if (!v8::V8::RegisterDefaultSignalHandler()) { 3018 if (!v8::V8::RegisterDefaultSignalHandler()) {
3014 fprintf(stderr, "Could not register signal handler"); 3019 fprintf(stderr, "Could not register signal handler");
3015 exit(1); 3020 exit(1);
3016 } 3021 }
3017 } 3022 }
3018 3023
3019 Isolate* isolate = Isolate::New(create_params); 3024 Isolate* isolate = Isolate::New(create_params);
3025 D8Console console(isolate);
3020 { 3026 {
3021 Isolate::Scope scope(isolate); 3027 Isolate::Scope scope(isolate);
3022 Initialize(isolate); 3028 Initialize(isolate);
3023 PerIsolateData data(isolate); 3029 PerIsolateData data(isolate);
3030 debug::SetConsoleDelegate(isolate, &console);
3024 3031
3025 if (options.trace_enabled) { 3032 if (options.trace_enabled) {
3026 platform::tracing::TraceConfig* trace_config; 3033 platform::tracing::TraceConfig* trace_config;
3027 if (options.trace_config) { 3034 if (options.trace_config) {
3028 int size = 0; 3035 int size = 0;
3029 char* trace_config_json_str = ReadChars(options.trace_config, &size); 3036 char* trace_config_json_str = ReadChars(options.trace_config, &size);
3030 trace_config = 3037 trace_config =
3031 tracing::CreateTraceConfigFromJSON(isolate, trace_config_json_str); 3038 tracing::CreateTraceConfigFromJSON(isolate, trace_config_json_str);
3032 delete[] trace_config_json_str; 3039 delete[] trace_config_json_str;
3033 } else { 3040 } else {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 } 3099 }
3093 3100
3094 } // namespace v8 3101 } // namespace v8
3095 3102
3096 3103
3097 #ifndef GOOGLE3 3104 #ifndef GOOGLE3
3098 int main(int argc, char* argv[]) { 3105 int main(int argc, char* argv[]) {
3099 return v8::Shell::Main(argc, argv); 3106 return v8::Shell::Main(argc, argv);
3100 } 3107 }
3101 #endif 3108 #endif
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/d8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698