| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2948 return false; | 2948 return false; |
| 2949 } | 2949 } |
| 2950 | 2950 |
| 2951 Handle<Context> context(isolate->context()); | 2951 Handle<Context> context(isolate->context()); |
| 2952 | 2952 |
| 2953 Handle<String> script_name = | 2953 Handle<String> script_name = |
| 2954 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); | 2954 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); |
| 2955 Handle<SharedFunctionInfo> function_info = | 2955 Handle<SharedFunctionInfo> function_info = |
| 2956 Compiler::GetSharedFunctionInfoForScript( | 2956 Compiler::GetSharedFunctionInfoForScript( |
| 2957 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), | 2957 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), |
| 2958 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag, | 2958 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag); |
| 2959 false); | |
| 2960 if (function_info.is_null()) return false; | 2959 if (function_info.is_null()) return false; |
| 2961 | 2960 |
| 2962 DCHECK(context->IsNativeContext()); | 2961 DCHECK(context->IsNativeContext()); |
| 2963 | 2962 |
| 2964 Handle<JSFunction> fun = | 2963 Handle<JSFunction> fun = |
| 2965 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, | 2964 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, |
| 2966 context); | 2965 context); |
| 2967 Handle<Object> receiver = isolate->factory()->undefined_value(); | 2966 Handle<Object> receiver = isolate->factory()->undefined_value(); |
| 2968 | 2967 |
| 2969 // For non-extension scripts, run script to get the function wrapper. | 2968 // For non-extension scripts, run script to get the function wrapper. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); | 3005 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); |
| 3007 Handle<Context> context(isolate->context()); | 3006 Handle<Context> context(isolate->context()); |
| 3008 DCHECK(context->IsNativeContext()); | 3007 DCHECK(context->IsNativeContext()); |
| 3009 | 3008 |
| 3010 if (!cache->Lookup(name, &function_info)) { | 3009 if (!cache->Lookup(name, &function_info)) { |
| 3011 Handle<String> script_name = | 3010 Handle<String> script_name = |
| 3012 factory->NewStringFromUtf8(name).ToHandleChecked(); | 3011 factory->NewStringFromUtf8(name).ToHandleChecked(); |
| 3013 function_info = Compiler::GetSharedFunctionInfoForScript( | 3012 function_info = Compiler::GetSharedFunctionInfoForScript( |
| 3014 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), | 3013 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), |
| 3015 context, extension, NULL, ScriptCompiler::kNoCompileOptions, | 3014 context, extension, NULL, ScriptCompiler::kNoCompileOptions, |
| 3016 EXTENSION_CODE, false); | 3015 EXTENSION_CODE); |
| 3017 if (function_info.is_null()) return false; | 3016 if (function_info.is_null()) return false; |
| 3018 cache->Add(name, function_info); | 3017 cache->Add(name, function_info); |
| 3019 } | 3018 } |
| 3020 | 3019 |
| 3021 // Set up the function context. Conceptually, we should clone the | 3020 // Set up the function context. Conceptually, we should clone the |
| 3022 // function before overwriting the context but since we're in a | 3021 // function before overwriting the context but since we're in a |
| 3023 // single-threaded environment it is not strictly necessary. | 3022 // single-threaded environment it is not strictly necessary. |
| 3024 Handle<JSFunction> fun = | 3023 Handle<JSFunction> fun = |
| 3025 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 3024 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
| 3026 | 3025 |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4733 } | 4732 } |
| 4734 | 4733 |
| 4735 | 4734 |
| 4736 // Called when the top-level V8 mutex is destroyed. | 4735 // Called when the top-level V8 mutex is destroyed. |
| 4737 void Bootstrapper::FreeThreadResources() { | 4736 void Bootstrapper::FreeThreadResources() { |
| 4738 DCHECK(!IsActive()); | 4737 DCHECK(!IsActive()); |
| 4739 } | 4738 } |
| 4740 | 4739 |
| 4741 } // namespace internal | 4740 } // namespace internal |
| 4742 } // namespace v8 | 4741 } // namespace v8 |
| OLD | NEW |