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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 932 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
933 HandleScope handle_scope(isolate); | 933 HandleScope handle_scope(isolate); |
934 Local<Context> context = Context::New(isolate, NULL, global_template); | 934 Local<Context> context = Context::New(isolate, NULL, global_template); |
935 ASSERT(!context.IsEmpty()); | 935 ASSERT(!context.IsEmpty()); |
936 Context::Scope scope(context); | 936 Context::Scope scope(context); |
937 | 937 |
938 #ifndef V8_SHARED | 938 #ifndef V8_SHARED |
939 i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory(); | 939 i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory(); |
940 i::JSArguments js_args = i::FLAG_js_arguments; | 940 i::JSArguments js_args = i::FLAG_js_arguments; |
941 i::Handle<i::FixedArray> arguments_array = | 941 i::Handle<i::FixedArray> arguments_array = |
942 factory->NewFixedArray(js_args.argc()); | 942 factory->NewFixedArray(js_args.argc); |
943 for (int j = 0; j < js_args.argc(); j++) { | 943 for (int j = 0; j < js_args.argc; j++) { |
944 i::Handle<i::String> arg = | 944 i::Handle<i::String> arg = |
945 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); | 945 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); |
946 arguments_array->set(j, *arg); | 946 arguments_array->set(j, *arg); |
947 } | 947 } |
948 i::Handle<i::JSArray> arguments_jsarray = | 948 i::Handle<i::JSArray> arguments_jsarray = |
949 factory->NewJSArrayWithElements(arguments_array); | 949 factory->NewJSArrayWithElements(arguments_array); |
950 context->Global()->Set(String::New("arguments"), | 950 context->Global()->Set(String::New("arguments"), |
951 Utils::ToLocal(arguments_jsarray)); | 951 Utils::ToLocal(arguments_jsarray)); |
952 #endif // V8_SHARED | 952 #endif // V8_SHARED |
953 return handle_scope.Close(context); | 953 return handle_scope.Close(context); |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 } | 1725 } |
1726 | 1726 |
1727 } // namespace v8 | 1727 } // namespace v8 |
1728 | 1728 |
1729 | 1729 |
1730 #ifndef GOOGLE3 | 1730 #ifndef GOOGLE3 |
1731 int main(int argc, char* argv[]) { | 1731 int main(int argc, char* argv[]) { |
1732 return v8::Shell::Main(argc, argv); | 1732 return v8::Shell::Main(argc, argv); |
1733 } | 1733 } |
1734 #endif | 1734 #endif |
OLD | NEW |