| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 i::ScopedLock lock(context_mutex_); | 933 i::ScopedLock lock(context_mutex_); |
| 934 #endif // V8_SHARED | 934 #endif // V8_SHARED |
| 935 // Initialize the global objects | 935 // Initialize the global objects |
| 936 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 936 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
| 937 HandleScope handle_scope(isolate); | 937 HandleScope handle_scope(isolate); |
| 938 Local<Context> context = Context::New(isolate, NULL, global_template); | 938 Local<Context> context = Context::New(isolate, NULL, global_template); |
| 939 ASSERT(!context.IsEmpty()); | 939 ASSERT(!context.IsEmpty()); |
| 940 Context::Scope scope(context); | 940 Context::Scope scope(context); |
| 941 | 941 |
| 942 #ifndef V8_SHARED | 942 #ifndef V8_SHARED |
| 943 i::Factory* factory = i::Isolate::Current()->factory(); |
| 943 i::JSArguments js_args = i::FLAG_js_arguments; | 944 i::JSArguments js_args = i::FLAG_js_arguments; |
| 944 i::Handle<i::FixedArray> arguments_array = | 945 i::Handle<i::FixedArray> arguments_array = |
| 945 FACTORY->NewFixedArray(js_args.argc()); | 946 factory->NewFixedArray(js_args.argc()); |
| 946 for (int j = 0; j < js_args.argc(); j++) { | 947 for (int j = 0; j < js_args.argc(); j++) { |
| 947 i::Handle<i::String> arg = | 948 i::Handle<i::String> arg = |
| 948 FACTORY->NewStringFromUtf8(i::CStrVector(js_args[j])); | 949 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); |
| 949 arguments_array->set(j, *arg); | 950 arguments_array->set(j, *arg); |
| 950 } | 951 } |
| 951 i::Handle<i::JSArray> arguments_jsarray = | 952 i::Handle<i::JSArray> arguments_jsarray = |
| 952 FACTORY->NewJSArrayWithElements(arguments_array); | 953 factory->NewJSArrayWithElements(arguments_array); |
| 953 context->Global()->Set(String::New("arguments"), | 954 context->Global()->Set(String::New("arguments"), |
| 954 Utils::ToLocal(arguments_jsarray)); | 955 Utils::ToLocal(arguments_jsarray)); |
| 955 #endif // V8_SHARED | 956 #endif // V8_SHARED |
| 956 return handle_scope.Close(context); | 957 return handle_scope.Close(context); |
| 957 } | 958 } |
| 958 | 959 |
| 959 | 960 |
| 960 void Shell::Exit(int exit_code) { | 961 void Shell::Exit(int exit_code) { |
| 961 // Use _exit instead of exit to avoid races between isolate | 962 // Use _exit instead of exit to avoid races between isolate |
| 962 // threads and static destructors. | 963 // threads and static destructors. |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 } | 1636 } |
| 1636 | 1637 |
| 1637 } // namespace v8 | 1638 } // namespace v8 |
| 1638 | 1639 |
| 1639 | 1640 |
| 1640 #ifndef GOOGLE3 | 1641 #ifndef GOOGLE3 |
| 1641 int main(int argc, char* argv[]) { | 1642 int main(int argc, char* argv[]) { |
| 1642 return v8::Shell::Main(argc, argv); | 1643 return v8::Shell::Main(argc, argv); |
| 1643 } | 1644 } |
| 1644 #endif | 1645 #endif |
| OLD | NEW |