[cleanup] Remove dead code for handling pre-desugaring spread implementation

The array spread operator is now handled by desugaring in the parser.

Review-Url: https://codereview.chromium.org/2324013002
Cr-Commit-Position: refs/heads/master@{#39317}
This commit is contained in:
adamk 2016-09-09 10:32:13 -07:00 committed by Commit bot
parent 39c9158f8e
commit ca7eaa30a1
11 changed files with 12 additions and 231 deletions

View File

@ -649,8 +649,7 @@ void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSlotCache* cache) {
// This logic that computes the number of slots needed for vector store
// ics must mirror FullCodeGenerator::VisitArrayLiteral.
int array_index = 0;
for (; array_index < values()->length(); array_index++) {
for (int array_index = 0; array_index < values()->length(); array_index++) {
Expression* subexpr = values()->at(array_index);
DCHECK(!subexpr->IsSpread());
if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;

View File

@ -1948,8 +1948,8 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
// Create nodes to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < expr->values()->length(); array_index++) {
for (int array_index = 0; array_index < expr->values()->length();
array_index++) {
Expression* subexpr = expr->values()->at(array_index);
DCHECK(!subexpr->IsSpread());
if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
@ -1964,26 +1964,6 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
OutputFrameStateCombine::Ignore());
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
for (; array_index < expr->values()->length(); array_index++) {
Expression* subexpr = expr->values()->at(array_index);
DCHECK(!subexpr->IsSpread());
VisitForValue(subexpr);
{
Node* value = environment()->Pop();
Node* array = environment()->Pop();
const Operator* op = javascript()->CallRuntime(Runtime::kAppendElement);
Node* result = NewNode(op, array, value);
PrepareFrameState(result, expr->GetIdForElement(array_index));
environment()->Push(result);
}
}
ast_context()->ProduceValue(expr, environment()->Pop());
}

View File

@ -1592,8 +1592,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1616,27 +1615,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(r0);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(r0);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1575,8 +1575,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1599,27 +1598,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(x0);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(x0);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1509,8 +1509,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1533,27 +1532,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(eax);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(eax);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1587,8 +1587,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1613,27 +1612,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(v0);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(v0);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1588,8 +1588,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1614,27 +1613,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(v0);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(v0);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1553,8 +1553,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
// If the subexpression is a literal or a simple materialized literal it
@ -1577,27 +1576,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(r3);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(r3);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1513,8 +1513,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
// If the subexpression is a literal or a simple materialized literal it
@ -1537,27 +1536,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(r2);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(r2);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1536,8 +1536,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1560,27 +1559,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(rax);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(rax);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1501,8 +1501,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
int array_index = 0;
for (; array_index < length; array_index++) {
for (int array_index = 0; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
DCHECK(!subexpr->IsSpread());
@ -1525,27 +1524,6 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
BailoutState::NO_REGISTERS);
}
// In case the array literal contains spread expressions it has two parts. The
// first part is the "static" array which has a literal index is handled
// 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.
if (array_index < length && result_saved) {
PopOperand(eax);
result_saved = false;
}
for (; array_index < length; array_index++) {
Expression* subexpr = subexprs->at(array_index);
PushOperand(eax);
DCHECK(!subexpr->IsSpread());
VisitForStackValue(subexpr);
CallRuntimeWithOperands(Runtime::kAppendElement);
PrepareForBailoutForId(expr->GetIdForElement(array_index),
BailoutState::NO_REGISTERS);
}
if (result_saved) {
context()->PlugTOS();
} else {