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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 | 1457 |
1458 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1458 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
1459 Node* closure = GetFunctionClosure(); | 1459 Node* closure = GetFunctionClosure(); |
1460 | 1460 |
1461 // Create node to deep-copy the literal boilerplate. | 1461 // Create node to deep-copy the literal boilerplate. |
1462 expr->BuildConstantProperties(isolate()); | 1462 expr->BuildConstantProperties(isolate()); |
1463 Node* literals_array = | 1463 Node* literals_array = |
1464 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1464 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
1465 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1465 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
1466 Node* constants = jsgraph()->Constant(expr->constant_properties()); | 1466 Node* constants = jsgraph()->Constant(expr->constant_properties()); |
1467 Node* flags = jsgraph()->Constant(expr->ComputeFlags()); | 1467 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true)); |
1468 const Operator* op = | 1468 const Operator* op = |
1469 javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1469 javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1470 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); | 1470 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
1471 PrepareFrameState(literal, expr->CreateLiteralId(), | 1471 PrepareFrameState(literal, expr->CreateLiteralId(), |
1472 OutputFrameStateCombine::Push()); | 1472 OutputFrameStateCombine::Push()); |
1473 | 1473 |
1474 // The object is expected on the operand stack during computation of the | 1474 // The object is expected on the operand stack during computation of the |
1475 // property values and is the value of the entire expression. | 1475 // property values and is the value of the entire expression. |
1476 environment()->Push(literal); | 1476 environment()->Push(literal); |
1477 | 1477 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 | 1649 |
1650 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1650 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1651 Node* closure = GetFunctionClosure(); | 1651 Node* closure = GetFunctionClosure(); |
1652 | 1652 |
1653 // Create node to deep-copy the literal boilerplate. | 1653 // Create node to deep-copy the literal boilerplate. |
1654 expr->BuildConstantElements(isolate()); | 1654 expr->BuildConstantElements(isolate()); |
1655 Node* literals_array = | 1655 Node* literals_array = |
1656 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1656 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
1657 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1657 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
1658 Node* constants = jsgraph()->Constant(expr->constant_elements()); | 1658 Node* constants = jsgraph()->Constant(expr->constant_elements()); |
1659 Node* flags = jsgraph()->Constant(expr->ComputeFlags()); | 1659 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true)); |
1660 const Operator* op = | 1660 const Operator* op = |
1661 javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); | 1661 javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4); |
1662 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); | 1662 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); |
1663 PrepareFrameState(literal, expr->CreateLiteralId(), | 1663 PrepareFrameState(literal, expr->CreateLiteralId(), |
1664 OutputFrameStateCombine::Push()); | 1664 OutputFrameStateCombine::Push()); |
1665 | 1665 |
1666 // The array and the literal index are both expected on the operand stack | 1666 // The array and the literal index are both expected on the operand stack |
1667 // during computation of the element values. | 1667 // during computation of the element values. |
1668 environment()->Push(literal); | 1668 environment()->Push(literal); |
1669 environment()->Push(literal_index); | 1669 environment()->Push(literal_index); |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 // Phi does not exist yet, introduce one. | 3208 // Phi does not exist yet, introduce one. |
3209 value = NewPhi(inputs, value, control); | 3209 value = NewPhi(inputs, value, control); |
3210 value->ReplaceInput(inputs - 1, other); | 3210 value->ReplaceInput(inputs - 1, other); |
3211 } | 3211 } |
3212 return value; | 3212 return value; |
3213 } | 3213 } |
3214 | 3214 |
3215 } // namespace compiler | 3215 } // namespace compiler |
3216 } // namespace internal | 3216 } // namespace internal |
3217 } // namespace v8 | 3217 } // namespace v8 |
OLD | NEW |