OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 833 |
834 | 834 |
835 void Shell::AddHistogramSample(void* histogram, int sample) { | 835 void Shell::AddHistogramSample(void* histogram, int sample) { |
836 Counter* counter = reinterpret_cast<Counter*>(histogram); | 836 Counter* counter = reinterpret_cast<Counter*>(histogram); |
837 counter->AddSample(sample); | 837 counter->AddSample(sample); |
838 } | 838 } |
839 | 839 |
840 | 840 |
841 void Shell::InstallUtilityScript(Isolate* isolate) { | 841 void Shell::InstallUtilityScript(Isolate* isolate) { |
842 HandleScope scope(isolate); | 842 HandleScope scope(isolate); |
843 // TODO(rossberg): Utility scripts do not yet obey strong mode rules. | |
844 bool use_strong = i::FLAG_use_strong; | |
845 i::FLAG_use_strong = false; | |
846 | |
847 // If we use the utility context, we have to set the security tokens so that | 843 // If we use the utility context, we have to set the security tokens so that |
848 // utility, evaluation and debug context can all access each other. | 844 // utility, evaluation and debug context can all access each other. |
849 v8::Local<v8::Context> utility_context = | 845 v8::Local<v8::Context> utility_context = |
850 v8::Local<v8::Context>::New(isolate, utility_context_); | 846 v8::Local<v8::Context>::New(isolate, utility_context_); |
851 v8::Local<v8::Context> evaluation_context = | 847 v8::Local<v8::Context> evaluation_context = |
852 v8::Local<v8::Context>::New(isolate, evaluation_context_); | 848 v8::Local<v8::Context>::New(isolate, evaluation_context_); |
853 utility_context->SetSecurityToken(Undefined(isolate)); | 849 utility_context->SetSecurityToken(Undefined(isolate)); |
854 evaluation_context->SetSecurityToken(Undefined(isolate)); | 850 evaluation_context->SetSecurityToken(Undefined(isolate)); |
855 v8::Context::Scope context_scope(utility_context); | 851 v8::Context::Scope context_scope(utility_context); |
856 | 852 |
(...skipping 29 matching lines...) Expand all Loading... |
886 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); | 882 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); |
887 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() | 883 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() |
888 ? i::Handle<i::Script>(i::Script::cast( | 884 ? i::Handle<i::Script>(i::Script::cast( |
889 i::JSFunction::cast(*compiled_script)->shared()->script())) | 885 i::JSFunction::cast(*compiled_script)->shared()->script())) |
890 : i::Handle<i::Script>(i::Script::cast( | 886 : i::Handle<i::Script>(i::Script::cast( |
891 i::SharedFunctionInfo::cast(*compiled_script)->script())); | 887 i::SharedFunctionInfo::cast(*compiled_script)->script())); |
892 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); | 888 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); |
893 | 889 |
894 // Start the in-process debugger if requested. | 890 // Start the in-process debugger if requested. |
895 if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent); | 891 if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent); |
896 | |
897 i::FLAG_use_strong = use_strong; | |
898 } | 892 } |
899 #endif // !V8_SHARED | 893 #endif // !V8_SHARED |
900 | 894 |
901 | 895 |
902 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | 896 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { |
903 Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); | 897 Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
904 global_template->Set(String::NewFromUtf8(isolate, "print"), | 898 global_template->Set(String::NewFromUtf8(isolate, "print"), |
905 FunctionTemplate::New(isolate, Print)); | 899 FunctionTemplate::New(isolate, Print)); |
906 global_template->Set(String::NewFromUtf8(isolate, "write"), | 900 global_template->Set(String::NewFromUtf8(isolate, "write"), |
907 FunctionTemplate::New(isolate, Write)); | 901 FunctionTemplate::New(isolate, Write)); |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 } | 1697 } |
1704 | 1698 |
1705 } // namespace v8 | 1699 } // namespace v8 |
1706 | 1700 |
1707 | 1701 |
1708 #ifndef GOOGLE3 | 1702 #ifndef GOOGLE3 |
1709 int main(int argc, char* argv[]) { | 1703 int main(int argc, char* argv[]) { |
1710 return v8::Shell::Main(argc, argv); | 1704 return v8::Shell::Main(argc, argv); |
1711 } | 1705 } |
1712 #endif | 1706 #endif |
OLD | NEW |