Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index c70dfbf65062f10110e56a468e21745e89659167..e4ccbbf22b68b0646f12d183e05bda3aad8439e9 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1939,7 +1939,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
int array_index = 0; |
for (; array_index < expr->values()->length(); array_index++) { |
Expression* subexpr = expr->values()->at(array_index); |
- if (subexpr->IsSpread()) break; |
+ DCHECK(!subexpr->IsSpread()); |
if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
VisitForValue(subexpr); |
@@ -1962,30 +1962,18 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
// 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); |
- Node* result; |
+ DCHECK(!subexpr->IsSpread()); |
- if (subexpr->IsSpread()) { |
- VisitForValue(subexpr->AsSpread()->expression()); |
- FrameStateBeforeAndAfter states(this, |
- subexpr->AsSpread()->expression()->id()); |
- Node* iterable = environment()->Pop(); |
- Node* array = environment()->Pop(); |
- Node* function = BuildLoadNativeContextField( |
- Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX); |
- result = NewNode(javascript()->CallFunction(3, language_mode()), function, |
- array, iterable); |
- states.AddToNode(result, expr->GetIdForElement(array_index)); |
- } else { |
- VisitForValue(subexpr); |
+ VisitForValue(subexpr); |
+ { |
Node* value = environment()->Pop(); |
Node* array = environment()->Pop(); |
const Operator* op = |
javascript()->CallRuntime(Runtime::kAppendElement, 2); |
- result = NewNode(op, array, value); |
+ Node* result = NewNode(op, array, value); |
PrepareFrameState(result, expr->GetIdForElement(array_index)); |
+ environment()->Push(result); |
} |
- |
- environment()->Push(result); |
} |
ast_context()->ProduceValue(environment()->Pop()); |