Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 11e85a0c034ab6a689eaa4fdf55cb537f9af1035..68b84c1749fda629ea1ae1df4c75d47f4fac3473 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -4830,11 +4830,21 @@ class HPower final : public HTemplateInstruction<2> { |
}; |
+enum ExternalAddType { |
+ AddOfExternalAndTagged, |
+ AddOfExternalAndInt32, |
+ NoExternalAdd |
+}; |
+ |
+ |
class HAdd final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
HValue* left, HValue* right, |
Strength strength = Strength::WEAK); |
+ static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
+ HValue* left, HValue* right, Strength strength, |
+ ExternalAddType external_add_type); |
// Add is only commutative if two integer values are added and not if two |
// tagged values are added (because it might be a String concatenation). |
@@ -4877,6 +4887,8 @@ class HAdd final : public HArithmeticBinaryOperation { |
Representation RequiredInputRepresentation(int index) override; |
+ ExternalAddType external_add_type() const { return external_add_type_; } |
+ |
DECLARE_CONCRETE_INSTRUCTION(Add) |
protected: |
@@ -4885,10 +4897,28 @@ class HAdd final : public HArithmeticBinaryOperation { |
Range* InferRange(Zone* zone) override; |
private: |
- HAdd(HValue* context, HValue* left, HValue* right, Strength strength) |
- : HArithmeticBinaryOperation(context, left, right, strength) { |
+ HAdd(HValue* context, HValue* left, HValue* right, Strength strength, |
+ ExternalAddType external_add_type = NoExternalAdd) |
+ : HArithmeticBinaryOperation(context, left, right, strength), |
+ external_add_type_(external_add_type) { |
SetFlag(kCanOverflow); |
+ if (left->representation().IsExternal()) { |
+ if (right->representation().IsTagged()) { |
+ DCHECK_EQ(external_add_type_, AddOfExternalAndTagged); |
+ SetDependsOnFlag(kNewSpacePromotion); |
+ } else { |
+ // This is a bit of a hack: The call to this constructor is generated |
+ // by a macro that also supports sub and mul, so it doesn't pass in |
+ // a value for external_add_type but uses the default. |
+ DCHECK_EQ(external_add_type_, NoExternalAdd); |
+ external_add_type_ = AddOfExternalAndInt32; |
+ } |
+ } else { |
+ DCHECK_EQ(external_add_type_, NoExternalAdd); |
+ } |
Jarin
2015/07/20 14:17:56
Hmm, I was imagining you would drive it the other
|
} |
+ |
+ ExternalAddType external_add_type_; |
}; |