| 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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 733 |
| 734 | 734 |
| 735 Persistent<Context> Shell::CreateEvaluationContext() { | 735 Persistent<Context> Shell::CreateEvaluationContext() { |
| 736 #ifndef V8_SHARED | 736 #ifndef V8_SHARED |
| 737 // This needs to be a critical section since this is not thread-safe | 737 // This needs to be a critical section since this is not thread-safe |
| 738 i::ScopedLock lock(context_mutex_); | 738 i::ScopedLock lock(context_mutex_); |
| 739 #endif // V8_SHARED | 739 #endif // V8_SHARED |
| 740 // Initialize the global objects | 740 // Initialize the global objects |
| 741 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); | 741 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); |
| 742 Persistent<Context> context = Context::New(NULL, global_template); | 742 Persistent<Context> context = Context::New(NULL, global_template); |
| 743 ASSERT(!context.IsEmpty()); |
| 743 Context::Scope scope(context); | 744 Context::Scope scope(context); |
| 744 | 745 |
| 745 #ifndef V8_SHARED | 746 #ifndef V8_SHARED |
| 746 i::JSArguments js_args = i::FLAG_js_arguments; | 747 i::JSArguments js_args = i::FLAG_js_arguments; |
| 747 i::Handle<i::FixedArray> arguments_array = | 748 i::Handle<i::FixedArray> arguments_array = |
| 748 FACTORY->NewFixedArray(js_args.argc()); | 749 FACTORY->NewFixedArray(js_args.argc()); |
| 749 for (int j = 0; j < js_args.argc(); j++) { | 750 for (int j = 0; j < js_args.argc(); j++) { |
| 750 i::Handle<i::String> arg = | 751 i::Handle<i::String> arg = |
| 751 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j])); | 752 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j])); |
| 752 arguments_array->set(j, *arg); | 753 arguments_array->set(j, *arg); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 for (int i = 1; i < options.num_isolates; ++i) { | 1230 for (int i = 1; i < options.num_isolates; ++i) { |
| 1230 options.isolate_sources[i].WaitForThread(); | 1231 options.isolate_sources[i].WaitForThread(); |
| 1231 } | 1232 } |
| 1232 | 1233 |
| 1233 if (options.parallel_files != NULL) | 1234 if (options.parallel_files != NULL) |
| 1234 for (int i = 0; i < threads.length(); i++) { | 1235 for (int i = 0; i < threads.length(); i++) { |
| 1235 i::Thread* thread = threads[i]; | 1236 i::Thread* thread = threads[i]; |
| 1236 thread->Join(); | 1237 thread->Join(); |
| 1237 delete thread; | 1238 delete thread; |
| 1238 } | 1239 } |
| 1239 | |
| 1240 OnExit(); | |
| 1241 #endif // V8_SHARED | 1240 #endif // V8_SHARED |
| 1242 return 0; | 1241 return 0; |
| 1243 } | 1242 } |
| 1244 | 1243 |
| 1245 | 1244 |
| 1246 int Shell::Main(int argc, char* argv[]) { | 1245 int Shell::Main(int argc, char* argv[]) { |
| 1247 if (!SetOptions(argc, argv)) return 1; | 1246 if (!SetOptions(argc, argv)) return 1; |
| 1248 Initialize(); | 1247 Initialize(); |
| 1249 | 1248 |
| 1250 int result = 0; | 1249 int result = 0; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 || !options.script_executed ) | 1281 || !options.script_executed ) |
| 1283 && !options.test_shell ) { | 1282 && !options.test_shell ) { |
| 1284 #ifndef V8_SHARED | 1283 #ifndef V8_SHARED |
| 1285 InstallUtilityScript(); | 1284 InstallUtilityScript(); |
| 1286 #endif // V8_SHARED | 1285 #endif // V8_SHARED |
| 1287 RunShell(); | 1286 RunShell(); |
| 1288 } | 1287 } |
| 1289 | 1288 |
| 1290 V8::Dispose(); | 1289 V8::Dispose(); |
| 1291 | 1290 |
| 1291 #ifndef V8_SHARED |
| 1292 OnExit(); |
| 1293 #endif // V8_SHARED |
| 1294 |
| 1292 return result; | 1295 return result; |
| 1293 } | 1296 } |
| 1294 | 1297 |
| 1295 } // namespace v8 | 1298 } // namespace v8 |
| 1296 | 1299 |
| 1297 | 1300 |
| 1298 #ifndef GOOGLE3 | 1301 #ifndef GOOGLE3 |
| 1299 int main(int argc, char* argv[]) { | 1302 int main(int argc, char* argv[]) { |
| 1300 return v8::Shell::Main(argc, argv); | 1303 return v8::Shell::Main(argc, argv); |
| 1301 } | 1304 } |
| 1302 #endif | 1305 #endif |
| OLD | NEW |