OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 } | 1246 } |
1247 } | 1247 } |
1248 for (int i = 1; i < options.num_isolates; ++i) { | 1248 for (int i = 1; i < options.num_isolates; ++i) { |
1249 options.isolate_sources[i].StartExecuteInThread(); | 1249 options.isolate_sources[i].StartExecuteInThread(); |
1250 } | 1250 } |
1251 #endif // V8_SHARED | 1251 #endif // V8_SHARED |
1252 { // NOLINT | 1252 { // NOLINT |
1253 Locker lock; | 1253 Locker lock; |
1254 HandleScope scope; | 1254 HandleScope scope; |
1255 Persistent<Context> context = CreateEvaluationContext(); | 1255 Persistent<Context> context = CreateEvaluationContext(); |
| 1256 if (options.last_run) { |
| 1257 // Keep using the same context in the interactive shell. |
| 1258 evaluation_context_ = context; |
| 1259 #ifndef V8_SHARED |
| 1260 // If the interactive debugger is enabled make sure to activate |
| 1261 // it before running the files passed on the command line. |
| 1262 if (i::FLAG_debugger) { |
| 1263 InstallUtilityScript(); |
| 1264 } |
| 1265 #endif // V8_SHARED |
| 1266 } |
1256 { | 1267 { |
1257 Context::Scope cscope(context); | 1268 Context::Scope cscope(context); |
1258 options.isolate_sources[0].Execute(); | 1269 options.isolate_sources[0].Execute(); |
1259 } | 1270 } |
1260 if (options.last_run) { | 1271 if (!options.last_run) { |
1261 // Keep using the same context in the interactive shell | |
1262 evaluation_context_ = context; | |
1263 } else { | |
1264 context.Dispose(); | 1272 context.Dispose(); |
1265 } | 1273 } |
1266 | 1274 |
1267 #ifndef V8_SHARED | 1275 #ifndef V8_SHARED |
1268 // Start preemption if threads have been created and preemption is enabled. | 1276 // Start preemption if threads have been created and preemption is enabled. |
1269 if (threads.length() > 0 | 1277 if (threads.length() > 0 |
1270 && options.use_preemption) { | 1278 && options.use_preemption) { |
1271 Locker::StartPreemption(options.preemption_interval); | 1279 Locker::StartPreemption(options.preemption_interval); |
1272 } | 1280 } |
1273 #endif // V8_SHARED | 1281 #endif // V8_SHARED |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 } | 1333 } |
1326 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT | 1334 #endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
1327 | 1335 |
1328 // Run interactive shell if explicitly requested or if no script has been | 1336 // Run interactive shell if explicitly requested or if no script has been |
1329 // executed, but never on --test | 1337 // executed, but never on --test |
1330 | 1338 |
1331 if (( options.interactive_shell | 1339 if (( options.interactive_shell |
1332 || !options.script_executed ) | 1340 || !options.script_executed ) |
1333 && !options.test_shell ) { | 1341 && !options.test_shell ) { |
1334 #ifndef V8_SHARED | 1342 #ifndef V8_SHARED |
1335 InstallUtilityScript(); | 1343 if (!i::FLAG_debugger) { |
| 1344 InstallUtilityScript(); |
| 1345 } |
1336 #endif // V8_SHARED | 1346 #endif // V8_SHARED |
1337 RunShell(); | 1347 RunShell(); |
1338 } | 1348 } |
1339 | 1349 |
1340 V8::Dispose(); | 1350 V8::Dispose(); |
1341 | 1351 |
1342 #ifndef V8_SHARED | 1352 #ifndef V8_SHARED |
1343 OnExit(); | 1353 OnExit(); |
1344 #endif // V8_SHARED | 1354 #endif // V8_SHARED |
1345 | 1355 |
1346 return result; | 1356 return result; |
1347 } | 1357 } |
1348 | 1358 |
1349 } // namespace v8 | 1359 } // namespace v8 |
1350 | 1360 |
1351 | 1361 |
1352 #ifndef GOOGLE3 | 1362 #ifndef GOOGLE3 |
1353 int main(int argc, char* argv[]) { | 1363 int main(int argc, char* argv[]) { |
1354 return v8::Shell::Main(argc, argv); | 1364 return v8::Shell::Main(argc, argv); |
1355 } | 1365 } |
1356 #endif | 1366 #endif |
OLD | NEW |