| Index: src/bootstrapper.cc
 | 
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
 | 
| index a48bb4df4d7502caae9ea4c0be2854921160a38f..d0e89c1cd7110be71fdfd75d358524423fdd825a 100644
 | 
| --- a/src/bootstrapper.cc
 | 
| +++ b/src/bootstrapper.cc
 | 
| @@ -1301,6 +1301,12 @@ bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) {
 | 
|  #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::Current());
 | 
| +  if (check.HasOverflowed()) return false;
 | 
| +
 | 
|    bool result = CompileScriptCached(name,
 | 
|                                      source,
 | 
|                                      NULL,
 | 
| @@ -1362,6 +1368,7 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
 | 
|                       ? top_context->builtins()
 | 
|                       : top_context->global());
 | 
|    bool has_pending_exception;
 | 
| +
 | 
|    Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
 | 
|    if (has_pending_exception) return false;
 | 
|    return true;
 | 
| 
 |