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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 2324013002: [cleanup] Remove dead code for handling pre-desugaring spread implementation (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/ast/ast.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 Node* literal = NewNode(op, closure); 1941 Node* literal = NewNode(op, closure);
1942 PrepareFrameState(literal, expr->CreateLiteralId(), 1942 PrepareFrameState(literal, expr->CreateLiteralId(),
1943 OutputFrameStateCombine::Push()); 1943 OutputFrameStateCombine::Push());
1944 1944
1945 // The array is expected on the operand stack during computation of the 1945 // The array is expected on the operand stack during computation of the
1946 // element values. 1946 // element values.
1947 environment()->Push(literal); 1947 environment()->Push(literal);
1948 1948
1949 // Create nodes to evaluate all the non-constant subexpressions and to store 1949 // Create nodes to evaluate all the non-constant subexpressions and to store
1950 // them into the newly cloned array. 1950 // them into the newly cloned array.
1951 int array_index = 0; 1951 for (int array_index = 0; array_index < expr->values()->length();
1952 for (; array_index < expr->values()->length(); array_index++) { 1952 array_index++) {
1953 Expression* subexpr = expr->values()->at(array_index); 1953 Expression* subexpr = expr->values()->at(array_index);
1954 DCHECK(!subexpr->IsSpread()); 1954 DCHECK(!subexpr->IsSpread());
1955 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; 1955 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
1956 1956
1957 VisitForValue(subexpr); 1957 VisitForValue(subexpr);
1958 VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot()); 1958 VectorSlotPair pair = CreateVectorSlotPair(expr->LiteralFeedbackSlot());
1959 Node* value = environment()->Pop(); 1959 Node* value = environment()->Pop();
1960 Node* index = jsgraph()->Constant(array_index); 1960 Node* index = jsgraph()->Constant(array_index);
1961 Node* literal = environment()->Top(); 1961 Node* literal = environment()->Top();
1962 Node* store = BuildKeyedStore(literal, index, value, pair); 1962 Node* store = BuildKeyedStore(literal, index, value, pair);
1963 PrepareFrameState(store, expr->GetIdForElement(array_index), 1963 PrepareFrameState(store, expr->GetIdForElement(array_index),
1964 OutputFrameStateCombine::Ignore()); 1964 OutputFrameStateCombine::Ignore());
1965 } 1965 }
1966 1966
1967 // In case the array literal contains spread expressions it has two parts. The
1968 // first part is the "static" array which has a literal index is handled
1969 // above. The second part is the part after the first spread expression
1970 // (inclusive) and these elements gets appended to the array. Note that the
1971 // number elements an iterable produces is unknown ahead of time.
1972 for (; array_index < expr->values()->length(); array_index++) {
1973 Expression* subexpr = expr->values()->at(array_index);
1974 DCHECK(!subexpr->IsSpread());
1975
1976 VisitForValue(subexpr);
1977 {
1978 Node* value = environment()->Pop();
1979 Node* array = environment()->Pop();
1980 const Operator* op = javascript()->CallRuntime(Runtime::kAppendElement);
1981 Node* result = NewNode(op, array, value);
1982 PrepareFrameState(result, expr->GetIdForElement(array_index));
1983 environment()->Push(result);
1984 }
1985 }
1986
1987 ast_context()->ProduceValue(expr, environment()->Pop()); 1967 ast_context()->ProduceValue(expr, environment()->Pop());
1988 } 1968 }
1989 1969
1990 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value, 1970 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value,
1991 const VectorSlotPair& feedback, 1971 const VectorSlotPair& feedback,
1992 BailoutId bailout_id) { 1972 BailoutId bailout_id) {
1993 DCHECK(expr->IsValidReferenceExpressionOrThis()); 1973 DCHECK(expr->IsValidReferenceExpressionOrThis());
1994 1974
1995 // Left-hand side can only be a property, a global or a variable slot. 1975 // Left-hand side can only be a property, a global or a variable slot.
1996 Property* property = expr->AsProperty(); 1976 Property* property = expr->AsProperty();
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 // Phi does not exist yet, introduce one. 4309 // Phi does not exist yet, introduce one.
4330 value = NewPhi(inputs, value, control); 4310 value = NewPhi(inputs, value, control);
4331 value->ReplaceInput(inputs - 1, other); 4311 value->ReplaceInput(inputs - 1, other);
4332 } 4312 }
4333 return value; 4313 return value;
4334 } 4314 }
4335 4315
4336 } // namespace compiler 4316 } // namespace compiler
4337 } // namespace internal 4317 } // namespace internal
4338 } // namespace v8 4318 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698