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 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 | 1485 |
1486 | 1486 |
1487 bool Genesis::CompileNative(Isolate* isolate, Vector<const char> name, | 1487 bool Genesis::CompileNative(Isolate* isolate, Vector<const char> name, |
1488 Handle<String> source, int argc, | 1488 Handle<String> source, int argc, |
1489 Handle<Object> argv[]) { | 1489 Handle<Object> argv[]) { |
1490 SuppressDebug compiling_natives(isolate->debug()); | 1490 SuppressDebug compiling_natives(isolate->debug()); |
1491 // During genesis, the boilerplate for stack overflow won't work until the | 1491 // During genesis, the boilerplate for stack overflow won't work until the |
1492 // environment has been at least partially initialized. Add a stack check | 1492 // environment has been at least partially initialized. Add a stack check |
1493 // before entering JS code to catch overflow early. | 1493 // before entering JS code to catch overflow early. |
1494 StackLimitCheck check(isolate); | 1494 StackLimitCheck check(isolate); |
1495 if (check.HasOverflowed()) return false; | 1495 if (check.HasOverflowed()) { |
| 1496 isolate->StackOverflow(); |
| 1497 return false; |
| 1498 } |
1496 | 1499 |
1497 Handle<Context> context(isolate->context()); | 1500 Handle<Context> context(isolate->context()); |
1498 | 1501 |
1499 Handle<String> script_name = | 1502 Handle<String> script_name = |
1500 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); | 1503 isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); |
1501 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( | 1504 Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( |
1502 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), | 1505 source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), |
1503 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, | 1506 context, NULL, NULL, ScriptCompiler::kNoCompileOptions, NATIVES_CODE, |
1504 false); | 1507 false); |
1505 if (function_info.is_null()) return false; | 1508 if (function_info.is_null()) return false; |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); | 2965 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); |
2963 result_ = Handle<Context>::null(); | 2966 result_ = Handle<Context>::null(); |
2964 // Before creating the roots we must save the context and restore it | 2967 // Before creating the roots we must save the context and restore it |
2965 // on all function exits. | 2968 // on all function exits. |
2966 SaveContext saved_context(isolate); | 2969 SaveContext saved_context(isolate); |
2967 | 2970 |
2968 // During genesis, the boilerplate for stack overflow won't work until the | 2971 // During genesis, the boilerplate for stack overflow won't work until the |
2969 // environment has been at least partially initialized. Add a stack check | 2972 // environment has been at least partially initialized. Add a stack check |
2970 // before entering JS code to catch overflow early. | 2973 // before entering JS code to catch overflow early. |
2971 StackLimitCheck check(isolate); | 2974 StackLimitCheck check(isolate); |
2972 if (check.HasOverflowed()) return; | 2975 if (check.HasOverflowed()) { |
| 2976 isolate->StackOverflow(); |
| 2977 return; |
| 2978 } |
2973 | 2979 |
2974 // The deserializer needs to hook up references to the global proxy. | 2980 // The deserializer needs to hook up references to the global proxy. |
2975 // Create an uninitialized global proxy now if we don't have one | 2981 // Create an uninitialized global proxy now if we don't have one |
2976 // and initialize it later in CreateNewGlobals. | 2982 // and initialize it later in CreateNewGlobals. |
2977 Handle<JSGlobalProxy> global_proxy; | 2983 Handle<JSGlobalProxy> global_proxy; |
2978 if (!maybe_global_proxy.ToHandle(&global_proxy)) { | 2984 if (!maybe_global_proxy.ToHandle(&global_proxy)) { |
2979 global_proxy = isolate->factory()->NewUninitializedJSGlobalProxy(); | 2985 global_proxy = isolate->factory()->NewUninitializedJSGlobalProxy(); |
2980 } | 2986 } |
2981 | 2987 |
2982 // We can only de-serialize a context if the isolate was initialized from | 2988 // We can only de-serialize a context if the isolate was initialized from |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 return from + sizeof(NestingCounterType); | 3077 return from + sizeof(NestingCounterType); |
3072 } | 3078 } |
3073 | 3079 |
3074 | 3080 |
3075 // Called when the top-level V8 mutex is destroyed. | 3081 // Called when the top-level V8 mutex is destroyed. |
3076 void Bootstrapper::FreeThreadResources() { | 3082 void Bootstrapper::FreeThreadResources() { |
3077 DCHECK(!IsActive()); | 3083 DCHECK(!IsActive()); |
3078 } | 3084 } |
3079 | 3085 |
3080 } } // namespace v8::internal | 3086 } } // namespace v8::internal |
OLD | NEW |