Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 298652e0f9f92e159a62496db493869f161c4e2b..0e95b4b83974334a6419cabc95e600877def9a2b 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -2295,6 +2295,12 @@ Genesis::Genesis(Isolate* isolate, |
HandleScope scope; |
SaveContext saved_context(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. |
+ StackLimitCheck check(Isolate::Current()); |
+ if (check.HasOverflowed()) return; |
+ |
Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); |
if (!new_context.is_null()) { |
global_context_ = |