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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 753 } |
754 | 754 |
755 | 755 |
756 Persistent<Context> Shell::CreateEvaluationContext() { | 756 Persistent<Context> Shell::CreateEvaluationContext() { |
757 #ifndef V8_SHARED | 757 #ifndef V8_SHARED |
758 // This needs to be a critical section since this is not thread-safe | 758 // This needs to be a critical section since this is not thread-safe |
759 i::ScopedLock lock(context_mutex_); | 759 i::ScopedLock lock(context_mutex_); |
760 #endif // V8_SHARED | 760 #endif // V8_SHARED |
761 // Initialize the global objects | 761 // Initialize the global objects |
762 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); | 762 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(); |
| 763 |
| 764 v8::TryCatch try_catch; |
763 Persistent<Context> context = Context::New(NULL, global_template); | 765 Persistent<Context> context = Context::New(NULL, global_template); |
764 ASSERT(!context.IsEmpty()); | 766 if (context.IsEmpty()) { |
| 767 v8::Local<v8::Value> st = try_catch.StackTrace(); |
| 768 ASSERT(!context.IsEmpty()); |
| 769 } |
765 Context::Scope scope(context); | 770 Context::Scope scope(context); |
766 | 771 |
767 #ifndef V8_SHARED | 772 #ifndef V8_SHARED |
768 i::JSArguments js_args = i::FLAG_js_arguments; | 773 i::JSArguments js_args = i::FLAG_js_arguments; |
769 i::Handle<i::FixedArray> arguments_array = | 774 i::Handle<i::FixedArray> arguments_array = |
770 FACTORY->NewFixedArray(js_args.argc()); | 775 FACTORY->NewFixedArray(js_args.argc()); |
771 for (int j = 0; j < js_args.argc(); j++) { | 776 for (int j = 0; j < js_args.argc(); j++) { |
772 i::Handle<i::String> arg = | 777 i::Handle<i::String> arg = |
773 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j])); | 778 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j])); |
774 arguments_array->set(j, *arg); | 779 arguments_array->set(j, *arg); |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 } | 1352 } |
1348 | 1353 |
1349 } // namespace v8 | 1354 } // namespace v8 |
1350 | 1355 |
1351 | 1356 |
1352 #ifndef GOOGLE3 | 1357 #ifndef GOOGLE3 |
1353 int main(int argc, char* argv[]) { | 1358 int main(int argc, char* argv[]) { |
1354 return v8::Shell::Main(argc, argv); | 1359 return v8::Shell::Main(argc, argv); |
1355 } | 1360 } |
1356 #endif | 1361 #endif |
OLD | NEW |