OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_HYDROGEN_H_ | 5 #ifndef V8_HYDROGEN_H_ |
6 #define V8_HYDROGEN_H_ | 6 #define V8_HYDROGEN_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1468 |
1469 HValue* EnforceNumberType(HValue* number, Type* expected); | 1469 HValue* EnforceNumberType(HValue* number, Type* expected); |
1470 HValue* TruncateToNumber(HValue* value, Type** expected); | 1470 HValue* TruncateToNumber(HValue* value, Type** expected); |
1471 | 1471 |
1472 void FinishExitWithHardDeoptimization(const char* reason); | 1472 void FinishExitWithHardDeoptimization(const char* reason); |
1473 | 1473 |
1474 void AddIncrementCounter(StatsCounter* counter); | 1474 void AddIncrementCounter(StatsCounter* counter); |
1475 | 1475 |
1476 class IfBuilder V8_FINAL { | 1476 class IfBuilder V8_FINAL { |
1477 public: | 1477 public: |
| 1478 // If using this constructor, Initialize() must be called explicitly! |
| 1479 IfBuilder(); |
| 1480 |
1478 explicit IfBuilder(HGraphBuilder* builder); | 1481 explicit IfBuilder(HGraphBuilder* builder); |
1479 IfBuilder(HGraphBuilder* builder, | 1482 IfBuilder(HGraphBuilder* builder, |
1480 HIfContinuation* continuation); | 1483 HIfContinuation* continuation); |
1481 | 1484 |
1482 ~IfBuilder() { | 1485 ~IfBuilder() { |
1483 if (!finished_) End(); | 1486 if (!finished_) End(); |
1484 } | 1487 } |
1485 | 1488 |
| 1489 void Initialize(HGraphBuilder* builder); |
| 1490 |
1486 template<class Condition> | 1491 template<class Condition> |
1487 Condition* If(HValue *p) { | 1492 Condition* If(HValue *p) { |
1488 Condition* compare = builder()->New<Condition>(p); | 1493 Condition* compare = builder()->New<Condition>(p); |
1489 AddCompare(compare); | 1494 AddCompare(compare); |
1490 return compare; | 1495 return compare; |
1491 } | 1496 } |
1492 | 1497 |
1493 template<class Condition, class P2> | 1498 template<class Condition, class P2> |
1494 Condition* If(HValue* p1, P2 p2) { | 1499 Condition* If(HValue* p1, P2 p2) { |
1495 Condition* compare = builder()->New<Condition>(p1, p2); | 1500 Condition* compare = builder()->New<Condition>(p1, p2); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 Deopt(reason); | 1623 Deopt(reason); |
1619 } | 1624 } |
1620 void ElseDeopt(const char* reason) { | 1625 void ElseDeopt(const char* reason) { |
1621 Else(); | 1626 Else(); |
1622 Deopt(reason); | 1627 Deopt(reason); |
1623 } | 1628 } |
1624 | 1629 |
1625 void Return(HValue* value); | 1630 void Return(HValue* value); |
1626 | 1631 |
1627 private: | 1632 private: |
| 1633 void InitializeDontCreateBlocks(HGraphBuilder* builder); |
| 1634 |
1628 HControlInstruction* AddCompare(HControlInstruction* compare); | 1635 HControlInstruction* AddCompare(HControlInstruction* compare); |
1629 | 1636 |
1630 HGraphBuilder* builder() const { return builder_; } | 1637 HGraphBuilder* builder() const { |
| 1638 ASSERT(builder_ != NULL); // Have you called "Initialize"? |
| 1639 return builder_; |
| 1640 } |
1631 | 1641 |
1632 void AddMergeAtJoinBlock(bool deopt); | 1642 void AddMergeAtJoinBlock(bool deopt); |
1633 | 1643 |
1634 void Finish(); | 1644 void Finish(); |
1635 void Finish(HBasicBlock** then_continuation, | 1645 void Finish(HBasicBlock** then_continuation, |
1636 HBasicBlock** else_continuation); | 1646 HBasicBlock** else_continuation); |
1637 | 1647 |
1638 class MergeAtJoinBlock : public ZoneObject { | 1648 class MergeAtJoinBlock : public ZoneObject { |
1639 public: | 1649 public: |
1640 MergeAtJoinBlock(HBasicBlock* block, | 1650 MergeAtJoinBlock(HBasicBlock* block, |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2897 } | 2907 } |
2898 | 2908 |
2899 private: | 2909 private: |
2900 HGraphBuilder* builder_; | 2910 HGraphBuilder* builder_; |
2901 }; | 2911 }; |
2902 | 2912 |
2903 | 2913 |
2904 } } // namespace v8::internal | 2914 } } // namespace v8::internal |
2905 | 2915 |
2906 #endif // V8_HYDROGEN_H_ | 2916 #endif // V8_HYDROGEN_H_ |
OLD | NEW |