OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 enum Flag { | 480 enum Flag { |
481 // Declare global value numbering flags. | 481 // Declare global value numbering flags. |
482 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, | 482 #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
483 GVN_FLAG_LIST(DECLARE_DO) | 483 GVN_FLAG_LIST(DECLARE_DO) |
484 #undef DECLARE_DO | 484 #undef DECLARE_DO |
485 kFlexibleRepresentation, | 485 kFlexibleRepresentation, |
486 kUseGVN, | 486 kUseGVN, |
487 kCanOverflow, | 487 kCanOverflow, |
488 kBailoutOnMinusZero, | 488 kBailoutOnMinusZero, |
489 kCanBeDivByZero, | 489 kCanBeDivByZero, |
490 kDeoptimizeOnUndefined, | |
490 kIsArguments, | 491 kIsArguments, |
491 kTruncatingToInt32, | 492 kTruncatingToInt32, |
492 kLastFlag = kTruncatingToInt32 | 493 kLastFlag = kTruncatingToInt32 |
493 }; | 494 }; |
494 | 495 |
495 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 496 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
496 | 497 |
497 static const int kChangesToDependsFlagsLeftShift = 1; | 498 static const int kChangesToDependsFlagsLeftShift = 1; |
498 | 499 |
499 static int ChangesFlagsMask() { | 500 static int ChangesFlagsMask() { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 | 1062 |
1062 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1063 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
1063 }; | 1064 }; |
1064 | 1065 |
1065 | 1066 |
1066 class HChange: public HUnaryOperation { | 1067 class HChange: public HUnaryOperation { |
1067 public: | 1068 public: |
1068 HChange(HValue* value, | 1069 HChange(HValue* value, |
1069 Representation from, | 1070 Representation from, |
1070 Representation to, | 1071 Representation to, |
1071 bool is_truncating) | 1072 bool is_truncating, |
1072 : HUnaryOperation(value), from_(from) { | 1073 bool deoptimize_on_undefined) |
1074 : HUnaryOperation(value), | |
1075 from_(from), | |
1076 deoptimize_on_undefined_(deoptimize_on_undefined) { | |
1073 ASSERT(!from.IsNone() && !to.IsNone()); | 1077 ASSERT(!from.IsNone() && !to.IsNone()); |
1074 ASSERT(!from.Equals(to)); | 1078 ASSERT(!from.Equals(to)); |
1075 set_representation(to); | 1079 set_representation(to); |
1076 SetFlag(kUseGVN); | 1080 SetFlag(kUseGVN); |
1077 if (is_truncating) SetFlag(kTruncatingToInt32); | 1081 if (is_truncating) SetFlag(kTruncatingToInt32); |
1078 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 1082 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
1079 value->range()->IsInSmiRange()) { | 1083 value->range()->IsInSmiRange()) { |
1080 set_type(HType::Smi()); | 1084 set_type(HType::Smi()); |
1081 } | 1085 } |
1082 } | 1086 } |
1083 | 1087 |
1084 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1088 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1085 | 1089 |
1086 Representation from() const { return from_; } | 1090 Representation from() const { return from_; } |
1087 Representation to() const { return representation(); } | 1091 Representation to() const { return representation(); } |
1092 bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } | |
1088 virtual Representation RequiredInputRepresentation(int index) const { | 1093 virtual Representation RequiredInputRepresentation(int index) const { |
1089 return from_; | 1094 return from_; |
1090 } | 1095 } |
1091 | 1096 |
1092 virtual void PrintDataTo(StringStream* stream); | 1097 virtual void PrintDataTo(StringStream* stream); |
1093 | 1098 |
1094 DECLARE_CONCRETE_INSTRUCTION(Change) | 1099 DECLARE_CONCRETE_INSTRUCTION(Change) |
1095 | 1100 |
1096 protected: | 1101 protected: |
1097 virtual bool DataEquals(HValue* other) { | 1102 virtual bool DataEquals(HValue* other) { |
1098 if (!other->IsChange()) return false; | 1103 if (!other->IsChange()) return false; |
1099 HChange* change = HChange::cast(other); | 1104 HChange* change = HChange::cast(other); |
1100 return value() == change->value() | 1105 return value() == change->value() |
1101 && to().Equals(change->to()); | 1106 && to().Equals(change->to()) |
1107 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); | |
1102 } | 1108 } |
1103 | 1109 |
1104 private: | 1110 private: |
1105 Representation from_; | 1111 Representation from_; |
1112 bool deoptimize_on_undefined_; | |
1106 }; | 1113 }; |
1107 | 1114 |
1108 | 1115 |
1109 class HClampToUint8: public HUnaryOperation { | 1116 class HClampToUint8: public HUnaryOperation { |
1110 public: | 1117 public: |
1111 explicit HClampToUint8(HValue* value) | 1118 explicit HClampToUint8(HValue* value) |
1112 : HUnaryOperation(value), | 1119 : HUnaryOperation(value), |
1113 input_rep_(Representation::None()) { | 1120 input_rep_(Representation::None()) { |
1114 SetFlag(kFlexibleRepresentation); | 1121 SetFlag(kFlexibleRepresentation); |
1115 set_representation(Representation::Tagged()); | 1122 set_representation(Representation::Tagged()); |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2495 virtual bool EmitAtUses() { | 2502 virtual bool EmitAtUses() { |
2496 return !HasSideEffects() && !HasMultipleUses(); | 2503 return !HasSideEffects() && !HasMultipleUses(); |
2497 } | 2504 } |
2498 | 2505 |
2499 virtual Representation RequiredInputRepresentation(int index) const { | 2506 virtual Representation RequiredInputRepresentation(int index) const { |
2500 return input_representation_; | 2507 return input_representation_; |
2501 } | 2508 } |
2502 Representation GetInputRepresentation() const { | 2509 Representation GetInputRepresentation() const { |
2503 return input_representation_; | 2510 return input_representation_; |
2504 } | 2511 } |
2512 | |
William Hesse
2011/06/08 14:30:30
Removed.
| |
2505 Token::Value token() const { return token_; } | 2513 Token::Value token() const { return token_; } |
2506 virtual void PrintDataTo(StringStream* stream); | 2514 virtual void PrintDataTo(StringStream* stream); |
2507 | 2515 |
2508 virtual HType CalculateInferredType(); | 2516 virtual HType CalculateInferredType(); |
2509 | 2517 |
2510 virtual intptr_t Hashcode() { | 2518 virtual intptr_t Hashcode() { |
2511 return HValue::Hashcode() * 7 + token_; | 2519 return HValue::Hashcode() * 7 + token_; |
2512 } | 2520 } |
2513 | 2521 |
2514 DECLARE_CONCRETE_INSTRUCTION(Compare) | 2522 DECLARE_CONCRETE_INSTRUCTION(Compare) |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4029 | 4037 |
4030 DECLARE_CONCRETE_INSTRUCTION(In) | 4038 DECLARE_CONCRETE_INSTRUCTION(In) |
4031 }; | 4039 }; |
4032 | 4040 |
4033 #undef DECLARE_INSTRUCTION | 4041 #undef DECLARE_INSTRUCTION |
4034 #undef DECLARE_CONCRETE_INSTRUCTION | 4042 #undef DECLARE_CONCRETE_INSTRUCTION |
4035 | 4043 |
4036 } } // namespace v8::internal | 4044 } } // namespace v8::internal |
4037 | 4045 |
4038 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4046 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |