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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 // environment has been at least partially initialized. Add a stack check | 1486 // environment has been at least partially initialized. Add a stack check |
1487 // before entering JS code to catch overflow early. | 1487 // before entering JS code to catch overflow early. |
1488 StackLimitCheck check(isolate); | 1488 StackLimitCheck check(isolate); |
1489 if (check.HasOverflowed()) return false; | 1489 if (check.HasOverflowed()) return false; |
1490 | 1490 |
1491 Handle<Context> context(isolate->context()); | 1491 Handle<Context> context(isolate->context()); |
1492 | 1492 |
1493 Handle<String> script_name = | 1493 Handle<String> script_name = |
1494 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); | 1494 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); |
1495 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( | 1495 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( |
1496 source, script_name, 0, 0, false, false, Handle<Object>(), context, NULL, | 1496 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), |
1497 NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, false); | 1497 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, |
| 1498 false); |
1498 if (function_info.is_null()) return false; | 1499 if (function_info.is_null()) return false; |
1499 | 1500 |
1500 DCHECK(context->IsNativeContext()); | 1501 DCHECK(context->IsNativeContext()); |
1501 | 1502 |
1502 Handle<Context> runtime_context(context->runtime_context()); | 1503 Handle<Context> runtime_context(context->runtime_context()); |
1503 Handle<JSBuiltinsObject> receiver(context->builtins()); | 1504 Handle<JSBuiltinsObject> receiver(context->builtins()); |
1504 Handle<JSFunction> fun = | 1505 Handle<JSFunction> fun = |
1505 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, | 1506 isolate->factory()->NewFunctionFromSharedFunctionInfo(function_info, |
1506 runtime_context); | 1507 runtime_context); |
1507 | 1508 |
(...skipping 23 matching lines...) Expand all Loading... |
1531 // function and insert it into the cache. | 1532 // function and insert it into the cache. |
1532 Vector<const char> name = CStrVector(extension->name()); | 1533 Vector<const char> name = CStrVector(extension->name()); |
1533 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); | 1534 SourceCodeCache* cache = isolate->bootstrapper()->extensions_cache(); |
1534 Handle<Context> context(isolate->context()); | 1535 Handle<Context> context(isolate->context()); |
1535 DCHECK(context->IsNativeContext()); | 1536 DCHECK(context->IsNativeContext()); |
1536 | 1537 |
1537 if (!cache->Lookup(name, &function_info)) { | 1538 if (!cache->Lookup(name, &function_info)) { |
1538 Handle<String> script_name = | 1539 Handle<String> script_name = |
1539 factory->NewStringFromUtf8(name).ToHandleChecked(); | 1540 factory->NewStringFromUtf8(name).ToHandleChecked(); |
1540 function_info = Compiler::CompileScript( | 1541 function_info = Compiler::CompileScript( |
1541 source, script_name, 0, 0, false, false, Handle<Object>(), context, | 1542 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), |
1542 extension, NULL, ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, | 1543 context, extension, NULL, ScriptCompiler::kNoCompileOptions, |
1543 false); | 1544 NOT_NATIVES_CODE, false); |
1544 if (function_info.is_null()) return false; | 1545 if (function_info.is_null()) return false; |
1545 cache->Add(name, function_info); | 1546 cache->Add(name, function_info); |
1546 } | 1547 } |
1547 | 1548 |
1548 // Set up the function context. Conceptually, we should clone the | 1549 // Set up the function context. Conceptually, we should clone the |
1549 // function before overwriting the context but since we're in a | 1550 // function before overwriting the context but since we're in a |
1550 // single-threaded environment it is not strictly necessary. | 1551 // single-threaded environment it is not strictly necessary. |
1551 Handle<JSFunction> fun = | 1552 Handle<JSFunction> fun = |
1552 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 1553 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
1553 | 1554 |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 return from + sizeof(NestingCounterType); | 3037 return from + sizeof(NestingCounterType); |
3037 } | 3038 } |
3038 | 3039 |
3039 | 3040 |
3040 // Called when the top-level V8 mutex is destroyed. | 3041 // Called when the top-level V8 mutex is destroyed. |
3041 void Bootstrapper::FreeThreadResources() { | 3042 void Bootstrapper::FreeThreadResources() { |
3042 DCHECK(!IsActive()); | 3043 DCHECK(!IsActive()); |
3043 } | 3044 } |
3044 | 3045 |
3045 } } // namespace v8::internal | 3046 } } // namespace v8::internal |
OLD | NEW |