| Index: src/api.cc
 | 
| diff --git a/src/api.cc b/src/api.cc
 | 
| index b1d133abf916290f8c35078b0138431478350f71..1c349b561bf844608da4f2b61da5a12dd56b2b0e 100644
 | 
| --- a/src/api.cc
 | 
| +++ b/src/api.cc
 | 
| @@ -95,6 +95,11 @@ namespace v8 {
 | 
|          (isolate)->handle_scope_implementer();                                 \
 | 
|      handle_scope_implementer->DecrementCallDepth();                            \
 | 
|      if (has_pending_exception) {                                               \
 | 
| +      if (handle_scope_implementer->CallDepthIsZero() &&                       \
 | 
| +          (isolate)->is_out_of_memory()) {                                     \
 | 
| +        if (!(isolate)->ignore_out_of_memory())                                \
 | 
| +          i::V8::FatalProcessOutOfMemory(NULL);                                \
 | 
| +      }                                                                        \
 | 
|        bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero();   \
 | 
|        (isolate)->OptionalRescheduleException(call_depth_is_zero);              \
 | 
|        do_callback                                                              \
 | 
| @@ -5256,6 +5261,12 @@ Handle<Value> v8::Context::GetSecurityToken() {
 | 
|  }
 | 
|  
 | 
|  
 | 
| +bool Context::HasOutOfMemoryException() {
 | 
| +  i::Handle<i::Context> env = Utils::OpenHandle(this);
 | 
| +  return env->has_out_of_memory();
 | 
| +}
 | 
| +
 | 
| +
 | 
|  v8::Isolate* Context::GetIsolate() {
 | 
|    i::Handle<i::Context> env = Utils::OpenHandle(this);
 | 
|    return reinterpret_cast<Isolate*>(env->GetIsolate());
 | 
| @@ -6214,6 +6225,11 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| +void V8::IgnoreOutOfMemoryException() {
 | 
| +  EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
 | 
| +}
 | 
| +
 | 
| +
 | 
|  bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
 | 
|    i::Isolate* isolate = i::Isolate::Current();
 | 
|    EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
 | 
| 
 |