Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index a32a418606a058f5368a29d0ca0782a2400136e6..086f9a1a4cea430882d2b3b8d74938ce23581386 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -6992,55 +6992,45 @@ class HStringAdd V8_FINAL : public HBinaryOperation { |
HValue* context, |
HValue* left, |
HValue* right, |
- PretenureFlag pretenure_flag = NOT_TENURED, |
- StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
- Handle<AllocationSite> allocation_site = |
- Handle<AllocationSite>::null()); |
+ StringAddFlags flags = STRING_ADD_CHECK_NONE); |
StringAddFlags flags() const { return flags_; } |
- PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
return Representation::Tagged(); |
} |
- virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
- |
DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
protected: |
- virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
- return flags_ == HStringAdd::cast(other)->flags_ && |
- pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
- } |
+ virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
private: |
- HStringAdd(HValue* context, |
- HValue* left, |
- HValue* right, |
- PretenureFlag pretenure_flag, |
- StringAddFlags flags, |
- Handle<AllocationSite> allocation_site) |
- : HBinaryOperation(context, left, right, HType::String()), |
- flags_(flags), pretenure_flag_(pretenure_flag) { |
+ HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) |
+ : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { |
set_representation(Representation::Tagged()); |
- SetFlag(kUseGVN); |
- SetGVNFlag(kDependsOnMaps); |
- SetGVNFlag(kChangesNewSpacePromotion); |
- if (FLAG_trace_pretenuring) { |
- PrintF("HStringAdd with AllocationSite %p %s\n", |
- allocation_site.is_null() |
- ? static_cast<void*>(NULL) |
- : static_cast<void*>(*allocation_site), |
- pretenure_flag == TENURED ? "tenured" : "not tenured"); |
+ if (MightHaveSideEffects()) { |
+ SetAllSideEffects(); |
+ } else { |
+ SetFlag(kUseGVN); |
+ SetGVNFlag(kDependsOnMaps); |
+ SetGVNFlag(kChangesNewSpacePromotion); |
} |
} |
+ bool MightHaveSideEffects() const { |
+ return flags_ != STRING_ADD_CHECK_NONE && |
+ (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved()); |
+ } |
+ |
// No side-effects except possible allocation: |
- virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
+ // NOTE: this instruction does not call ToString() on its inputs, when flags_ |
+ // is set to STRING_ADD_CHECK_NONE. |
+ virtual bool IsDeletable() const V8_OVERRIDE { |
+ return !MightHaveSideEffects(); |
+ } |
const StringAddFlags flags_; |
- const PretenureFlag pretenure_flag_; |
}; |