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

Side by Side Diff: src/d8.cc

Issue 1243213004: Remove d8's interactive Javascript debugger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix shared library build. Created 5 years, 5 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 | « src/d8.h ('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 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 26 matching lines...) Expand all
37 #include "src/d8.h" 37 #include "src/d8.h"
38 38
39 #include "include/libplatform/libplatform.h" 39 #include "include/libplatform/libplatform.h"
40 #ifndef V8_SHARED 40 #ifndef V8_SHARED
41 #include "src/api.h" 41 #include "src/api.h"
42 #include "src/base/cpu.h" 42 #include "src/base/cpu.h"
43 #include "src/base/logging.h" 43 #include "src/base/logging.h"
44 #include "src/base/platform/platform.h" 44 #include "src/base/platform/platform.h"
45 #include "src/base/sys-info.h" 45 #include "src/base/sys-info.h"
46 #include "src/basic-block-profiler.h" 46 #include "src/basic-block-profiler.h"
47 #include "src/d8-debug.h"
48 #include "src/debug.h"
49 #include "src/snapshot/natives.h" 47 #include "src/snapshot/natives.h"
50 #include "src/utils.h" 48 #include "src/utils.h"
51 #include "src/v8.h" 49 #include "src/v8.h"
52 #endif // !V8_SHARED 50 #endif // !V8_SHARED
53 51
54 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 52 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
55 #include "src/startup-data-util.h" 53 #include "src/startup-data-util.h"
56 #endif // V8_USE_EXTERNAL_STARTUP_DATA 54 #endif // V8_USE_EXTERNAL_STARTUP_DATA
57 55
58 #if !defined(_WIN32) && !defined(_WIN64) 56 #if !defined(_WIN32) && !defined(_WIN64)
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 compile_options); 319 compile_options);
322 CHECK(data == NULL || !data->rejected); 320 CHECK(data == NULL || !data->rejected);
323 return result; 321 return result;
324 } 322 }
325 323
326 324
327 // Executes a string within the current v8 context. 325 // Executes a string within the current v8 context.
328 bool Shell::ExecuteString(Isolate* isolate, Local<String> source, 326 bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
329 Local<Value> name, bool print_result, 327 Local<Value> name, bool print_result,
330 bool report_exceptions, SourceType source_type) { 328 bool report_exceptions, SourceType source_type) {
331 #ifndef V8_SHARED
332 bool FLAG_debugger = i::FLAG_debugger;
333 #else
334 bool FLAG_debugger = false;
335 #endif // !V8_SHARED
336 HandleScope handle_scope(isolate); 329 HandleScope handle_scope(isolate);
337 TryCatch try_catch(isolate); 330 TryCatch try_catch(isolate);
338 options.script_executed = true; 331 options.script_executed = true;
339 if (FLAG_debugger) {
340 // When debugging make exceptions appear to be uncaught.
341 try_catch.SetVerbose(true);
342 }
343 332
344 MaybeLocal<Value> maybe_result; 333 MaybeLocal<Value> maybe_result;
345 { 334 {
346 PerIsolateData* data = PerIsolateData::Get(isolate); 335 PerIsolateData* data = PerIsolateData::Get(isolate);
347 Local<Context> realm = 336 Local<Context> realm =
348 Local<Context>::New(isolate, data->realms_[data->realm_current_]); 337 Local<Context>::New(isolate, data->realms_[data->realm_current_]);
349 Context::Scope context_scope(realm); 338 Context::Scope context_scope(realm);
350 Local<Script> script; 339 Local<Script> script;
351 if (!Shell::CompileString(isolate, source, name, options.compile_options, 340 if (!Shell::CompileString(isolate, source, name, options.compile_options,
352 source_type).ToLocal(&script)) { 341 source_type).ToLocal(&script)) {
353 // Print errors that happened during compilation. 342 // Print errors that happened during compilation.
354 if (report_exceptions && !FLAG_debugger) 343 if (report_exceptions) ReportException(isolate, &try_catch);
355 ReportException(isolate, &try_catch);
356 return false; 344 return false;
357 } 345 }
358 maybe_result = script->Run(realm); 346 maybe_result = script->Run(realm);
359 EmptyMessageQueues(isolate); 347 EmptyMessageQueues(isolate);
360 data->realm_current_ = data->realm_switch_; 348 data->realm_current_ = data->realm_switch_;
361 } 349 }
362 Local<Value> result; 350 Local<Value> result;
363 if (!maybe_result.ToLocal(&result)) { 351 if (!maybe_result.ToLocal(&result)) {
364 DCHECK(try_catch.HasCaught()); 352 DCHECK(try_catch.HasCaught());
365 // Print errors that happened during execution. 353 // Print errors that happened during execution.
366 if (report_exceptions && !FLAG_debugger) 354 if (report_exceptions) ReportException(isolate, &try_catch);
367 ReportException(isolate, &try_catch);
368 return false; 355 return false;
369 } 356 }
370 DCHECK(!try_catch.HasCaught()); 357 DCHECK(!try_catch.HasCaught());
371 if (print_result) { 358 if (print_result) {
372 #if !defined(V8_SHARED) 359 #if !defined(V8_SHARED)
373 if (options.test_shell) { 360 if (options.test_shell) {
374 #endif 361 #endif
375 if (!result->IsUndefined()) { 362 if (!result->IsUndefined()) {
376 // If all went well and the result wasn't undefined then print 363 // If all went well and the result wasn't undefined then print
377 // the returned value. 364 // the returned value.
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 v8::Local<v8::Context> evaluation_context = 934 v8::Local<v8::Context> evaluation_context =
948 v8::Local<v8::Context>::New(isolate, evaluation_context_); 935 v8::Local<v8::Context>::New(isolate, evaluation_context_);
949 Local<Value> argv[kArgc] = {evaluation_context->Global(), text, full}; 936 Local<Value> argv[kArgc] = {evaluation_context->Global(), text, full};
950 Local<Value> val = Local<Function>::Cast(fun) 937 Local<Value> val = Local<Function>::Cast(fun)
951 ->Call(utility_context, global, kArgc, argv) 938 ->Call(utility_context, global, kArgc, argv)
952 .ToLocalChecked(); 939 .ToLocalChecked();
953 return handle_scope.Escape(Local<Array>::Cast(val)); 940 return handle_scope.Escape(Local<Array>::Cast(val));
954 } 941 }
955 942
956 943
957 Local<Object> Shell::DebugMessageDetails(Isolate* isolate,
958 Local<String> message) {
959 EscapableHandleScope handle_scope(isolate);
960 v8::Local<v8::Context> context =
961 v8::Local<v8::Context>::New(isolate, utility_context_);
962 v8::Context::Scope context_scope(context);
963 Local<Object> global = context->Global();
964 Local<Value> fun =
965 global->Get(context, String::NewFromUtf8(isolate, "DebugMessageDetails",
966 NewStringType::kNormal)
967 .ToLocalChecked()).ToLocalChecked();
968 static const int kArgc = 1;
969 Local<Value> argv[kArgc] = {message};
970 Local<Value> val = Local<Function>::Cast(fun)
971 ->Call(context, global, kArgc, argv)
972 .ToLocalChecked();
973 return handle_scope.Escape(Local<Object>(Local<Object>::Cast(val)));
974 }
975
976
977 Local<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate,
978 Local<String> command) {
979 EscapableHandleScope handle_scope(isolate);
980 v8::Local<v8::Context> context =
981 v8::Local<v8::Context>::New(isolate, utility_context_);
982 v8::Context::Scope context_scope(context);
983 Local<Object> global = context->Global();
984 Local<Value> fun =
985 global->Get(context,
986 String::NewFromUtf8(isolate, "DebugCommandToJSONRequest",
987 NewStringType::kNormal).ToLocalChecked())
988 .ToLocalChecked();
989 static const int kArgc = 1;
990 Local<Value> argv[kArgc] = {command};
991 Local<Value> val = Local<Function>::Cast(fun)
992 ->Call(context, global, kArgc, argv)
993 .ToLocalChecked();
994 return handle_scope.Escape(Local<Value>(val));
995 }
996
997
998 int32_t* Counter::Bind(const char* name, bool is_histogram) { 944 int32_t* Counter::Bind(const char* name, bool is_histogram) {
999 int i; 945 int i;
1000 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) 946 for (i = 0; i < kMaxNameSize - 1 && name[i]; i++)
1001 name_[i] = static_cast<char>(name[i]); 947 name_[i] = static_cast<char>(name[i]);
1002 name_[i] = '\0'; 948 name_[i] = '\0';
1003 is_histogram_ = is_histogram; 949 is_histogram_ = is_histogram;
1004 return ptr(); 950 return ptr();
1005 } 951 }
1006 952
1007 953
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 private: 1049 private:
1104 bool flag_; 1050 bool flag_;
1105 }; 1051 };
1106 1052
1107 1053
1108 void Shell::InstallUtilityScript(Isolate* isolate) { 1054 void Shell::InstallUtilityScript(Isolate* isolate) {
1109 NoUseStrongForUtilityScriptScope no_use_strong; 1055 NoUseStrongForUtilityScriptScope no_use_strong;
1110 HandleScope scope(isolate); 1056 HandleScope scope(isolate);
1111 // If we use the utility context, we have to set the security tokens so that 1057 // If we use the utility context, we have to set the security tokens so that
1112 // utility, evaluation and debug context can all access each other. 1058 // utility, evaluation and debug context can all access each other.
1059 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
1060 utility_context_.Reset(isolate, Context::New(isolate, NULL, global_template));
1113 v8::Local<v8::Context> utility_context = 1061 v8::Local<v8::Context> utility_context =
1114 v8::Local<v8::Context>::New(isolate, utility_context_); 1062 v8::Local<v8::Context>::New(isolate, utility_context_);
1115 v8::Local<v8::Context> evaluation_context = 1063 v8::Local<v8::Context> evaluation_context =
1116 v8::Local<v8::Context>::New(isolate, evaluation_context_); 1064 v8::Local<v8::Context>::New(isolate, evaluation_context_);
1117 utility_context->SetSecurityToken(Undefined(isolate)); 1065 utility_context->SetSecurityToken(Undefined(isolate));
1118 evaluation_context->SetSecurityToken(Undefined(isolate)); 1066 evaluation_context->SetSecurityToken(Undefined(isolate));
1119 v8::Context::Scope context_scope(utility_context); 1067 v8::Context::Scope context_scope(utility_context);
1120 1068
1121 if (i::FLAG_debugger) printf("JavaScript debugger enabled\n");
1122 // Install the debugger object in the utility scope
1123 i::Debug* debug = reinterpret_cast<i::Isolate*>(isolate)->debug();
1124 debug->Load();
1125 i::Handle<i::Context> debug_context = debug->debug_context();
1126 i::Handle<i::JSObject> js_debug
1127 = i::Handle<i::JSObject>(debug_context->global_object());
1128 utility_context->Global()
1129 ->Set(utility_context,
1130 String::NewFromUtf8(isolate, "$debug", NewStringType::kNormal)
1131 .ToLocalChecked(),
1132 Utils::ToLocal(js_debug))
1133 .FromJust();
1134 debug_context->set_security_token(
1135 reinterpret_cast<i::Isolate*>(isolate)->heap()->undefined_value());
1136
1137 // Run the d8 shell utility script in the utility context 1069 // Run the d8 shell utility script in the utility context
1138 int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); 1070 int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
1139 i::Vector<const char> shell_source = 1071 i::Vector<const char> shell_source =
1140 i::NativesCollection<i::D8>::GetScriptSource(source_index); 1072 i::NativesCollection<i::D8>::GetScriptSource(source_index);
1141 i::Vector<const char> shell_source_name = 1073 i::Vector<const char> shell_source_name =
1142 i::NativesCollection<i::D8>::GetScriptName(source_index); 1074 i::NativesCollection<i::D8>::GetScriptName(source_index);
1143 Local<String> source = 1075 Local<String> source =
1144 String::NewFromUtf8(isolate, shell_source.start(), NewStringType::kNormal, 1076 String::NewFromUtf8(isolate, shell_source.start(), NewStringType::kNormal,
1145 shell_source.length()).ToLocalChecked(); 1077 shell_source.length()).ToLocalChecked();
1146 Local<String> name = 1078 Local<String> name =
1147 String::NewFromUtf8(isolate, shell_source_name.start(), 1079 String::NewFromUtf8(isolate, shell_source_name.start(),
1148 NewStringType::kNormal, 1080 NewStringType::kNormal,
1149 shell_source_name.length()).ToLocalChecked(); 1081 shell_source_name.length()).ToLocalChecked();
1150 ScriptOrigin origin(name); 1082 ScriptOrigin origin(name);
1151 Local<Script> script = 1083 Local<Script> script =
1152 Script::Compile(utility_context, source, &origin).ToLocalChecked(); 1084 Script::Compile(utility_context, source, &origin).ToLocalChecked();
1153 script->Run(utility_context).ToLocalChecked(); 1085 script->Run(utility_context).ToLocalChecked();
1154 // Mark the d8 shell script as native to avoid it showing up as normal source 1086 // Mark the d8 shell script as native to avoid it showing up as normal source
1155 // in the debugger. 1087 // in the debugger.
1156 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); 1088 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script);
1157 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() 1089 i::Handle<i::Script> script_object = compiled_script->IsJSFunction()
1158 ? i::Handle<i::Script>(i::Script::cast( 1090 ? i::Handle<i::Script>(i::Script::cast(
1159 i::JSFunction::cast(*compiled_script)->shared()->script())) 1091 i::JSFunction::cast(*compiled_script)->shared()->script()))
1160 : i::Handle<i::Script>(i::Script::cast( 1092 : i::Handle<i::Script>(i::Script::cast(
1161 i::SharedFunctionInfo::cast(*compiled_script)->script())); 1093 i::SharedFunctionInfo::cast(*compiled_script)->script()));
1162 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); 1094 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE));
1163
1164 // Start the in-process debugger if requested.
1165 if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent);
1166 } 1095 }
1167 #endif // !V8_SHARED 1096 #endif // !V8_SHARED
1168 1097
1169 1098
1170 Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { 1099 Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
1171 Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); 1100 Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate);
1172 global_template->Set( 1101 global_template->Set(
1173 String::NewFromUtf8(isolate, "print", NewStringType::kNormal) 1102 String::NewFromUtf8(isolate, "print", NewStringType::kNormal)
1174 .ToLocalChecked(), 1103 .ToLocalChecked(),
1175 FunctionTemplate::New(isolate, Print)); 1104 FunctionTemplate::New(isolate, Print));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 1220
1292 void Shell::Initialize(Isolate* isolate) { 1221 void Shell::Initialize(Isolate* isolate) {
1293 #ifndef V8_SHARED 1222 #ifndef V8_SHARED
1294 // Set up counters 1223 // Set up counters
1295 if (i::StrLength(i::FLAG_map_counters) != 0) 1224 if (i::StrLength(i::FLAG_map_counters) != 0)
1296 MapCounters(isolate, i::FLAG_map_counters); 1225 MapCounters(isolate, i::FLAG_map_counters);
1297 #endif // !V8_SHARED 1226 #endif // !V8_SHARED
1298 } 1227 }
1299 1228
1300 1229
1301 void Shell::InitializeDebugger(Isolate* isolate) {
1302 if (options.test_shell) return;
1303 #ifndef V8_SHARED
1304 HandleScope scope(isolate);
1305 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
1306 utility_context_.Reset(isolate,
1307 Context::New(isolate, NULL, global_template));
1308 if (utility_context_.IsEmpty()) {
1309 printf("Failed to initialize debugger\n");
1310 Shell::Exit(1);
1311 }
1312 #endif // !V8_SHARED
1313 }
1314
1315
1316 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { 1230 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
1317 #ifndef V8_SHARED 1231 #ifndef V8_SHARED
1318 // This needs to be a critical section since this is not thread-safe 1232 // This needs to be a critical section since this is not thread-safe
1319 base::LockGuard<base::Mutex> lock_guard(context_mutex_.Pointer()); 1233 base::LockGuard<base::Mutex> lock_guard(context_mutex_.Pointer());
1320 #endif // !V8_SHARED 1234 #endif // !V8_SHARED
1321 // Initialize the global objects 1235 // Initialize the global objects
1322 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); 1236 Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
1323 EscapableHandleScope handle_scope(isolate); 1237 EscapableHandleScope handle_scope(isolate);
1324 Local<Context> context = Context::New(isolate, NULL, global_template); 1238 Local<Context> context = Context::New(isolate, NULL, global_template);
1325 DCHECK(!context.IsEmpty()); 1239 DCHECK(!context.IsEmpty());
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 } else if (strcmp(argv[i], "--throws") == 0) { 1934 } else if (strcmp(argv[i], "--throws") == 0) {
2021 options.expected_to_throw = true; 1935 options.expected_to_throw = true;
2022 argv[i] = NULL; 1936 argv[i] = NULL;
2023 } else if (strncmp(argv[i], "--icu-data-file=", 16) == 0) { 1937 } else if (strncmp(argv[i], "--icu-data-file=", 16) == 0) {
2024 options.icu_data_file = argv[i] + 16; 1938 options.icu_data_file = argv[i] + 16;
2025 argv[i] = NULL; 1939 argv[i] = NULL;
2026 #ifdef V8_SHARED 1940 #ifdef V8_SHARED
2027 } else if (strcmp(argv[i], "--dump-counters") == 0) { 1941 } else if (strcmp(argv[i], "--dump-counters") == 0) {
2028 printf("D8 with shared library does not include counters\n"); 1942 printf("D8 with shared library does not include counters\n");
2029 return false; 1943 return false;
2030 } else if (strcmp(argv[i], "--debugger") == 0) {
2031 printf("Javascript debugger not included\n");
2032 return false;
2033 #endif // V8_SHARED 1944 #endif // V8_SHARED
2034 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 1945 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
2035 } else if (strncmp(argv[i], "--natives_blob=", 15) == 0) { 1946 } else if (strncmp(argv[i], "--natives_blob=", 15) == 0) {
2036 options.natives_blob = argv[i] + 15; 1947 options.natives_blob = argv[i] + 15;
2037 argv[i] = NULL; 1948 argv[i] = NULL;
2038 } else if (strncmp(argv[i], "--snapshot_blob=", 16) == 0) { 1949 } else if (strncmp(argv[i], "--snapshot_blob=", 16) == 0) {
2039 options.snapshot_blob = argv[i] + 16; 1950 options.snapshot_blob = argv[i] + 16;
2040 argv[i] = NULL; 1951 argv[i] = NULL;
2041 #endif // V8_USE_EXTERNAL_STARTUP_DATA 1952 #endif // V8_USE_EXTERNAL_STARTUP_DATA
2042 } else if (strcmp(argv[i], "--cache") == 0 || 1953 } else if (strcmp(argv[i], "--cache") == 0 ||
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 for (int i = 1; i < options.num_isolates; ++i) { 2007 for (int i = 1; i < options.num_isolates; ++i) {
2097 options.isolate_sources[i].StartExecuteInThread(); 2008 options.isolate_sources[i].StartExecuteInThread();
2098 } 2009 }
2099 #endif // !V8_SHARED 2010 #endif // !V8_SHARED
2100 { 2011 {
2101 HandleScope scope(isolate); 2012 HandleScope scope(isolate);
2102 Local<Context> context = CreateEvaluationContext(isolate); 2013 Local<Context> context = CreateEvaluationContext(isolate);
2103 if (options.last_run && options.use_interactive_shell()) { 2014 if (options.last_run && options.use_interactive_shell()) {
2104 // Keep using the same context in the interactive shell. 2015 // Keep using the same context in the interactive shell.
2105 evaluation_context_.Reset(isolate, context); 2016 evaluation_context_.Reset(isolate, context);
2106 #ifndef V8_SHARED
2107 // If the interactive debugger is enabled make sure to activate
2108 // it before running the files passed on the command line.
2109 if (i::FLAG_debugger) {
2110 InstallUtilityScript(isolate);
2111 }
2112 #endif // !V8_SHARED
2113 } 2017 }
2114 { 2018 {
2115 Context::Scope cscope(context); 2019 Context::Scope cscope(context);
2116 PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate)); 2020 PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate));
2117 options.isolate_sources[0].Execute(isolate); 2021 options.isolate_sources[0].Execute(isolate);
2118 } 2022 }
2119 } 2023 }
2120 CollectGarbage(isolate); 2024 CollectGarbage(isolate);
2121 #ifndef V8_SHARED 2025 #ifndef V8_SHARED
2122 for (int i = 1; i < options.num_isolates; ++i) { 2026 for (int i = 1; i < options.num_isolates; ++i) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 create_params.create_histogram_callback = CreateHistogram; 2432 create_params.create_histogram_callback = CreateHistogram;
2529 create_params.add_histogram_sample_callback = AddHistogramSample; 2433 create_params.add_histogram_sample_callback = AddHistogramSample;
2530 } 2434 }
2531 #endif 2435 #endif
2532 Isolate* isolate = Isolate::New(create_params); 2436 Isolate* isolate = Isolate::New(create_params);
2533 DumbLineEditor dumb_line_editor(isolate); 2437 DumbLineEditor dumb_line_editor(isolate);
2534 { 2438 {
2535 Isolate::Scope scope(isolate); 2439 Isolate::Scope scope(isolate);
2536 Initialize(isolate); 2440 Initialize(isolate);
2537 PerIsolateData data(isolate); 2441 PerIsolateData data(isolate);
2538 InitializeDebugger(isolate);
2539 2442
2540 #ifndef V8_SHARED 2443 #ifndef V8_SHARED
2541 if (options.dump_heap_constants) { 2444 if (options.dump_heap_constants) {
2542 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); 2445 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate));
2543 return 0; 2446 return 0;
2544 } 2447 }
2545 #endif 2448 #endif
2546 2449
2547 if (options.stress_opt || options.stress_deopt) { 2450 if (options.stress_opt || options.stress_deopt) {
2548 Testing::SetStressRunType(options.stress_opt 2451 Testing::SetStressRunType(options.stress_opt
(...skipping 18 matching lines...) Expand all
2567 } 2470 }
2568 #endif 2471 #endif
2569 } else { 2472 } else {
2570 result = RunMain(isolate, argc, argv); 2473 result = RunMain(isolate, argc, argv);
2571 } 2474 }
2572 2475
2573 // Run interactive shell if explicitly requested or if no script has been 2476 // Run interactive shell if explicitly requested or if no script has been
2574 // executed, but never on --test 2477 // executed, but never on --test
2575 if (options.use_interactive_shell()) { 2478 if (options.use_interactive_shell()) {
2576 #ifndef V8_SHARED 2479 #ifndef V8_SHARED
2577 if (!i::FLAG_debugger) { 2480 InstallUtilityScript(isolate);
2578 InstallUtilityScript(isolate);
2579 }
2580 #endif // !V8_SHARED 2481 #endif // !V8_SHARED
2581 RunShell(isolate); 2482 RunShell(isolate);
2582 } 2483 }
2583 2484
2584 // Shut down contexts and collect garbage. 2485 // Shut down contexts and collect garbage.
2585 evaluation_context_.Reset(); 2486 evaluation_context_.Reset();
2586 #ifndef V8_SHARED 2487 #ifndef V8_SHARED
2587 utility_context_.Reset(); 2488 utility_context_.Reset();
2588 #endif // !V8_SHARED 2489 #endif // !V8_SHARED
2589 CollectGarbage(isolate); 2490 CollectGarbage(isolate);
(...skipping 16 matching lines...) Expand all
2606 } 2507 }
2607 2508
2608 } // namespace v8 2509 } // namespace v8
2609 2510
2610 2511
2611 #ifndef GOOGLE3 2512 #ifndef GOOGLE3
2612 int main(int argc, char* argv[]) { 2513 int main(int argc, char* argv[]) {
2613 return v8::Shell::Main(argc, argv); 2514 return v8::Shell::Main(argc, argv);
2614 } 2515 }
2615 #endif 2516 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698