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

Unified Diff: src/compiler/instruction-selector.cc

Issue 1709583002: [turbofan] Fixing ES6 tail calls in Turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 4 years, 10 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 | « no previous file | test/mjsunit/es6/tail-call.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index 053c64605ba294377d4481687008074202a8f5d6..e52c831ca1dd94b99eb79191ac828b026e013c57 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -578,13 +578,29 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
size_t frame_state_entries = 0;
USE(frame_state_entries); // frame_state_entries is only used for debug.
if (buffer->frame_state_descriptor != nullptr) {
+ Node* frame_state =
+ call->InputAt(static_cast<int>(buffer->descriptor->InputCount()));
+
+ // If it was a syntactic tail call we need to drop the current frame and
+ // an arguments adaptor frame on top of it (if the latter is present).
+ if (buffer->descriptor->SupportsTailCalls()) {
+ frame_state = NodeProperties::GetFrameStateInput(frame_state, 0);
+ buffer->frame_state_descriptor =
+ buffer->frame_state_descriptor->outer_state();
+
+ if (buffer->frame_state_descriptor != nullptr &&
+ buffer->frame_state_descriptor->type() ==
+ FrameStateType::kArgumentsAdaptor) {
+ frame_state = NodeProperties::GetFrameStateInput(frame_state, 0);
+ buffer->frame_state_descriptor =
+ buffer->frame_state_descriptor->outer_state();
+ }
+ }
+
InstructionSequence::StateId state_id =
sequence()->AddFrameStateDescriptor(buffer->frame_state_descriptor);
buffer->instruction_args.push_back(g.TempImmediate(state_id.ToInt()));
- Node* frame_state =
- call->InputAt(static_cast<int>(buffer->descriptor->InputCount()));
-
StateObjectDeduplicator deduplicator(instruction_zone());
frame_state_entries =
« no previous file with comments | « no previous file | test/mjsunit/es6/tail-call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698