OLD | NEW |
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/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 ast_context()->ProduceValue(literal); | 1718 ast_context()->ProduceValue(literal); |
1719 } | 1719 } |
1720 | 1720 |
1721 | 1721 |
1722 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1722 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1723 Node* closure = GetFunctionClosure(); | 1723 Node* closure = GetFunctionClosure(); |
1724 | 1724 |
1725 // Create node to deep-copy the literal boilerplate. | 1725 // Create node to deep-copy the literal boilerplate. |
1726 const Operator* op = javascript()->CreateLiteralObject( | 1726 const Operator* op = javascript()->CreateLiteralObject( |
1727 expr->constant_properties(), expr->ComputeFlags(true), | 1727 expr->constant_properties(), expr->ComputeFlags(true), |
1728 expr->literal_index()); | 1728 expr->literal_index(), expr->properties_count()); |
1729 Node* literal = NewNode(op, closure); | 1729 Node* literal = NewNode(op, closure); |
1730 PrepareFrameState(literal, expr->CreateLiteralId(), | 1730 PrepareFrameState(literal, expr->CreateLiteralId(), |
1731 OutputFrameStateCombine::Push()); | 1731 OutputFrameStateCombine::Push()); |
1732 | 1732 |
1733 // The object is expected on the operand stack during computation of the | 1733 // The object is expected on the operand stack during computation of the |
1734 // property values and is the value of the entire expression. | 1734 // property values and is the value of the entire expression. |
1735 environment()->Push(literal); | 1735 environment()->Push(literal); |
1736 | 1736 |
1737 // Create nodes to store computed values into the literal. | 1737 // Create nodes to store computed values into the literal. |
1738 int property_index = 0; | 1738 int property_index = 0; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 } | 1921 } |
1922 } | 1922 } |
1923 | 1923 |
1924 | 1924 |
1925 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1925 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1926 Node* closure = GetFunctionClosure(); | 1926 Node* closure = GetFunctionClosure(); |
1927 | 1927 |
1928 // Create node to deep-copy the literal boilerplate. | 1928 // Create node to deep-copy the literal boilerplate. |
1929 const Operator* op = javascript()->CreateLiteralArray( | 1929 const Operator* op = javascript()->CreateLiteralArray( |
1930 expr->constant_elements(), expr->ComputeFlags(true), | 1930 expr->constant_elements(), expr->ComputeFlags(true), |
1931 expr->literal_index()); | 1931 expr->literal_index(), expr->values()->length()); |
1932 Node* literal = NewNode(op, closure); | 1932 Node* literal = NewNode(op, closure); |
1933 PrepareFrameState(literal, expr->CreateLiteralId(), | 1933 PrepareFrameState(literal, expr->CreateLiteralId(), |
1934 OutputFrameStateCombine::Push()); | 1934 OutputFrameStateCombine::Push()); |
1935 | 1935 |
1936 // The array is expected on the operand stack during computation of the | 1936 // The array is expected on the operand stack during computation of the |
1937 // element values. | 1937 // element values. |
1938 environment()->Push(literal); | 1938 environment()->Push(literal); |
1939 | 1939 |
1940 // Create nodes to evaluate all the non-constant subexpressions and to store | 1940 // Create nodes to evaluate all the non-constant subexpressions and to store |
1941 // them into the newly cloned array. | 1941 // them into the newly cloned array. |
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4339 // Phi does not exist yet, introduce one. | 4339 // Phi does not exist yet, introduce one. |
4340 value = NewPhi(inputs, value, control); | 4340 value = NewPhi(inputs, value, control); |
4341 value->ReplaceInput(inputs - 1, other); | 4341 value->ReplaceInput(inputs - 1, other); |
4342 } | 4342 } |
4343 return value; | 4343 return value; |
4344 } | 4344 } |
4345 | 4345 |
4346 } // namespace compiler | 4346 } // namespace compiler |
4347 } // namespace internal | 4347 } // namespace internal |
4348 } // namespace v8 | 4348 } // namespace v8 |
OLD | NEW |