Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/bootstrapper.cc

Issue 2611643002: [modules] Add an IsModule flag to ScriptOriginOptions. (Closed)
Patch Set: Remove convenience function from API. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 return false; 2984 return false;
2985 } 2985 }
2986 2986
2987 Handle<Context> context(isolate->context()); 2987 Handle<Context> context(isolate->context());
2988 2988
2989 Handle<String> script_name = 2989 Handle<String> script_name =
2990 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); 2990 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked();
2991 Handle<SharedFunctionInfo> function_info = 2991 Handle<SharedFunctionInfo> function_info =
2992 Compiler::GetSharedFunctionInfoForScript( 2992 Compiler::GetSharedFunctionInfoForScript(
2993 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), 2993 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
2994 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag, 2994 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag);
2995 false);
2996 if (function_info.is_null()) return false; 2995 if (function_info.is_null()) return false;
2997 2996
2998 DCHECK(context->IsNativeContext()); 2997 DCHECK(context->IsNativeContext());
2999 2998
3000 Handle<JSFunction> fun = 2999 Handle<JSFunction> fun =
3001 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, 3000 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info,
3002 context); 3001 context);
3003 Handle<Object> receiver = isolate->factory()->undefined_value(); 3002 Handle<Object> receiver = isolate->factory()->undefined_value();
3004 3003
3005 // For non-extension scripts, run script to get the function wrapper. 3004 // For non-extension scripts, run script to get the function wrapper.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); 3047 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache();
3049 Handle<Context> context(isolate->context()); 3048 Handle<Context> context(isolate->context());
3050 DCHECK(context->IsNativeContext()); 3049 DCHECK(context->IsNativeContext());
3051 3050
3052 if (!cache->Lookup(name, &function_info)) { 3051 if (!cache->Lookup(name, &function_info)) {
3053 Handle<String> script_name = 3052 Handle<String> script_name =
3054 factory->NewStringFromUtf8(name).ToHandleChecked(); 3053 factory->NewStringFromUtf8(name).ToHandleChecked();
3055 function_info = Compiler::GetSharedFunctionInfoForScript( 3054 function_info = Compiler::GetSharedFunctionInfoForScript(
3056 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), 3055 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
3057 context, extension, NULL, ScriptCompiler::kNoCompileOptions, 3056 context, extension, NULL, ScriptCompiler::kNoCompileOptions,
3058 EXTENSION_CODE, false); 3057 EXTENSION_CODE);
3059 if (function_info.is_null()) return false; 3058 if (function_info.is_null()) return false;
3060 cache->Add(name, function_info); 3059 cache->Add(name, function_info);
3061 } 3060 }
3062 3061
3063 // Set up the function context. Conceptually, we should clone the 3062 // Set up the function context. Conceptually, we should clone the
3064 // function before overwriting the context but since we're in a 3063 // function before overwriting the context but since we're in a
3065 // single-threaded environment it is not strictly necessary. 3064 // single-threaded environment it is not strictly necessary.
3066 Handle<JSFunction> fun = 3065 Handle<JSFunction> fun =
3067 factory->NewFunctionFromSharedFunctionInfo(function_info, context); 3066 factory->NewFunctionFromSharedFunctionInfo(function_info, context);
3068 3067
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
4798 } 4797 }
4799 4798
4800 4799
4801 // Called when the top-level V8 mutex is destroyed. 4800 // Called when the top-level V8 mutex is destroyed.
4802 void Bootstrapper::FreeThreadResources() { 4801 void Bootstrapper::FreeThreadResources() {
4803 DCHECK(!IsActive()); 4802 DCHECK(!IsActive());
4804 } 4803 }
4805 4804
4806 } // namespace internal 4805 } // namespace internal
4807 } // namespace v8 4806 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698