[compiler] No need to push literal index in VisitArrayLiteral.
The literal index is being pushed onto the stack while evaluating the non-constant subexpressions, but never used in fullcodegen (and hence not used in the optimizing compilers). R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/1471893003 Cr-Commit-Position: refs/heads/master@{#32205}
This commit is contained in:
parent
a19f2d7eca
commit
9846f386f0
@ -1929,10 +1929,9 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
PrepareFrameState(literal, expr->CreateLiteralId(),
|
PrepareFrameState(literal, expr->CreateLiteralId(),
|
||||||
OutputFrameStateCombine::Push());
|
OutputFrameStateCombine::Push());
|
||||||
|
|
||||||
// The array and the literal index are both expected on the operand stack
|
// The array is expected on the operand stack during computation of the
|
||||||
// during computation of the element values.
|
// element values.
|
||||||
environment()->Push(literal);
|
environment()->Push(literal);
|
||||||
environment()->Push(literal_index);
|
|
||||||
|
|
||||||
// Create nodes to evaluate all the non-constant subexpressions and to store
|
// Create nodes to evaluate all the non-constant subexpressions and to store
|
||||||
// them into the newly cloned array.
|
// them into the newly cloned array.
|
||||||
@ -1948,7 +1947,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot());
|
VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot());
|
||||||
Node* value = environment()->Pop();
|
Node* value = environment()->Pop();
|
||||||
Node* index = jsgraph()->Constant(array_index);
|
Node* index = jsgraph()->Constant(array_index);
|
||||||
Node* literal = environment()->Peek(1);
|
Node* literal = environment()->Top();
|
||||||
Node* store = BuildKeyedStore(literal, index, value, pair);
|
Node* store = BuildKeyedStore(literal, index, value, pair);
|
||||||
states.AddToNode(store, expr->GetIdForElement(array_index),
|
states.AddToNode(store, expr->GetIdForElement(array_index),
|
||||||
OutputFrameStateCombine::Ignore());
|
OutputFrameStateCombine::Ignore());
|
||||||
@ -1960,7 +1959,6 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// above. The second part is the part after the first spread expression
|
// above. The second part is the part after the first spread expression
|
||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
environment()->Pop(); // Array literal index.
|
|
||||||
for (; array_index < expr->values()->length(); array_index++) {
|
for (; array_index < expr->values()->length(); array_index++) {
|
||||||
Expression* subexpr = expr->values()->at(array_index);
|
Expression* subexpr = expr->values()->at(array_index);
|
||||||
Node* result;
|
Node* result;
|
||||||
|
@ -6074,8 +6074,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// The array is expected in the bailout environment during computation
|
// The array is expected in the bailout environment during computation
|
||||||
// of the property values and is the value of the entire expression.
|
// of the property values and is the value of the entire expression.
|
||||||
Push(literal);
|
Push(literal);
|
||||||
// The literal index is on the stack, too.
|
|
||||||
Push(Add<HConstant>(expr->literal_index()));
|
|
||||||
|
|
||||||
HInstruction* elements = NULL;
|
HInstruction* elements = NULL;
|
||||||
|
|
||||||
@ -6117,7 +6115,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
Add<HSimulate>(expr->GetIdForElement(i));
|
Add<HSimulate>(expr->GetIdForElement(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
Drop(1); // array literal index
|
|
||||||
return ast_context()->ReturnValue(Pop());
|
return ast_context()->ReturnValue(Pop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,13 +1768,12 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ push(r0);
|
__ push(r0);
|
||||||
__ Push(Smi::FromInt(expr->literal_index()));
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ mov(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
__ mov(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
||||||
__ ldr(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize));
|
__ ldr(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
||||||
@ -1789,7 +1788,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ pop(); // literal index
|
|
||||||
__ Pop(r0);
|
__ Pop(r0);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1810,7 +1808,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ pop(); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(r0);
|
context()->Plug(r0);
|
||||||
|
@ -1750,14 +1750,13 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
|
if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
|
||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ Mov(x1, Smi::FromInt(expr->literal_index()));
|
__ Push(x0);
|
||||||
__ Push(x0, x1);
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ Mov(StoreDescriptor::NameRegister(), Smi::FromInt(array_index));
|
__ Mov(StoreDescriptor::NameRegister(), Smi::FromInt(array_index));
|
||||||
__ Peek(StoreDescriptor::ReceiverRegister(), kPointerSize);
|
__ Peek(StoreDescriptor::ReceiverRegister(), 0);
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
||||||
@ -1772,7 +1771,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
__ Pop(x0);
|
__ Pop(x0);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1793,7 +1791,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(x0);
|
context()->Plug(x0);
|
||||||
|
@ -1690,14 +1690,13 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ push(eax); // array literal.
|
__ push(eax); // array literal.
|
||||||
__ push(Immediate(Smi::FromInt(expr->literal_index())));
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ mov(StoreDescriptor::NameRegister(),
|
__ mov(StoreDescriptor::NameRegister(),
|
||||||
Immediate(Smi::FromInt(array_index)));
|
Immediate(Smi::FromInt(array_index)));
|
||||||
__ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, kPointerSize));
|
__ mov(StoreDescriptor::ReceiverRegister(), Operand(esp, 0));
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
||||||
@ -1711,7 +1710,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
__ Pop(eax);
|
__ Pop(eax);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1732,7 +1730,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(eax);
|
context()->Plug(eax);
|
||||||
|
@ -1764,14 +1764,13 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ push(v0); // array literal
|
__ push(v0); // array literal
|
||||||
__ Push(Smi::FromInt(expr->literal_index()));
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
__ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
||||||
__ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize));
|
__ lw(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
||||||
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
@ -1787,7 +1786,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ Pop(); // literal index
|
|
||||||
__ Pop(v0);
|
__ Pop(v0);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1808,7 +1806,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ Pop(); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(v0);
|
context()->Plug(v0);
|
||||||
|
@ -1764,14 +1764,13 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ push(v0); // array literal
|
__ push(v0); // array literal
|
||||||
__ Push(Smi::FromInt(expr->literal_index()));
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
__ li(StoreDescriptor::NameRegister(), Operand(Smi::FromInt(array_index)));
|
||||||
__ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, kPointerSize));
|
__ ld(StoreDescriptor::ReceiverRegister(), MemOperand(sp, 0));
|
||||||
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
__ mov(StoreDescriptor::ValueRegister(), result_register());
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
@ -1787,7 +1786,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ Pop(); // literal index
|
|
||||||
__ Pop(v0);
|
__ Pop(v0);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1808,7 +1806,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ Pop(); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(v0);
|
context()->Plug(v0);
|
||||||
|
@ -1715,13 +1715,12 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
|
|
||||||
if (!result_saved) {
|
if (!result_saved) {
|
||||||
__ Push(rax); // array literal
|
__ Push(rax); // array literal
|
||||||
__ Push(Smi::FromInt(expr->literal_index()));
|
|
||||||
result_saved = true;
|
result_saved = true;
|
||||||
}
|
}
|
||||||
VisitForAccumulatorValue(subexpr);
|
VisitForAccumulatorValue(subexpr);
|
||||||
|
|
||||||
__ Move(StoreDescriptor::NameRegister(), Smi::FromInt(array_index));
|
__ Move(StoreDescriptor::NameRegister(), Smi::FromInt(array_index));
|
||||||
__ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, kPointerSize));
|
__ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0));
|
||||||
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
EmitLoadStoreICSlot(expr->LiteralFeedbackSlot());
|
||||||
Handle<Code> ic =
|
Handle<Code> ic =
|
||||||
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
|
||||||
@ -1736,7 +1735,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
// (inclusive) and these elements gets appended to the array. Note that the
|
// (inclusive) and these elements gets appended to the array. Note that the
|
||||||
// number elements an iterable produces is unknown ahead of time.
|
// number elements an iterable produces is unknown ahead of time.
|
||||||
if (array_index < length && result_saved) {
|
if (array_index < length && result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
__ Pop(rax);
|
__ Pop(rax);
|
||||||
result_saved = false;
|
result_saved = false;
|
||||||
}
|
}
|
||||||
@ -1757,7 +1755,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result_saved) {
|
if (result_saved) {
|
||||||
__ Drop(1); // literal index
|
|
||||||
context()->PlugTOS();
|
context()->PlugTOS();
|
||||||
} else {
|
} else {
|
||||||
context()->Plug(rax);
|
context()->Plug(rax);
|
||||||
|
Loading…
Reference in New Issue
Block a user