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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | src/d8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index a56d029f5a5fb2fedb3fb568578ca9b90f53bada..66ea3a15f7cbb249d70223771d52a0d336c856f4 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -44,8 +44,6 @@
#include "src/base/platform/platform.h"
#include "src/base/sys-info.h"
#include "src/basic-block-profiler.h"
-#include "src/d8-debug.h"
-#include "src/debug.h"
#include "src/snapshot/natives.h"
#include "src/utils.h"
#include "src/v8.h"
@@ -328,18 +326,9 @@ MaybeLocal<Script> Shell::CompileString(
bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
Local<Value> name, bool print_result,
bool report_exceptions, SourceType source_type) {
-#ifndef V8_SHARED
- bool FLAG_debugger = i::FLAG_debugger;
-#else
- bool FLAG_debugger = false;
-#endif // !V8_SHARED
HandleScope handle_scope(isolate);
TryCatch try_catch(isolate);
options.script_executed = true;
- if (FLAG_debugger) {
- // When debugging make exceptions appear to be uncaught.
- try_catch.SetVerbose(true);
- }
MaybeLocal<Value> maybe_result;
{
@@ -351,8 +340,7 @@ bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
if (!Shell::CompileString(isolate, source, name, options.compile_options,
source_type).ToLocal(&script)) {
// Print errors that happened during compilation.
- if (report_exceptions && !FLAG_debugger)
- ReportException(isolate, &try_catch);
+ if (report_exceptions) ReportException(isolate, &try_catch);
return false;
}
maybe_result = script->Run(realm);
@@ -363,8 +351,7 @@ bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
if (!maybe_result.ToLocal(&result)) {
DCHECK(try_catch.HasCaught());
// Print errors that happened during execution.
- if (report_exceptions && !FLAG_debugger)
- ReportException(isolate, &try_catch);
+ if (report_exceptions) ReportException(isolate, &try_catch);
return false;
}
DCHECK(!try_catch.HasCaught());
@@ -954,47 +941,6 @@ Local<Array> Shell::GetCompletions(Isolate* isolate, Local<String> text,
}
-Local<Object> Shell::DebugMessageDetails(Isolate* isolate,
- Local<String> message) {
- EscapableHandleScope handle_scope(isolate);
- v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate, utility_context_);
- v8::Context::Scope context_scope(context);
- Local<Object> global = context->Global();
- Local<Value> fun =
- global->Get(context, String::NewFromUtf8(isolate, "DebugMessageDetails",
- NewStringType::kNormal)
- .ToLocalChecked()).ToLocalChecked();
- static const int kArgc = 1;
- Local<Value> argv[kArgc] = {message};
- Local<Value> val = Local<Function>::Cast(fun)
- ->Call(context, global, kArgc, argv)
- .ToLocalChecked();
- return handle_scope.Escape(Local<Object>(Local<Object>::Cast(val)));
-}
-
-
-Local<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate,
- Local<String> command) {
- EscapableHandleScope handle_scope(isolate);
- v8::Local<v8::Context> context =
- v8::Local<v8::Context>::New(isolate, utility_context_);
- v8::Context::Scope context_scope(context);
- Local<Object> global = context->Global();
- Local<Value> fun =
- global->Get(context,
- String::NewFromUtf8(isolate, "DebugCommandToJSONRequest",
- NewStringType::kNormal).ToLocalChecked())
- .ToLocalChecked();
- static const int kArgc = 1;
- Local<Value> argv[kArgc] = {command};
- Local<Value> val = Local<Function>::Cast(fun)
- ->Call(context, global, kArgc, argv)
- .ToLocalChecked();
- return handle_scope.Escape(Local<Value>(val));
-}
-
-
int32_t* Counter::Bind(const char* name, bool is_histogram) {
int i;
for (i = 0; i < kMaxNameSize - 1 && name[i]; i++)
@@ -1110,6 +1056,8 @@ void Shell::InstallUtilityScript(Isolate* isolate) {
HandleScope scope(isolate);
// If we use the utility context, we have to set the security tokens so that
// utility, evaluation and debug context can all access each other.
+ Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
+ utility_context_.Reset(isolate, Context::New(isolate, NULL, global_template));
v8::Local<v8::Context> utility_context =
v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Local<v8::Context> evaluation_context =
@@ -1118,22 +1066,6 @@ void Shell::InstallUtilityScript(Isolate* isolate) {
evaluation_context->SetSecurityToken(Undefined(isolate));
v8::Context::Scope context_scope(utility_context);
- if (i::FLAG_debugger) printf("JavaScript debugger enabled\n");
- // Install the debugger object in the utility scope
- i::Debug* debug = reinterpret_cast<i::Isolate*>(isolate)->debug();
- debug->Load();
- i::Handle<i::Context> debug_context = debug->debug_context();
- i::Handle<i::JSObject> js_debug
- = i::Handle<i::JSObject>(debug_context->global_object());
- utility_context->Global()
- ->Set(utility_context,
- String::NewFromUtf8(isolate, "$debug", NewStringType::kNormal)
- .ToLocalChecked(),
- Utils::ToLocal(js_debug))
- .FromJust();
- debug_context->set_security_token(
- reinterpret_cast<i::Isolate*>(isolate)->heap()->undefined_value());
-
// Run the d8 shell utility script in the utility context
int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
i::Vector<const char> shell_source =
@@ -1160,9 +1092,6 @@ void Shell::InstallUtilityScript(Isolate* isolate) {
: i::Handle<i::Script>(i::Script::cast(
i::SharedFunctionInfo::cast(*compiled_script)->script()));
script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE));
-
- // Start the in-process debugger if requested.
- if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent);
}
#endif // !V8_SHARED
@@ -1298,21 +1227,6 @@ void Shell::Initialize(Isolate* isolate) {
}
-void Shell::InitializeDebugger(Isolate* isolate) {
- if (options.test_shell) return;
-#ifndef V8_SHARED
- HandleScope scope(isolate);
- Local<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
- utility_context_.Reset(isolate,
- Context::New(isolate, NULL, global_template));
- if (utility_context_.IsEmpty()) {
- printf("Failed to initialize debugger\n");
- Shell::Exit(1);
- }
-#endif // !V8_SHARED
-}
-
-
Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
#ifndef V8_SHARED
// This needs to be a critical section since this is not thread-safe
@@ -2027,9 +1941,6 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strcmp(argv[i], "--dump-counters") == 0) {
printf("D8 with shared library does not include counters\n");
return false;
- } else if (strcmp(argv[i], "--debugger") == 0) {
- printf("Javascript debugger not included\n");
- return false;
#endif // V8_SHARED
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
} else if (strncmp(argv[i], "--natives_blob=", 15) == 0) {
@@ -2103,13 +2014,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
if (options.last_run && options.use_interactive_shell()) {
// Keep using the same context in the interactive shell.
evaluation_context_.Reset(isolate, context);
-#ifndef V8_SHARED
- // If the interactive debugger is enabled make sure to activate
- // it before running the files passed on the command line.
- if (i::FLAG_debugger) {
- InstallUtilityScript(isolate);
- }
-#endif // !V8_SHARED
}
{
Context::Scope cscope(context);
@@ -2535,7 +2439,6 @@ int Shell::Main(int argc, char* argv[]) {
Isolate::Scope scope(isolate);
Initialize(isolate);
PerIsolateData data(isolate);
- InitializeDebugger(isolate);
#ifndef V8_SHARED
if (options.dump_heap_constants) {
@@ -2574,9 +2477,7 @@ int Shell::Main(int argc, char* argv[]) {
// executed, but never on --test
if (options.use_interactive_shell()) {
#ifndef V8_SHARED
- if (!i::FLAG_debugger) {
- InstallUtilityScript(isolate);
- }
+ InstallUtilityScript(isolate);
#endif // !V8_SHARED
RunShell(isolate);
}
« 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