| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 28 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 29 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 29 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 30 | 30 |
| 31 #include "v8.h" | 31 #include "v8.h" |
| 32 | 32 |
| 33 #include "allocation.h" | 33 #include "allocation.h" |
| 34 #include "code-stubs.h" | 34 #include "code-stubs.h" |
| 35 #include "data-flow.h" | 35 #include "data-flow.h" |
| 36 #include "deoptimizer.h" |
| 36 #include "small-pointer-list.h" | 37 #include "small-pointer-list.h" |
| 37 #include "string-stream.h" | 38 #include "string-stream.h" |
| 38 #include "v8conversions.h" | 39 #include "v8conversions.h" |
| 39 #include "v8utils.h" | 40 #include "v8utils.h" |
| 40 #include "zone.h" | 41 #include "zone.h" |
| 41 | 42 |
| 42 namespace v8 { | 43 namespace v8 { |
| 43 namespace internal { | 44 namespace internal { |
| 44 | 45 |
| 45 // Forward declarations. | 46 // Forward declarations. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 V(PushArgument) \ | 156 V(PushArgument) \ |
| 156 V(Random) \ | 157 V(Random) \ |
| 157 V(RegExpLiteral) \ | 158 V(RegExpLiteral) \ |
| 158 V(Return) \ | 159 V(Return) \ |
| 159 V(Ror) \ | 160 V(Ror) \ |
| 160 V(Sar) \ | 161 V(Sar) \ |
| 161 V(SeqStringSetChar) \ | 162 V(SeqStringSetChar) \ |
| 162 V(Shl) \ | 163 V(Shl) \ |
| 163 V(Shr) \ | 164 V(Shr) \ |
| 164 V(Simulate) \ | 165 V(Simulate) \ |
| 165 V(SoftDeoptimize) \ | |
| 166 V(StackCheck) \ | 166 V(StackCheck) \ |
| 167 V(StoreContextSlot) \ | 167 V(StoreContextSlot) \ |
| 168 V(StoreGlobalCell) \ | 168 V(StoreGlobalCell) \ |
| 169 V(StoreGlobalGeneric) \ | 169 V(StoreGlobalGeneric) \ |
| 170 V(StoreKeyed) \ | 170 V(StoreKeyed) \ |
| 171 V(StoreKeyedGeneric) \ | 171 V(StoreKeyedGeneric) \ |
| 172 V(StoreNamedField) \ | 172 V(StoreNamedField) \ |
| 173 V(StoreNamedGeneric) \ | 173 V(StoreNamedGeneric) \ |
| 174 V(StringAdd) \ | 174 V(StringAdd) \ |
| 175 V(StringCharCodeAt) \ | 175 V(StringCharCodeAt) \ |
| (...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 HValue* related_value) | 1486 HValue* related_value) |
| 1487 : relation_(relation) { | 1487 : relation_(relation) { |
| 1488 SetOperandAt(0, constrained_value); | 1488 SetOperandAt(0, constrained_value); |
| 1489 SetOperandAt(1, related_value); | 1489 SetOperandAt(1, related_value); |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 NumericRelation relation_; | 1492 NumericRelation relation_; |
| 1493 }; | 1493 }; |
| 1494 | 1494 |
| 1495 | 1495 |
| 1496 // We insert soft-deoptimize when we hit code with unknown typefeedback, | 1496 class HDeoptimize: public HTemplateInstruction<0> { |
| 1497 // so that we get a chance of re-optimizing with useful typefeedback. | |
| 1498 // HSoftDeoptimize does not end a basic block as opposed to HDeoptimize. | |
| 1499 class HSoftDeoptimize: public HTemplateInstruction<0> { | |
| 1500 public: | 1497 public: |
| 1498 explicit HDeoptimize(Deoptimizer::BailoutType type) : type_(type) {} |
| 1499 |
| 1501 virtual Representation RequiredInputRepresentation(int index) { | 1500 virtual Representation RequiredInputRepresentation(int index) { |
| 1502 return Representation::None(); | 1501 return Representation::None(); |
| 1503 } | 1502 } |
| 1504 | 1503 |
| 1505 DECLARE_CONCRETE_INSTRUCTION(SoftDeoptimize) | 1504 Deoptimizer::BailoutType type() { return type_; } |
| 1505 |
| 1506 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 1507 |
| 1508 private: |
| 1509 Deoptimizer::BailoutType type_; |
| 1506 }; | 1510 }; |
| 1507 | 1511 |
| 1508 | 1512 |
| 1509 // Inserts an int3/stop break instruction for debugging purposes. | 1513 // Inserts an int3/stop break instruction for debugging purposes. |
| 1510 class HDebugBreak: public HTemplateInstruction<0> { | 1514 class HDebugBreak: public HTemplateInstruction<0> { |
| 1511 public: | 1515 public: |
| 1512 virtual Representation RequiredInputRepresentation(int index) { | 1516 virtual Representation RequiredInputRepresentation(int index) { |
| 1513 return Representation::None(); | 1517 return Representation::None(); |
| 1514 } | 1518 } |
| 1515 | 1519 |
| 1516 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1520 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
| 1517 }; | 1521 }; |
| 1518 | 1522 |
| 1519 | 1523 |
| 1520 class HDeoptimize: public HControlInstruction { | |
| 1521 public: | |
| 1522 HDeoptimize(int environment_length, | |
| 1523 int first_local_index, | |
| 1524 int first_expression_index, | |
| 1525 Zone* zone) | |
| 1526 : values_(environment_length, zone), | |
| 1527 first_local_index_(first_local_index), | |
| 1528 first_expression_index_(first_expression_index) { } | |
| 1529 | |
| 1530 virtual Representation RequiredInputRepresentation(int index) { | |
| 1531 return Representation::None(); | |
| 1532 } | |
| 1533 | |
| 1534 virtual int OperandCount() { return values_.length(); } | |
| 1535 virtual HValue* OperandAt(int index) const { return values_[index]; } | |
| 1536 virtual void PrintDataTo(StringStream* stream); | |
| 1537 | |
| 1538 virtual int SuccessorCount() { return 0; } | |
| 1539 virtual HBasicBlock* SuccessorAt(int i) { | |
| 1540 UNREACHABLE(); | |
| 1541 return NULL; | |
| 1542 } | |
| 1543 virtual void SetSuccessorAt(int i, HBasicBlock* block) { | |
| 1544 UNREACHABLE(); | |
| 1545 } | |
| 1546 | |
| 1547 void AddEnvironmentValue(HValue* value, Zone* zone) { | |
| 1548 values_.Add(NULL, zone); | |
| 1549 SetOperandAt(values_.length() - 1, value); | |
| 1550 } | |
| 1551 int first_local_index() { return first_local_index_; } | |
| 1552 int first_expression_index() { return first_expression_index_; } | |
| 1553 | |
| 1554 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | |
| 1555 | |
| 1556 enum UseEnvironment { | |
| 1557 kNoUses, | |
| 1558 kUseAll | |
| 1559 }; | |
| 1560 | |
| 1561 protected: | |
| 1562 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 1563 values_[index] = value; | |
| 1564 } | |
| 1565 | |
| 1566 private: | |
| 1567 ZoneList<HValue*> values_; | |
| 1568 int first_local_index_; | |
| 1569 int first_expression_index_; | |
| 1570 }; | |
| 1571 | |
| 1572 | |
| 1573 class HGoto: public HTemplateControlInstruction<1, 0> { | 1524 class HGoto: public HTemplateControlInstruction<1, 0> { |
| 1574 public: | 1525 public: |
| 1575 explicit HGoto(HBasicBlock* target) { | 1526 explicit HGoto(HBasicBlock* target) { |
| 1576 SetSuccessorAt(0, target); | 1527 SetSuccessorAt(0, target); |
| 1577 } | 1528 } |
| 1578 | 1529 |
| 1579 virtual Representation RequiredInputRepresentation(int index) { | 1530 virtual Representation RequiredInputRepresentation(int index) { |
| 1580 return Representation::None(); | 1531 return Representation::None(); |
| 1581 } | 1532 } |
| 1582 | 1533 |
| (...skipping 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6694 virtual bool IsDeletable() const { return true; } | 6645 virtual bool IsDeletable() const { return true; } |
| 6695 }; | 6646 }; |
| 6696 | 6647 |
| 6697 | 6648 |
| 6698 #undef DECLARE_INSTRUCTION | 6649 #undef DECLARE_INSTRUCTION |
| 6699 #undef DECLARE_CONCRETE_INSTRUCTION | 6650 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6700 | 6651 |
| 6701 } } // namespace v8::internal | 6652 } } // namespace v8::internal |
| 6702 | 6653 |
| 6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6654 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |