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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); | 1706 Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); |
1707 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); | 1707 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
1708 ast_context()->ProduceValue(literal); | 1708 ast_context()->ProduceValue(literal); |
1709 } | 1709 } |
1710 | 1710 |
1711 | 1711 |
1712 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1712 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1713 Node* closure = GetFunctionClosure(); | 1713 Node* closure = GetFunctionClosure(); |
1714 | 1714 |
1715 // Create node to deep-copy the literal boilerplate. | 1715 // Create node to deep-copy the literal boilerplate. |
1716 Node* literals_array = | |
1717 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | |
1718 const Operator* op = javascript()->CreateLiteralObject( | 1716 const Operator* op = javascript()->CreateLiteralObject( |
1719 expr->constant_properties(), expr->ComputeFlags(true), | 1717 expr->constant_properties(), expr->ComputeFlags(true), |
1720 expr->literal_index()); | 1718 expr->literal_index()); |
1721 Node* literal = NewNode(op, literals_array); | 1719 Node* literal = NewNode(op, closure); |
1722 PrepareFrameState(literal, expr->CreateLiteralId(), | 1720 PrepareFrameState(literal, expr->CreateLiteralId(), |
1723 OutputFrameStateCombine::Push()); | 1721 OutputFrameStateCombine::Push()); |
1724 | 1722 |
1725 // The object is expected on the operand stack during computation of the | 1723 // The object is expected on the operand stack during computation of the |
1726 // property values and is the value of the entire expression. | 1724 // property values and is the value of the entire expression. |
1727 environment()->Push(literal); | 1725 environment()->Push(literal); |
1728 | 1726 |
1729 // Create nodes to store computed values into the literal. | 1727 // Create nodes to store computed values into the literal. |
1730 int property_index = 0; | 1728 int property_index = 0; |
1731 AccessorTable accessor_table(local_zone()); | 1729 AccessorTable accessor_table(local_zone()); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 VisitForValue(property->value()); | 1909 VisitForValue(property->value()); |
1912 BuildSetHomeObject(environment()->Top(), home_object, property); | 1910 BuildSetHomeObject(environment()->Top(), home_object, property); |
1913 } | 1911 } |
1914 } | 1912 } |
1915 | 1913 |
1916 | 1914 |
1917 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1915 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1918 Node* closure = GetFunctionClosure(); | 1916 Node* closure = GetFunctionClosure(); |
1919 | 1917 |
1920 // Create node to deep-copy the literal boilerplate. | 1918 // Create node to deep-copy the literal boilerplate. |
1921 Node* literals_array = | |
1922 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | |
1923 const Operator* op = javascript()->CreateLiteralArray( | 1919 const Operator* op = javascript()->CreateLiteralArray( |
1924 expr->constant_elements(), expr->ComputeFlags(true), | 1920 expr->constant_elements(), expr->ComputeFlags(true), |
1925 expr->literal_index()); | 1921 expr->literal_index()); |
1926 Node* literal = NewNode(op, literals_array); | 1922 Node* literal = NewNode(op, closure); |
1927 PrepareFrameState(literal, expr->CreateLiteralId(), | 1923 PrepareFrameState(literal, expr->CreateLiteralId(), |
1928 OutputFrameStateCombine::Push()); | 1924 OutputFrameStateCombine::Push()); |
1929 | 1925 |
1930 // The array is expected on the operand stack during computation of the | 1926 // The array is expected on the operand stack during computation of the |
1931 // element values. | 1927 // element values. |
1932 environment()->Push(literal); | 1928 environment()->Push(literal); |
1933 | 1929 |
1934 // Create nodes to evaluate all the non-constant subexpressions and to store | 1930 // Create nodes to evaluate all the non-constant subexpressions and to store |
1935 // them into the newly cloned array. | 1931 // them into the newly cloned array. |
1936 int array_index = 0; | 1932 int array_index = 0; |
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4314 // Phi does not exist yet, introduce one. | 4310 // Phi does not exist yet, introduce one. |
4315 value = NewPhi(inputs, value, control); | 4311 value = NewPhi(inputs, value, control); |
4316 value->ReplaceInput(inputs - 1, other); | 4312 value->ReplaceInput(inputs - 1, other); |
4317 } | 4313 } |
4318 return value; | 4314 return value; |
4319 } | 4315 } |
4320 | 4316 |
4321 } // namespace compiler | 4317 } // namespace compiler |
4322 } // namespace internal | 4318 } // namespace internal |
4323 } // namespace v8 | 4319 } // namespace v8 |
OLD | NEW |