From 5a47bfe3bc7d69191e33e776a76c6e5430907704 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 13 May 2014 08:31:27 +0000 Subject: [PATCH] Remove unused -p option from d8. R=ishell@chromium.org Review URL: https://codereview.chromium.org/280543002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21280 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8.cc | 144 -------------------------------------------------------- src/d8.h | 11 ----- src/execution.h | 2 - 3 files changed, 157 deletions(-) diff --git a/src/d8.cc b/src/d8.cc index b53ddf8..d19247a 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -1116,29 +1116,6 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo& args) { } -#ifndef V8_SHARED -static char* ReadToken(char* data, char token) { - char* next = i::OS::StrChr(data, token); - if (next != NULL) { - *next = '\0'; - return (next + 1); - } - - return NULL; -} - - -static char* ReadLine(char* data) { - return ReadToken(data, '\n'); -} - - -static char* ReadWord(char* data) { - return ReadToken(data, ' '); -} -#endif // !V8_SHARED - - // Reads a file into a v8 string. Handle Shell::ReadFile(Isolate* isolate, const char* name) { int size = 0; @@ -1172,71 +1149,6 @@ void Shell::RunShell(Isolate* isolate) { } -#ifndef V8_SHARED -class ShellThread : public i::Thread { - public: - // Takes ownership of the underlying char array of |files|. - ShellThread(Isolate* isolate, char* files) - : Thread("d8:ShellThread"), - isolate_(isolate), files_(files) { } - - ~ShellThread() { - delete[] files_; - } - - virtual void Run(); - private: - Isolate* isolate_; - char* files_; -}; - - -void ShellThread::Run() { - char* ptr = files_; - while ((ptr != NULL) && (*ptr != '\0')) { - // For each newline-separated line. - char* next_line = ReadLine(ptr); - - if (*ptr == '#') { - // Skip comment lines. - ptr = next_line; - continue; - } - - // Prepare the context for this thread. - Locker locker(isolate_); - HandleScope outer_scope(isolate_); - Local thread_context = - Shell::CreateEvaluationContext(isolate_); - Context::Scope context_scope(thread_context); - PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate_)); - - while ((ptr != NULL) && (*ptr != '\0')) { - HandleScope inner_scope(isolate_); - char* filename = ptr; - ptr = ReadWord(ptr); - - // Skip empty strings. - if (strlen(filename) == 0) { - continue; - } - - Handle str = Shell::ReadFile(isolate_, filename); - if (str.IsEmpty()) { - printf("File '%s' not found\n", filename); - Shell::Exit(1); - } - - Shell::ExecuteString( - isolate_, str, String::NewFromUtf8(isolate_, filename), false, false); - } - - ptr = next_line; - } -} -#endif // !V8_SHARED - - SourceGroup::~SourceGroup() { #ifndef V8_SHARED delete thread_; @@ -1360,8 +1272,6 @@ void SetFlagsFromString(const char* flags) { bool Shell::SetOptions(int argc, char* argv[]) { bool logfile_per_isolate = false; for (int i = 0; i < argc; i++) { - // Turn '_' into '-'. - // for (char* c = arg; *c != '\0'; c++) if (*c == '_') *c = '-'; if (strcmp(argv[i], "--stress-opt") == 0) { options.stress_opt = true; argv[i] = NULL; @@ -1400,13 +1310,6 @@ bool Shell::SetOptions(int argc, char* argv[]) { return false; #endif // V8_SHARED options.num_isolates++; - } else if (strcmp(argv[i], "-p") == 0) { -#ifdef V8_SHARED - printf("D8 with shared library does not support multi-threading\n"); - return false; -#else - options.num_parallel_files++; -#endif // V8_SHARED } else if (strcmp(argv[i], "--dump-heap-constants") == 0) { #ifdef V8_SHARED printf("D8 with shared library does not support constant dumping\n"); @@ -1433,30 +1336,6 @@ bool Shell::SetOptions(int argc, char* argv[]) { #endif // V8_SHARED } -#ifndef V8_SHARED - // Run parallel threads if we are not using --isolate - options.parallel_files = new char*[options.num_parallel_files]; - int parallel_files_set = 0; - for (int i = 1; i < argc; i++) { - if (argv[i] == NULL) continue; - if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) { - if (options.num_isolates > 1) { - printf("-p is not compatible with --isolate\n"); - return false; - } - argv[i] = NULL; - i++; - options.parallel_files[parallel_files_set] = argv[i]; - parallel_files_set++; - argv[i] = NULL; - } - } - if (parallel_files_set != options.num_parallel_files) { - printf("-p requires a file containing a list of files as parameter\n"); - return false; - } -#endif // !V8_SHARED - v8::V8::SetFlagsFromCommandLine(&argc, argv, true); // Set up isolated source groups. @@ -1485,23 +1364,6 @@ bool Shell::SetOptions(int argc, char* argv[]) { int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { #ifndef V8_SHARED - i::List threads(1); - if (options.parallel_files != NULL) { - for (int i = 0; i < options.num_parallel_files; i++) { - char* files = NULL; - { Locker lock(isolate); - int size = 0; - files = ReadChars(isolate, options.parallel_files[i], &size); - } - if (files == NULL) { - printf("File list '%s' not found\n", options.parallel_files[i]); - Exit(1); - } - ShellThread* thread = new ShellThread(isolate, files); - thread->Start(); - threads.Add(thread); - } - } for (int i = 1; i < options.num_isolates; ++i) { options.isolate_sources[i].StartExecuteInThread(); } @@ -1541,12 +1403,6 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { for (int i = 1; i < options.num_isolates; ++i) { options.isolate_sources[i].WaitForThread(); } - - for (int i = 0; i < threads.length(); i++) { - i::Thread* thread = threads[i]; - thread->Join(); - delete thread; - } #endif // !V8_SHARED return 0; } diff --git a/src/d8.h b/src/d8.h index bf29023..75d007f 100644 --- a/src/d8.h +++ b/src/d8.h @@ -195,10 +195,6 @@ class BinaryResource : public v8::String::ExternalAsciiStringResource { class ShellOptions { public: ShellOptions() : -#ifndef V8_SHARED - num_parallel_files(0), - parallel_files(NULL), -#endif // !V8_SHARED script_executed(false), last_run(true), send_idle_notification(false), @@ -214,16 +210,9 @@ class ShellOptions { icu_data_file(NULL) { } ~ShellOptions() { -#ifndef V8_SHARED - delete[] parallel_files; -#endif // !V8_SHARED delete[] isolate_sources; } -#ifndef V8_SHARED - int num_parallel_files; - char** parallel_files; -#endif // !V8_SHARED bool script_executed; bool last_run; bool send_idle_notification; diff --git a/src/execution.h b/src/execution.h index 6d0b15f..563c496 100644 --- a/src/execution.h +++ b/src/execution.h @@ -212,8 +212,6 @@ enum InterruptFlag { void ClearInterrupt(int flagbit); bool CheckAndClearInterrupt(InterruptFlag flag, const ExecutionAccess& lock); - void InvokeApiInterruptCallback(); - // You should hold the ExecutionAccess lock when calling this method. bool has_pending_interrupts(const ExecutionAccess& lock) { // Sanity check: We shouldn't be asking about pending interrupts -- 2.7.4