| 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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 ast_context()->ProduceValue(literal); | 1696 ast_context()->ProduceValue(literal); |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 | 1699 |
| 1700 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1700 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
| 1701 Node* closure = GetFunctionClosure(); | 1701 Node* closure = GetFunctionClosure(); |
| 1702 | 1702 |
| 1703 // Create node to deep-copy the literal boilerplate. | 1703 // Create node to deep-copy the literal boilerplate. |
| 1704 Node* literals_array = | 1704 Node* literals_array = |
| 1705 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1705 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 1706 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1706 const Operator* op = javascript()->CreateLiteralObject( |
| 1707 Node* constants = jsgraph()->Constant(expr->constant_properties()); | 1707 expr->constant_properties(), expr->ComputeFlags(true), |
| 1708 const Operator* op = | 1708 expr->literal_index()); |
| 1709 javascript()->CreateLiteralObject(expr->ComputeFlags(true)); | 1709 Node* literal = NewNode(op, literals_array); |
| 1710 Node* literal = NewNode(op, literals_array, literal_index, constants); | |
| 1711 PrepareFrameState(literal, expr->CreateLiteralId(), | 1710 PrepareFrameState(literal, expr->CreateLiteralId(), |
| 1712 OutputFrameStateCombine::Push()); | 1711 OutputFrameStateCombine::Push()); |
| 1713 | 1712 |
| 1714 // The object is expected on the operand stack during computation of the | 1713 // The object is expected on the operand stack during computation of the |
| 1715 // property values and is the value of the entire expression. | 1714 // property values and is the value of the entire expression. |
| 1716 environment()->Push(literal); | 1715 environment()->Push(literal); |
| 1717 | 1716 |
| 1718 // Create nodes to store computed values into the literal. | 1717 // Create nodes to store computed values into the literal. |
| 1719 int property_index = 0; | 1718 int property_index = 0; |
| 1720 AccessorTable accessor_table(local_zone()); | 1719 AccessorTable accessor_table(local_zone()); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 } | 1901 } |
| 1903 } | 1902 } |
| 1904 | 1903 |
| 1905 | 1904 |
| 1906 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1905 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| 1907 Node* closure = GetFunctionClosure(); | 1906 Node* closure = GetFunctionClosure(); |
| 1908 | 1907 |
| 1909 // Create node to deep-copy the literal boilerplate. | 1908 // Create node to deep-copy the literal boilerplate. |
| 1910 Node* literals_array = | 1909 Node* literals_array = |
| 1911 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1910 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 1912 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1911 const Operator* op = javascript()->CreateLiteralArray( |
| 1913 Node* constants = jsgraph()->Constant(expr->constant_elements()); | 1912 expr->constant_elements(), expr->ComputeFlags(true), |
| 1914 const Operator* op = | 1913 expr->literal_index()); |
| 1915 javascript()->CreateLiteralArray(expr->ComputeFlags(true)); | 1914 Node* literal = NewNode(op, literals_array); |
| 1916 Node* literal = NewNode(op, literals_array, literal_index, constants); | |
| 1917 PrepareFrameState(literal, expr->CreateLiteralId(), | 1915 PrepareFrameState(literal, expr->CreateLiteralId(), |
| 1918 OutputFrameStateCombine::Push()); | 1916 OutputFrameStateCombine::Push()); |
| 1919 | 1917 |
| 1920 // The array is expected on the operand stack during computation of the | 1918 // The array is expected on the operand stack during computation of the |
| 1921 // element values. | 1919 // element values. |
| 1922 environment()->Push(literal); | 1920 environment()->Push(literal); |
| 1923 | 1921 |
| 1924 // Create nodes to evaluate all the non-constant subexpressions and to store | 1922 // Create nodes to evaluate all the non-constant subexpressions and to store |
| 1925 // them into the newly cloned array. | 1923 // them into the newly cloned array. |
| 1926 int array_index = 0; | 1924 int array_index = 0; |
| (...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4307 // Phi does not exist yet, introduce one. | 4305 // Phi does not exist yet, introduce one. |
| 4308 value = NewPhi(inputs, value, control); | 4306 value = NewPhi(inputs, value, control); |
| 4309 value->ReplaceInput(inputs - 1, other); | 4307 value->ReplaceInput(inputs - 1, other); |
| 4310 } | 4308 } |
| 4311 return value; | 4309 return value; |
| 4312 } | 4310 } |
| 4313 | 4311 |
| 4314 } // namespace compiler | 4312 } // namespace compiler |
| 4315 } // namespace internal | 4313 } // namespace internal |
| 4316 } // namespace v8 | 4314 } // namespace v8 |
| OLD | NEW |