Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index b53ddf8f1b62243fff5655c9b2fb9637792c24f4..d19247a040054d92a665d75230e6aa057ea933c0 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -1116,29 +1116,6 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& 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<String> 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<Context> 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<String> 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<i::Thread*> 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; |
} |