| 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 | 826 |
| 827 | 827 |
| 828 void Shell::AddHistogramSample(void* histogram, int sample) { | 828 void Shell::AddHistogramSample(void* histogram, int sample) { |
| 829 Counter* counter = reinterpret_cast<Counter*>(histogram); | 829 Counter* counter = reinterpret_cast<Counter*>(histogram); |
| 830 counter->AddSample(sample); | 830 counter->AddSample(sample); |
| 831 } | 831 } |
| 832 | 832 |
| 833 | 833 |
| 834 void Shell::InstallUtilityScript(Isolate* isolate) { | 834 void Shell::InstallUtilityScript(Isolate* isolate) { |
| 835 HandleScope scope(isolate); | 835 HandleScope scope(isolate); |
| 836 // TODO(rossberg): Utility scripts do not yet obey strong mode rules. |
| 837 bool use_strong = i::FLAG_use_strong; |
| 838 i::FLAG_use_strong = false; |
| 839 |
| 836 // If we use the utility context, we have to set the security tokens so that | 840 // If we use the utility context, we have to set the security tokens so that |
| 837 // utility, evaluation and debug context can all access each other. | 841 // utility, evaluation and debug context can all access each other. |
| 838 v8::Local<v8::Context> utility_context = | 842 v8::Local<v8::Context> utility_context = |
| 839 v8::Local<v8::Context>::New(isolate, utility_context_); | 843 v8::Local<v8::Context>::New(isolate, utility_context_); |
| 840 v8::Local<v8::Context> evaluation_context = | 844 v8::Local<v8::Context> evaluation_context = |
| 841 v8::Local<v8::Context>::New(isolate, evaluation_context_); | 845 v8::Local<v8::Context>::New(isolate, evaluation_context_); |
| 842 utility_context->SetSecurityToken(Undefined(isolate)); | 846 utility_context->SetSecurityToken(Undefined(isolate)); |
| 843 evaluation_context->SetSecurityToken(Undefined(isolate)); | 847 evaluation_context->SetSecurityToken(Undefined(isolate)); |
| 844 v8::Context::Scope context_scope(utility_context); | 848 v8::Context::Scope context_scope(utility_context); |
| 845 | 849 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 875 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); | 879 i::Handle<i::Object> compiled_script = Utils::OpenHandle(*script); |
| 876 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() | 880 i::Handle<i::Script> script_object = compiled_script->IsJSFunction() |
| 877 ? i::Handle<i::Script>(i::Script::cast( | 881 ? i::Handle<i::Script>(i::Script::cast( |
| 878 i::JSFunction::cast(*compiled_script)->shared()->script())) | 882 i::JSFunction::cast(*compiled_script)->shared()->script())) |
| 879 : i::Handle<i::Script>(i::Script::cast( | 883 : i::Handle<i::Script>(i::Script::cast( |
| 880 i::SharedFunctionInfo::cast(*compiled_script)->script())); | 884 i::SharedFunctionInfo::cast(*compiled_script)->script())); |
| 881 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); | 885 script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE)); |
| 882 | 886 |
| 883 // Start the in-process debugger if requested. | 887 // Start the in-process debugger if requested. |
| 884 if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent); | 888 if (i::FLAG_debugger) v8::Debug::SetDebugEventListener(HandleDebugEvent); |
| 889 |
| 890 i::FLAG_use_strong = use_strong; |
| 885 } | 891 } |
| 886 #endif // !V8_SHARED | 892 #endif // !V8_SHARED |
| 887 | 893 |
| 888 | 894 |
| 889 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | 895 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { |
| 890 Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); | 896 Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
| 891 global_template->Set(String::NewFromUtf8(isolate, "print"), | 897 global_template->Set(String::NewFromUtf8(isolate, "print"), |
| 892 FunctionTemplate::New(isolate, Print)); | 898 FunctionTemplate::New(isolate, Print)); |
| 893 global_template->Set(String::NewFromUtf8(isolate, "write"), | 899 global_template->Set(String::NewFromUtf8(isolate, "write"), |
| 894 FunctionTemplate::New(isolate, Write)); | 900 FunctionTemplate::New(isolate, Write)); |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 } | 1696 } |
| 1691 | 1697 |
| 1692 } // namespace v8 | 1698 } // namespace v8 |
| 1693 | 1699 |
| 1694 | 1700 |
| 1695 #ifndef GOOGLE3 | 1701 #ifndef GOOGLE3 |
| 1696 int main(int argc, char* argv[]) { | 1702 int main(int argc, char* argv[]) { |
| 1697 return v8::Shell::Main(argc, argv); | 1703 return v8::Shell::Main(argc, argv); |
| 1698 } | 1704 } |
| 1699 #endif | 1705 #endif |
| OLD | NEW |