OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1976 } else { | 1976 } else { |
1977 printf("Unknown option to --cache.\n"); | 1977 printf("Unknown option to --cache.\n"); |
1978 return false; | 1978 return false; |
1979 } | 1979 } |
1980 argv[i] = NULL; | 1980 argv[i] = NULL; |
1981 } | 1981 } |
1982 } | 1982 } |
1983 | 1983 |
1984 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); | 1984 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); |
1985 | 1985 |
1986 bool enable_harmony_modules = false; | |
Dan Ehrenberg
2016/03/15 00:22:52
Presumably there's no reasonable way to recover th
adamk
2016/03/15 00:40:58
Not sure what you mean...d8 does support modules.
| |
1987 | |
1988 // Set up isolated source groups. | 1986 // Set up isolated source groups. |
1989 options.isolate_sources = new SourceGroup[options.num_isolates]; | 1987 options.isolate_sources = new SourceGroup[options.num_isolates]; |
1990 SourceGroup* current = options.isolate_sources; | 1988 SourceGroup* current = options.isolate_sources; |
1991 current->Begin(argv, 1); | 1989 current->Begin(argv, 1); |
1992 for (int i = 1; i < argc; i++) { | 1990 for (int i = 1; i < argc; i++) { |
1993 const char* str = argv[i]; | 1991 const char* str = argv[i]; |
1994 if (strcmp(str, "--isolate") == 0) { | 1992 if (strcmp(str, "--isolate") == 0) { |
1995 current->End(i); | 1993 current->End(i); |
1996 current++; | 1994 current++; |
1997 current->Begin(argv, i + 1); | 1995 current->Begin(argv, i + 1); |
1998 } else if (strcmp(str, "--module") == 0) { | 1996 } else if (strcmp(str, "--module") == 0) { |
1999 // Pass on to SourceGroup, which understands this option. | 1997 // Pass on to SourceGroup, which understands this option. |
2000 enable_harmony_modules = true; | |
2001 } else if (strncmp(argv[i], "--", 2) == 0) { | 1998 } else if (strncmp(argv[i], "--", 2) == 0) { |
2002 printf("Warning: unknown flag %s.\nTry --help for options\n", argv[i]); | 1999 printf("Warning: unknown flag %s.\nTry --help for options\n", argv[i]); |
2003 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { | 2000 } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { |
2004 options.script_executed = true; | 2001 options.script_executed = true; |
2005 } else if (strncmp(str, "-", 1) != 0) { | 2002 } else if (strncmp(str, "-", 1) != 0) { |
2006 // Not a flag, so it must be a script to execute. | 2003 // Not a flag, so it must be a script to execute. |
2007 options.script_executed = true; | 2004 options.script_executed = true; |
2008 } | 2005 } |
2009 } | 2006 } |
2010 current->End(argc); | 2007 current->End(argc); |
2011 | 2008 |
2012 if (!logfile_per_isolate && options.num_isolates) { | 2009 if (!logfile_per_isolate && options.num_isolates) { |
2013 SetFlagsFromString("--nologfile_per_isolate"); | 2010 SetFlagsFromString("--nologfile_per_isolate"); |
2014 } | 2011 } |
2015 | 2012 |
2016 if (enable_harmony_modules) { | |
2017 SetFlagsFromString("--harmony-modules"); | |
2018 } | |
2019 | |
2020 return true; | 2013 return true; |
2021 } | 2014 } |
2022 | 2015 |
2023 | 2016 |
2024 int Shell::RunMain(Isolate* isolate, int argc, char* argv[], bool last_run) { | 2017 int Shell::RunMain(Isolate* isolate, int argc, char* argv[], bool last_run) { |
2025 #ifndef V8_SHARED | 2018 #ifndef V8_SHARED |
2026 for (int i = 1; i < options.num_isolates; ++i) { | 2019 for (int i = 1; i < options.num_isolates; ++i) { |
2027 options.isolate_sources[i].StartExecuteInThread(); | 2020 options.isolate_sources[i].StartExecuteInThread(); |
2028 } | 2021 } |
2029 #endif // !V8_SHARED | 2022 #endif // !V8_SHARED |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2540 } | 2533 } |
2541 | 2534 |
2542 } // namespace v8 | 2535 } // namespace v8 |
2543 | 2536 |
2544 | 2537 |
2545 #ifndef GOOGLE3 | 2538 #ifndef GOOGLE3 |
2546 int main(int argc, char* argv[]) { | 2539 int main(int argc, char* argv[]) { |
2547 return v8::Shell::Main(argc, argv); | 2540 return v8::Shell::Main(argc, argv); |
2548 } | 2541 } |
2549 #endif | 2542 #endif |
OLD | NEW |