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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1471893003: [compiler] No need to push literal index in VisitArrayLiteral. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment Created 5 years, 1 month 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 | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 0128e4622d462936c22cc451967d1002539cc2d2..ac72ee3576b66a3db2834a28866a8642521fe3d2 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1917,10 +1917,9 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
PrepareFrameState(literal, expr->CreateLiteralId(),
OutputFrameStateCombine::Push());
- // The array and the literal index are both expected on the operand stack
- // during computation of the element values.
+ // The array is expected on the operand stack during computation of the
+ // element values.
environment()->Push(literal);
- environment()->Push(literal_index);
// Create nodes to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
@@ -1936,7 +1935,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot());
Node* value = environment()->Pop();
Node* index = jsgraph()->Constant(array_index);
- Node* literal = environment()->Peek(1);
+ Node* literal = environment()->Top();
Node* store = BuildKeyedStore(literal, index, value, pair);
states.AddToNode(store, expr->GetIdForElement(array_index),
OutputFrameStateCombine::Ignore());
@@ -1948,7 +1947,6 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
// above. The second part is the part after the first spread expression
// (inclusive) and these elements gets appended to the array. Note that the
// number elements an iterable produces is unknown ahead of time.
- environment()->Pop(); // Array literal index.
for (; array_index < expr->values()->length(); array_index++) {
Expression* subexpr = expr->values()->at(array_index);
Node* result;
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698