Chromium Code Reviews| Index: src/runtime/runtime-compiler.cc |
| diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc |
| index b5910e4d3b25740cf4c7fcba957451731ca5cb4f..ab1f0547ee0557620a197f583e9f37ac8b3fd455 100644 |
| --- a/src/runtime/runtime-compiler.cc |
| +++ b/src/runtime/runtime-compiler.cc |
| @@ -172,6 +172,17 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) { |
| DCHECK(optimized_code->kind() == Code::OPTIMIZED_FUNCTION); |
| DCHECK(type == deoptimizer->bailout_type()); |
| + DCHECK(isolate->context() == nullptr); |
|
Benedikt Meurer
2016/09/07 16:58:00
Nit: DCHECK_NULL
Michael Starzinger
2016/09/08 08:46:41
Done.
|
| + |
| + // TODO(turbofan): For Crankshaft we restore the context before objects are |
| + // being materialized, because it never de-materializes the context but it |
| + // requires a context to materialize arguments objects. This is specific to |
| + // Crankshaft and can be removed once only TurboFan goes through here. |
| + if (!optimized_code->is_turbofanned()) { |
| + JavaScriptFrameIterator top_it(isolate); |
| + JavaScriptFrame* top_frame = top_it.frame(); |
| + isolate->set_context(Context::cast(top_frame->context())); |
| + } |
| // Make sure to materialize objects before causing any allocation. |
| JavaScriptFrameIterator it(isolate); |
| @@ -179,9 +190,11 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) { |
| delete deoptimizer; |
| // Ensure the context register is updated for materialized objects. |
| - JavaScriptFrameIterator top_it(isolate); |
| - JavaScriptFrame* top_frame = top_it.frame(); |
| - isolate->set_context(Context::cast(top_frame->context())); |
| + if (optimized_code->is_turbofanned()) { |
| + JavaScriptFrameIterator top_it(isolate); |
| + JavaScriptFrame* top_frame = top_it.frame(); |
| + isolate->set_context(Context::cast(top_frame->context())); |
| + } |
| if (type == Deoptimizer::LAZY) { |
| return isolate->heap()->undefined_value(); |