OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 } | 1504 } |
1505 printf("\n"); | 1505 printf("\n"); |
1506 console->Close(); | 1506 console->Close(); |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 #ifndef V8_SHARED | 1510 #ifndef V8_SHARED |
1511 class ShellThread : public i::Thread { | 1511 class ShellThread : public i::Thread { |
1512 public: | 1512 public: |
1513 // Takes ownership of the underlying char array of |files|. | 1513 // Takes ownership of the underlying char array of |files|. |
1514 ShellThread(Isolate* isolate, int no, char* files) | 1514 ShellThread(Isolate* isolate, char* files) |
1515 : Thread("d8:ShellThread"), | 1515 : Thread("d8:ShellThread"), |
1516 isolate_(isolate), no_(no), files_(files) { } | 1516 isolate_(isolate), files_(files) { } |
1517 | 1517 |
1518 ~ShellThread() { | 1518 ~ShellThread() { |
1519 delete[] files_; | 1519 delete[] files_; |
1520 } | 1520 } |
1521 | 1521 |
1522 virtual void Run(); | 1522 virtual void Run(); |
1523 private: | 1523 private: |
1524 Isolate* isolate_; | 1524 Isolate* isolate_; |
1525 int no_; | |
1526 char* files_; | 1525 char* files_; |
1527 }; | 1526 }; |
1528 | 1527 |
1529 | 1528 |
1530 void ShellThread::Run() { | 1529 void ShellThread::Run() { |
1531 char* ptr = files_; | 1530 char* ptr = files_; |
1532 while ((ptr != NULL) && (*ptr != '\0')) { | 1531 while ((ptr != NULL) && (*ptr != '\0')) { |
1533 // For each newline-separated line. | 1532 // For each newline-separated line. |
1534 char* next_line = ReadLine(ptr); | 1533 char* next_line = ReadLine(ptr); |
1535 | 1534 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 for (int i = 0; i < options.num_parallel_files; i++) { | 1821 for (int i = 0; i < options.num_parallel_files; i++) { |
1823 char* files = NULL; | 1822 char* files = NULL; |
1824 { Locker lock(isolate); | 1823 { Locker lock(isolate); |
1825 int size = 0; | 1824 int size = 0; |
1826 files = ReadChars(isolate, options.parallel_files[i], &size); | 1825 files = ReadChars(isolate, options.parallel_files[i], &size); |
1827 } | 1826 } |
1828 if (files == NULL) { | 1827 if (files == NULL) { |
1829 printf("File list '%s' not found\n", options.parallel_files[i]); | 1828 printf("File list '%s' not found\n", options.parallel_files[i]); |
1830 Exit(1); | 1829 Exit(1); |
1831 } | 1830 } |
1832 ShellThread* thread = new ShellThread(isolate, threads.length(), files); | 1831 ShellThread* thread = new ShellThread(isolate, files); |
1833 thread->Start(); | 1832 thread->Start(); |
1834 threads.Add(thread); | 1833 threads.Add(thread); |
1835 } | 1834 } |
1836 } | 1835 } |
1837 for (int i = 1; i < options.num_isolates; ++i) { | 1836 for (int i = 1; i < options.num_isolates; ++i) { |
1838 options.isolate_sources[i].StartExecuteInThread(); | 1837 options.isolate_sources[i].StartExecuteInThread(); |
1839 } | 1838 } |
1840 #endif // V8_SHARED | 1839 #endif // V8_SHARED |
1841 { // NOLINT | 1840 { // NOLINT |
1842 Locker lock; | 1841 Locker lock; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 } | 1962 } |
1964 | 1963 |
1965 } // namespace v8 | 1964 } // namespace v8 |
1966 | 1965 |
1967 | 1966 |
1968 #ifndef GOOGLE3 | 1967 #ifndef GOOGLE3 |
1969 int main(int argc, char* argv[]) { | 1968 int main(int argc, char* argv[]) { |
1970 return v8::Shell::Main(argc, argv); | 1969 return v8::Shell::Main(argc, argv); |
1971 } | 1970 } |
1972 #endif | 1971 #endif |
OLD | NEW |