| Index: src/heap-inl.h | 
| diff --git a/src/heap-inl.h b/src/heap-inl.h | 
| index 18a2cf351b33f1eb2886fe8b8658519159a445b1..b71978baf545b42e3034c96d0c14e514e4cd42a9 100644 | 
| --- a/src/heap-inl.h | 
| +++ b/src/heap-inl.h | 
| @@ -872,6 +872,8 @@ bool EnterAllocationScope(Isolate* isolate, bool allow_allocation) { | 
| bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); | 
| bool last_state = isolate->heap()->IsAllocationAllowed(); | 
| if (active) { | 
| +    // TODO(yangguo): Make HandleDereferenceGuard avoid isolate mutation in the | 
| +    // same way if running on the optimizer thread. | 
| isolate->heap()->set_allow_allocation(allow_allocation); | 
| } | 
| return last_state; | 
| @@ -879,7 +881,10 @@ bool EnterAllocationScope(Isolate* isolate, bool allow_allocation) { | 
|  | 
|  | 
| void ExitAllocationScope(Isolate* isolate, bool last_state) { | 
| -  isolate->heap()->set_allow_allocation(last_state); | 
| +  bool active = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); | 
| +  if (active) { | 
| +    isolate->heap()->set_allow_allocation(last_state); | 
| +  } | 
| } | 
|  | 
|  | 
|  |