OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 } | 1419 } |
1420 | 1420 |
1421 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { | 1421 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { |
1422 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); | 1422 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); |
1423 } | 1423 } |
1424 | 1424 |
1425 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide() { | 1425 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide() { |
1426 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); | 1426 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); |
1427 } | 1427 } |
1428 | 1428 |
| 1429 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } |
| 1430 |
| 1431 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() { |
| 1432 BuildJumpIfNotHole(); |
| 1433 } |
| 1434 |
| 1435 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstantWide() { |
| 1436 BuildJumpIfNotHole(); |
| 1437 } |
| 1438 |
1429 void BytecodeGraphBuilder::VisitJumpIfNull() { | 1439 void BytecodeGraphBuilder::VisitJumpIfNull() { |
1430 BuildJumpIfEqual(jsgraph()->NullConstant()); | 1440 BuildJumpIfEqual(jsgraph()->NullConstant()); |
1431 } | 1441 } |
1432 | 1442 |
1433 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { | 1443 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { |
1434 BuildJumpIfEqual(jsgraph()->NullConstant()); | 1444 BuildJumpIfEqual(jsgraph()->NullConstant()); |
1435 } | 1445 } |
1436 | 1446 |
1437 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide() { | 1447 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide() { |
1438 BuildJumpIfEqual(jsgraph()->NullConstant()); | 1448 BuildJumpIfEqual(jsgraph()->NullConstant()); |
1439 } | 1449 } |
1440 | 1450 |
1441 void BytecodeGraphBuilder::VisitJumpIfUndefined() { | 1451 void BytecodeGraphBuilder::VisitJumpIfUndefined() { |
1442 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 1452 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
1443 } | 1453 } |
1444 | 1454 |
1445 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { | 1455 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { |
1446 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 1456 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
1447 } | 1457 } |
1448 | 1458 |
1449 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide() { | 1459 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide() { |
1450 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); | 1460 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); |
1451 } | 1461 } |
1452 | 1462 |
1453 void BytecodeGraphBuilder::VisitJumpIfHole() { | |
1454 BuildJumpIfEqual(jsgraph()->TheHoleConstant()); | |
1455 } | |
1456 | |
1457 void BytecodeGraphBuilder::VisitJumpIfNotHole() { | |
1458 Node* accumulator = environment()->LookupAccumulator(); | |
1459 Node* condition = NewNode(javascript()->StrictEqual(), accumulator, | |
1460 jsgraph()->TheHoleConstant()); | |
1461 Node* node = | |
1462 NewNode(common()->Select(MachineRepresentation::kTagged), condition, | |
1463 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); | |
1464 BuildConditionalJump(node); | |
1465 } | |
1466 | |
1467 void BytecodeGraphBuilder::VisitStackCheck() { | 1463 void BytecodeGraphBuilder::VisitStackCheck() { |
1468 FrameStateBeforeAndAfter states(this); | 1464 FrameStateBeforeAndAfter states(this); |
1469 Node* node = NewNode(javascript()->StackCheck()); | 1465 Node* node = NewNode(javascript()->StackCheck()); |
1470 environment()->RecordAfterState(node, &states); | 1466 environment()->RecordAfterState(node, &states); |
1471 } | 1467 } |
1472 | 1468 |
1473 void BytecodeGraphBuilder::VisitReturn() { | 1469 void BytecodeGraphBuilder::VisitReturn() { |
1474 Node* control = | 1470 Node* control = |
1475 NewNode(common()->Return(), environment()->LookupAccumulator()); | 1471 NewNode(common()->Return(), environment()->LookupAccumulator()); |
1476 MergeControlToLeaveFunction(control); | 1472 MergeControlToLeaveFunction(control); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 | 1590 |
1595 | 1591 |
1596 void BytecodeGraphBuilder::BuildJumpIfToBooleanEqual(Node* comperand) { | 1592 void BytecodeGraphBuilder::BuildJumpIfToBooleanEqual(Node* comperand) { |
1597 Node* accumulator = environment()->LookupAccumulator(); | 1593 Node* accumulator = environment()->LookupAccumulator(); |
1598 Node* to_boolean = | 1594 Node* to_boolean = |
1599 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); | 1595 NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); |
1600 Node* condition = NewNode(javascript()->StrictEqual(), to_boolean, comperand); | 1596 Node* condition = NewNode(javascript()->StrictEqual(), to_boolean, comperand); |
1601 BuildConditionalJump(condition); | 1597 BuildConditionalJump(condition); |
1602 } | 1598 } |
1603 | 1599 |
| 1600 void BytecodeGraphBuilder::BuildJumpIfNotHole() { |
| 1601 Node* accumulator = environment()->LookupAccumulator(); |
| 1602 Node* condition = NewNode(javascript()->StrictEqual(), accumulator, |
| 1603 jsgraph()->TheHoleConstant()); |
| 1604 Node* node = |
| 1605 NewNode(common()->Select(MachineRepresentation::kTagged), condition, |
| 1606 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
| 1607 BuildConditionalJump(node); |
| 1608 } |
1604 | 1609 |
1605 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { | 1610 Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { |
1606 if (size > input_buffer_size_) { | 1611 if (size > input_buffer_size_) { |
1607 size = size + kInputBufferSizeIncrement + input_buffer_size_; | 1612 size = size + kInputBufferSizeIncrement + input_buffer_size_; |
1608 input_buffer_ = local_zone()->NewArray<Node*>(size); | 1613 input_buffer_ = local_zone()->NewArray<Node*>(size); |
1609 input_buffer_size_ = size; | 1614 input_buffer_size_ = size; |
1610 } | 1615 } |
1611 return input_buffer_; | 1616 return input_buffer_; |
1612 } | 1617 } |
1613 | 1618 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 // Phi does not exist yet, introduce one. | 1795 // Phi does not exist yet, introduce one. |
1791 value = NewPhi(inputs, value, control); | 1796 value = NewPhi(inputs, value, control); |
1792 value->ReplaceInput(inputs - 1, other); | 1797 value->ReplaceInput(inputs - 1, other); |
1793 } | 1798 } |
1794 return value; | 1799 return value; |
1795 } | 1800 } |
1796 | 1801 |
1797 } // namespace compiler | 1802 } // namespace compiler |
1798 } // namespace internal | 1803 } // namespace internal |
1799 } // namespace v8 | 1804 } // namespace v8 |
OLD | NEW |