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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 v8::Local<v8::Context>::New(isolate, utility_context_); | 759 v8::Local<v8::Context>::New(isolate, utility_context_); |
760 v8::Local<v8::Context> evaluation_context = | 760 v8::Local<v8::Context> evaluation_context = |
761 v8::Local<v8::Context>::New(isolate, evaluation_context_); | 761 v8::Local<v8::Context>::New(isolate, evaluation_context_); |
762 utility_context->SetSecurityToken(Undefined(isolate)); | 762 utility_context->SetSecurityToken(Undefined(isolate)); |
763 evaluation_context->SetSecurityToken(Undefined(isolate)); | 763 evaluation_context->SetSecurityToken(Undefined(isolate)); |
764 v8::Context::Scope context_scope(utility_context); | 764 v8::Context::Scope context_scope(utility_context); |
765 | 765 |
766 #ifdef ENABLE_DEBUGGER_SUPPORT | 766 #ifdef ENABLE_DEBUGGER_SUPPORT |
767 if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); | 767 if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); |
768 // Install the debugger object in the utility scope | 768 // Install the debugger object in the utility scope |
769 i::Debug* debug = i::Isolate::Current()->debug(); | 769 i::Debug* debug = reinterpret_cast<i::Isolate*>(isolate)->debug(); |
770 debug->Load(); | 770 debug->Load(); |
771 i::Handle<i::JSObject> js_debug | 771 i::Handle<i::JSObject> js_debug |
772 = i::Handle<i::JSObject>(debug->debug_context()->global_object()); | 772 = i::Handle<i::JSObject>(debug->debug_context()->global_object()); |
773 utility_context->Global()->Set(String::New("$debug"), | 773 utility_context->Global()->Set(String::New("$debug"), |
774 Utils::ToLocal(js_debug)); | 774 Utils::ToLocal(js_debug)); |
775 debug->debug_context()->set_security_token(HEAP->undefined_value()); | 775 debug->debug_context()->set_security_token(HEAP->undefined_value()); |
776 #endif // ENABLE_DEBUGGER_SUPPORT | 776 #endif // ENABLE_DEBUGGER_SUPPORT |
777 | 777 |
778 // Run the d8 shell utility script in the utility context | 778 // Run the d8 shell utility script in the utility context |
779 int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); | 779 int source_index = i::NativesCollection<i::D8>::GetIndex("d8"); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 i::LockGuard<i::Mutex> lock_guard(&context_mutex_); | 928 i::LockGuard<i::Mutex> lock_guard(&context_mutex_); |
929 #endif // V8_SHARED | 929 #endif // V8_SHARED |
930 // Initialize the global objects | 930 // Initialize the global objects |
931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
932 HandleScope handle_scope(isolate); | 932 HandleScope handle_scope(isolate); |
933 Local<Context> context = Context::New(isolate, NULL, global_template); | 933 Local<Context> context = Context::New(isolate, NULL, global_template); |
934 ASSERT(!context.IsEmpty()); | 934 ASSERT(!context.IsEmpty()); |
935 Context::Scope scope(context); | 935 Context::Scope scope(context); |
936 | 936 |
937 #ifndef V8_SHARED | 937 #ifndef V8_SHARED |
938 i::Factory* factory = i::Isolate::Current()->factory(); | 938 i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory(); |
939 i::JSArguments js_args = i::FLAG_js_arguments; | 939 i::JSArguments js_args = i::FLAG_js_arguments; |
940 i::Handle<i::FixedArray> arguments_array = | 940 i::Handle<i::FixedArray> arguments_array = |
941 factory->NewFixedArray(js_args.argc()); | 941 factory->NewFixedArray(js_args.argc()); |
942 for (int j = 0; j < js_args.argc(); j++) { | 942 for (int j = 0; j < js_args.argc(); j++) { |
943 i::Handle<i::String> arg = | 943 i::Handle<i::String> arg = |
944 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); | 944 factory->NewStringFromUtf8(i::CStrVector(js_args[j])); |
945 arguments_array->set(j, *arg); | 945 arguments_array->set(j, *arg); |
946 } | 946 } |
947 i::Handle<i::JSArray> arguments_jsarray = | 947 i::Handle<i::JSArray> arguments_jsarray = |
948 factory->NewJSArrayWithElements(arguments_array); | 948 factory->NewJSArrayWithElements(arguments_array); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 } | 1728 } |
1729 | 1729 |
1730 } // namespace v8 | 1730 } // namespace v8 |
1731 | 1731 |
1732 | 1732 |
1733 #ifndef GOOGLE3 | 1733 #ifndef GOOGLE3 |
1734 int main(int argc, char* argv[]) { | 1734 int main(int argc, char* argv[]) { |
1735 return v8::Shell::Main(argc, argv); | 1735 return v8::Shell::Main(argc, argv); |
1736 } | 1736 } |
1737 #endif | 1737 #endif |
OLD | NEW |