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/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 | 1620 |
1621 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1621 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1622 Node* closure = GetFunctionClosure(); | 1622 Node* closure = GetFunctionClosure(); |
1623 | 1623 |
1624 // Create node to deep-copy the literal boilerplate. | 1624 // Create node to deep-copy the literal boilerplate. |
1625 expr->BuildConstantProperties(isolate()); | 1625 expr->BuildConstantProperties(isolate()); |
1626 Node* literals_array = | 1626 Node* literals_array = |
1627 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1627 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
1628 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1628 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
1629 Node* constants = jsgraph()->Constant(expr->constant_properties()); | 1629 Node* constants = jsgraph()->Constant(expr->constant_properties()); |
1630 Node* flags = jsgraph()->Constant(expr->ComputeFlags()); | 1630 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true)); |
1631 const Operator* op = | 1631 const Operator* op = |
1632 javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1632 javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1633 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); | 1633 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
1634 PrepareFrameState(literal, expr->CreateLiteralId(), | 1634 PrepareFrameState(literal, expr->CreateLiteralId(), |
1635 OutputFrameStateCombine::Push()); | 1635 OutputFrameStateCombine::Push()); |
1636 | 1636 |
1637 // The object is expected on the operand stack during computation of the | 1637 // The object is expected on the operand stack during computation of the |
1638 // property values and is the value of the entire expression. | 1638 // property values and is the value of the entire expression. |
1639 environment()->Push(literal); | 1639 environment()->Push(literal); |
1640 | 1640 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 | 1812 |
1813 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1813 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1814 Node* closure = GetFunctionClosure(); | 1814 Node* closure = GetFunctionClosure(); |
1815 | 1815 |
1816 // Create node to deep-copy the literal boilerplate. | 1816 // Create node to deep-copy the literal boilerplate. |
1817 expr->BuildConstantElements(isolate()); | 1817 expr->BuildConstantElements(isolate()); |
1818 Node* literals_array = | 1818 Node* literals_array = |
1819 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1819 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
1820 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1820 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
1821 Node* constants = jsgraph()->Constant(expr->constant_elements()); | 1821 Node* constants = jsgraph()->Constant(expr->constant_elements()); |
1822 Node* flags = jsgraph()->Constant(expr->ComputeFlags()); | 1822 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true)); |
1823 const Operator* op = | 1823 const Operator* op = |
1824 javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1824 javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1825 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); | 1825 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
1826 PrepareFrameState(literal, expr->CreateLiteralId(), | 1826 PrepareFrameState(literal, expr->CreateLiteralId(), |
1827 OutputFrameStateCombine::Push()); | 1827 OutputFrameStateCombine::Push()); |
1828 | 1828 |
1829 // The array and the literal index are both expected on the operand stack | 1829 // The array and the literal index are both expected on the operand stack |
1830 // during computation of the element values. | 1830 // during computation of the element values. |
1831 environment()->Push(literal); | 1831 environment()->Push(literal); |
1832 environment()->Push(literal_index); | 1832 environment()->Push(literal_index); |
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 // Phi does not exist yet, introduce one. | 3520 // Phi does not exist yet, introduce one. |
3521 value = NewPhi(inputs, value, control); | 3521 value = NewPhi(inputs, value, control); |
3522 value->ReplaceInput(inputs - 1, other); | 3522 value->ReplaceInput(inputs - 1, other); |
3523 } | 3523 } |
3524 return value; | 3524 return value; |
3525 } | 3525 } |
3526 | 3526 |
3527 } // namespace compiler | 3527 } // namespace compiler |
3528 } // namespace internal | 3528 } // namespace internal |
3529 } // namespace v8 | 3529 } // namespace v8 |
OLD | NEW |