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/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 // environment has been at least partially initialized. Add a stack check | 1481 // environment has been at least partially initialized. Add a stack check |
1482 // before entering JS code to catch overflow early. | 1482 // before entering JS code to catch overflow early. |
1483 StackLimitCheck check(isolate); | 1483 StackLimitCheck check(isolate); |
1484 if (check.HasOverflowed()) return false; | 1484 if (check.HasOverflowed()) return false; |
1485 | 1485 |
1486 Handle<Context> context(isolate->context()); | 1486 Handle<Context> context(isolate->context()); |
1487 | 1487 |
1488 Handle<String> script_name = | 1488 Handle<String> script_name = |
1489 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); | 1489 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); |
1490 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( | 1490 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( |
1491 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), | 1491 source, script_name, 0, 0, false, false, Handle<Object>(), context, NULL, |
1492 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, | 1492 NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, false); |
1493 false); | |
1494 | 1493 |
1495 DCHECK(context->IsNativeContext()); | 1494 DCHECK(context->IsNativeContext()); |
1496 | 1495 |
1497 Handle<Context> runtime_context(context->runtime_context()); | 1496 Handle<Context> runtime_context(context->runtime_context()); |
1498 Handle<JSBuiltinsObject> receiver(context->builtins()); | 1497 Handle<JSBuiltinsObject> receiver(context->builtins()); |
1499 Handle<JSFunction> fun = | 1498 Handle<JSFunction> fun = |
1500 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, | 1499 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, |
1501 runtime_context); | 1500 runtime_context); |
1502 | 1501 |
1503 // For non-extension scripts, run script to get the function wrapper. | 1502 // For non-extension scripts, run script to get the function wrapper. |
(...skipping 22 matching lines...) Expand all Loading... |
1526 // function and insert it into the cache. | 1525 // function and insert it into the cache. |
1527 Vector<const char> name = CStrVector(extension->name()); | 1526 Vector<const char> name = CStrVector(extension->name()); |
1528 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); | 1527 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); |
1529 Handle<Context> context(isolate->context()); | 1528 Handle<Context> context(isolate->context()); |
1530 DCHECK(context->IsNativeContext()); | 1529 DCHECK(context->IsNativeContext()); |
1531 | 1530 |
1532 if (!cache->Lookup(name, &function_info)) { | 1531 if (!cache->Lookup(name, &function_info)) { |
1533 Handle<String> script_name = | 1532 Handle<String> script_name = |
1534 factory->NewStringFromUtf8(name).ToHandleChecked(); | 1533 factory->NewStringFromUtf8(name).ToHandleChecked(); |
1535 function_info = Compiler::CompileScript( | 1534 function_info = Compiler::CompileScript( |
1536 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), | 1535 source, script_name, 0, 0, false, false, Handle<Object>(), context, |
1537 context, extension, NULL, ScriptCompiler::kNoCompileOptions, | 1536 extension, NULL, ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, |
1538 NOT_NATIVES_CODE, false); | 1537 false); |
1539 if (function_info.is_null()) return false; | 1538 if (function_info.is_null()) return false; |
1540 cache->Add(name, function_info); | 1539 cache->Add(name, function_info); |
1541 } | 1540 } |
1542 | 1541 |
1543 // Set up the function context. Conceptually, we should clone the | 1542 // Set up the function context. Conceptually, we should clone the |
1544 // function before overwriting the context but since we're in a | 1543 // function before overwriting the context but since we're in a |
1545 // single-threaded environment it is not strictly necessary. | 1544 // single-threaded environment it is not strictly necessary. |
1546 Handle<JSFunction> fun = | 1545 Handle<JSFunction> fun = |
1547 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 1546 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
1548 | 1547 |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 return from + sizeof(NestingCounterType); | 3030 return from + sizeof(NestingCounterType); |
3032 } | 3031 } |
3033 | 3032 |
3034 | 3033 |
3035 // Called when the top-level V8 mutex is destroyed. | 3034 // Called when the top-level V8 mutex is destroyed. |
3036 void Bootstrapper::FreeThreadResources() { | 3035 void Bootstrapper::FreeThreadResources() { |
3037 DCHECK(!IsActive()); | 3036 DCHECK(!IsActive()); |
3038 } | 3037 } |
3039 | 3038 |
3040 } } // namespace v8::internal | 3039 } } // namespace v8::internal |
OLD | NEW |