Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index ce625b7495a33dc015907298f841ae51ee06001a..6496e2629cb29415d364875d368d884777369c03 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -1476,6 +1476,11 @@ bool Genesis::CompileNative(Isolate* isolate, |
#ifdef ENABLE_DEBUGGER_SUPPORT |
isolate->debugger()->set_compiling_natives(true); |
#endif |
+ // During genesis, the boilerplate for stack overflow won't work until the |
+ // environment has been at least partially initialized. Add a stack check |
+ // before entering JS code to catch overflow early. |
+ StackLimitCheck check(isolate); |
+ if (check.HasOverflowed()) return false; |
bool result = CompileScriptCached(isolate, |
name, |
@@ -2609,16 +2614,8 @@ Genesis::Genesis(Isolate* isolate, |
// During genesis, the boilerplate for stack overflow won't work until the |
// environment has been at least partially initialized. Add a stack check |
// before entering JS code to catch overflow early. |
- const uint32_t stack_to_get_through_genesis = 3500 * sizeof(intptr_t); |
StackLimitCheck check(isolate); |
- if (check.WillOverflow(stack_to_get_through_genesis)) { |
- // Only raise a StackOverflow if there is a valid current context |
- if (isolate->context() != NULL) { |
- isolate->StackOverflow(); |
- isolate->OptionalRescheduleException(true); |
- } |
- return; |
- } |
+ if (check.HasOverflowed()) return; |
// We can only de-serialize a context if the isolate was initialized from |
// a snapshot. Otherwise we have to build the context from scratch. |