Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1194)

Unified Diff: src/runtime/runtime-compiler.cc

Issue 2320673002: [deoptimizer] Clear context before NotifyDeoptimized. (Closed)
Patch Set: Addressed comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/deoptimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-compiler.cc
diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc
index b5910e4d3b25740cf4c7fcba957451731ca5cb4f..1bce3297c1e09d5806544ea30c9950aa96a30059 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_NULL(isolate->context());
+
+ // 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();
« no previous file with comments | « src/deoptimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698