| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 Handle<String> name = String::New("(d8)"); | 764 Handle<String> name = String::New("(d8)"); |
| 765 ExecuteString(String::New(*input), name, true, true); | 765 ExecuteString(String::New(*input), name, true, true); |
| 766 } | 766 } |
| 767 editor->Close(); | 767 editor->Close(); |
| 768 printf("\n"); | 768 printf("\n"); |
| 769 } | 769 } |
| 770 | 770 |
| 771 | 771 |
| 772 class ShellThread : public i::Thread { | 772 class ShellThread : public i::Thread { |
| 773 public: | 773 public: |
| 774 ShellThread(i::Isolate* isolate, int no, i::Vector<const char> files) | 774 ShellThread(int no, i::Vector<const char> files) |
| 775 : Thread(isolate, "d8:ShellThread"), | 775 : Thread("d8:ShellThread"), |
| 776 no_(no), files_(files) { } | 776 no_(no), files_(files) { } |
| 777 virtual void Run(); | 777 virtual void Run(); |
| 778 private: | 778 private: |
| 779 int no_; | 779 int no_; |
| 780 i::Vector<const char> files_; | 780 i::Vector<const char> files_; |
| 781 }; | 781 }; |
| 782 | 782 |
| 783 | 783 |
| 784 void ShellThread::Run() { | 784 void ShellThread::Run() { |
| 785 // Prepare the context for this thread. | 785 // Prepare the context for this thread. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 v8::Handle<v8::String> source = v8::String::New(argv[++i]); | 872 v8::Handle<v8::String> source = v8::String::New(argv[++i]); |
| 873 if (!ExecuteString(source, file_name, false, true)) { | 873 if (!ExecuteString(source, file_name, false, true)) { |
| 874 OnExit(); | 874 OnExit(); |
| 875 return 1; | 875 return 1; |
| 876 } | 876 } |
| 877 } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { | 877 } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { |
| 878 int size = 0; | 878 int size = 0; |
| 879 const char* files = ReadChars(argv[++i], &size); | 879 const char* files = ReadChars(argv[++i], &size); |
| 880 if (files == NULL) return 1; | 880 if (files == NULL) return 1; |
| 881 ShellThread* thread = | 881 ShellThread* thread = |
| 882 new ShellThread(i::Isolate::Current(), | 882 new ShellThread(threads.length(), |
| 883 threads.length(), | |
| 884 i::Vector<const char>(files, size)); | 883 i::Vector<const char>(files, size)); |
| 885 thread->Start(); | 884 thread->Start(); |
| 886 threads.Add(thread); | 885 threads.Add(thread); |
| 887 } else { | 886 } else { |
| 888 // Use all other arguments as names of files to load and run. | 887 // Use all other arguments as names of files to load and run. |
| 889 HandleScope handle_scope; | 888 HandleScope handle_scope; |
| 890 Handle<String> file_name = v8::String::New(str); | 889 Handle<String> file_name = v8::String::New(str); |
| 891 Handle<String> source = ReadFile(str); | 890 Handle<String> source = ReadFile(str); |
| 892 if (source.IsEmpty()) { | 891 if (source.IsEmpty()) { |
| 893 printf("Error reading '%s'\n", str); | 892 printf("Error reading '%s'\n", str); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } | 979 } |
| 981 | 980 |
| 982 } // namespace v8 | 981 } // namespace v8 |
| 983 | 982 |
| 984 | 983 |
| 985 #ifndef GOOGLE3 | 984 #ifndef GOOGLE3 |
| 986 int main(int argc, char* argv[]) { | 985 int main(int argc, char* argv[]) { |
| 987 return v8::Shell::Main(argc, argv); | 986 return v8::Shell::Main(argc, argv); |
| 988 } | 987 } |
| 989 #endif | 988 #endif |
| OLD | NEW |