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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 } | 1294 } |
1294 | 1295 |
1295 } // namespace v8 | 1296 } // namespace v8 |
1296 | 1297 |
1297 | 1298 |
1298 #ifndef GOOGLE3 | 1299 #ifndef GOOGLE3 |
1299 int main(int argc, char* argv[]) { | 1300 int main(int argc, char* argv[]) { |
1300 return v8::Shell::Main(argc, argv); | 1301 return v8::Shell::Main(argc, argv); |
1301 } | 1302 } |
1302 #endif | 1303 #endif |
OLD | NEW |