Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 5fa3b7802a9808935bdcdb9b92359cb5e8d83444..fcd7c2c24bfb5647cf17b2e51a0fe1a8ebebf297 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -3768,8 +3768,8 @@ class HConstant final : public HTemplateInstruction<0> { |
class HBinaryOperation : public HTemplateInstruction<3> { |
public: |
HBinaryOperation(HValue* context, HValue* left, HValue* right, |
- HType type = HType::Tagged()) |
- : HTemplateInstruction<3>(type), |
+ LanguageMode language_mode, HType type = HType::Tagged()) |
+ : HTemplateInstruction<3>(type), language_mode_(language_mode), |
observed_output_representation_(Representation::None()) { |
DCHECK(left != NULL && right != NULL); |
SetOperandAt(0, context); |
@@ -3782,6 +3782,7 @@ class HBinaryOperation : public HTemplateInstruction<3> { |
HValue* context() const { return OperandAt(0); } |
HValue* left() const { return OperandAt(1); } |
HValue* right() const { return OperandAt(2); } |
+ LanguageMode language_mode() const { return language_mode_; } |
// True if switching left and right operands likely generates better code. |
bool AreOperandsBetterSwitched() { |
@@ -3857,10 +3858,15 @@ class HBinaryOperation : public HTemplateInstruction<3> { |
return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); |
} |
+ LanguageMode language_mode() { |
+ return language_mode_; |
+ } |
+ |
DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
private: |
bool IgnoreObservedOutputRepresentation(Representation current_rep); |
+ LanguageMode language_mode_; |
Representation observed_input_representation_[2]; |
Representation observed_output_representation_; |
@@ -4130,8 +4136,9 @@ class HBoundsCheckBaseIndexInformation final : public HTemplateInstruction<2> { |
class HBitwiseBinaryOperation : public HBinaryOperation { |
public: |
HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
+ LanguageMode language_mode, |
HType type = HType::TaggedNumber()) |
- : HBinaryOperation(context, left, right, type) { |
+ : HBinaryOperation(context, left, right, language_mode, type) { |
SetFlag(kFlexibleRepresentation); |
SetFlag(kTruncatingToInt32); |
SetFlag(kAllowUndefinedAsNaN); |
@@ -4190,7 +4197,7 @@ class HMathFloorOfDiv final : public HBinaryOperation { |
private: |
HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
- : HBinaryOperation(context, left, right) { |
+ : HBinaryOperation(context, left, right, SLOPPY) { |
set_representation(Representation::Integer32()); |
SetFlag(kUseGVN); |
SetFlag(kCanOverflow); |
@@ -4209,8 +4216,10 @@ class HMathFloorOfDiv final : public HBinaryOperation { |
class HArithmeticBinaryOperation : public HBinaryOperation { |
public: |
- HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
- : HBinaryOperation(context, left, right, HType::TaggedNumber()) { |
+ HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, |
+ LanguageMode language_mode) |
+ : HBinaryOperation(context, left, right, language_mode, |
+ HType::TaggedNumber()) { |
SetAllSideEffects(); |
SetFlag(kFlexibleRepresentation); |
SetFlag(kAllowUndefinedAsNaN); |
@@ -4237,8 +4246,12 @@ class HArithmeticBinaryOperation : public HBinaryOperation { |
class HCompareGeneric final : public HBinaryOperation { |
public: |
- DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, |
- HValue*, Token::Value); |
+ static HCompareGeneric* New(Isolate* isolate, Zone* zone, HValue* context, |
+ HValue* left, HValue* right, Token::Value token, |
+ LanguageMode language_mode = SLOPPY) { |
+ return new(zone) HCompareGeneric(context, left, right, token, |
+ language_mode); |
+ } |
Representation RequiredInputRepresentation(int index) override { |
return index == 0 |
@@ -4255,8 +4268,9 @@ class HCompareGeneric final : public HBinaryOperation { |
HCompareGeneric(HValue* context, |
HValue* left, |
HValue* right, |
- Token::Value token) |
- : HBinaryOperation(context, left, right, HType::Boolean()), |
+ Token::Value token, |
+ LanguageMode language_mode) |
+ : HBinaryOperation(context, left, right, language_mode, HType::Boolean()), |
token_(token) { |
DCHECK(Token::IsCompareOp(token)); |
set_representation(Representation::Tagged()); |
@@ -4715,7 +4729,7 @@ class HInstanceOf final : public HBinaryOperation { |
private: |
HInstanceOf(HValue* context, HValue* left, HValue* right) |
- : HBinaryOperation(context, left, right, HType::Boolean()) { |
+ : HBinaryOperation(context, left, right, SLOPPY, HType::Boolean()) { |
set_representation(Representation::Tagged()); |
SetAllSideEffects(); |
} |
@@ -4793,7 +4807,8 @@ class HPower final : public HTemplateInstruction<2> { |
class HAdd final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
// 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). |
@@ -4844,8 +4859,8 @@ class HAdd final : public HArithmeticBinaryOperation { |
Range* InferRange(Zone* zone) override; |
private: |
- HAdd(HValue* context, HValue* left, HValue* right) |
- : HArithmeticBinaryOperation(context, left, right) { |
+ HAdd(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HArithmeticBinaryOperation(context, left, right, language_mode) { |
SetFlag(kCanOverflow); |
} |
}; |
@@ -4854,7 +4869,8 @@ class HAdd final : public HArithmeticBinaryOperation { |
class HSub final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
HValue* Canonicalize() override; |
@@ -4875,8 +4891,8 @@ class HSub final : public HArithmeticBinaryOperation { |
Range* InferRange(Zone* zone) override; |
private: |
- HSub(HValue* context, HValue* left, HValue* right) |
- : HArithmeticBinaryOperation(context, left, right) { |
+ HSub(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HArithmeticBinaryOperation(context, left, right, language_mode) { |
SetFlag(kCanOverflow); |
} |
}; |
@@ -4885,11 +4901,14 @@ class HSub final : public HArithmeticBinaryOperation { |
class HMul final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right) { |
- HInstruction* instr = HMul::New(isolate, zone, context, left, right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY) { |
+ HInstruction* instr = HMul::New(isolate, zone, context, left, right, |
+ language_mode); |
if (!instr->IsMul()) return instr; |
HMul* mul = HMul::cast(instr); |
// TODO(mstarzinger): Prevent bailout on minus zero for imul. |
@@ -4919,8 +4938,8 @@ class HMul final : public HArithmeticBinaryOperation { |
Range* InferRange(Zone* zone) override; |
private: |
- HMul(HValue* context, HValue* left, HValue* right) |
- : HArithmeticBinaryOperation(context, left, right) { |
+ HMul(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HArithmeticBinaryOperation(context, left, right, language_mode) { |
SetFlag(kCanOverflow); |
} |
}; |
@@ -4929,7 +4948,8 @@ class HMul final : public HArithmeticBinaryOperation { |
class HMod final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
HValue* Canonicalize() override; |
@@ -4950,7 +4970,10 @@ class HMod final : public HArithmeticBinaryOperation { |
private: |
HMod(HValue* context, |
HValue* left, |
- HValue* right) : HArithmeticBinaryOperation(context, left, right) { |
+ HValue* right, |
+ LanguageMode language_mode) : HArithmeticBinaryOperation(context, left, |
+ right, |
+ language_mode) { |
SetFlag(kCanBeDivByZero); |
SetFlag(kCanOverflow); |
SetFlag(kLeftCanBeNegative); |
@@ -4961,7 +4984,8 @@ class HMod final : public HArithmeticBinaryOperation { |
class HDiv final : public HArithmeticBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
HValue* Canonicalize() override; |
@@ -4980,8 +5004,8 @@ class HDiv final : public HArithmeticBinaryOperation { |
Range* InferRange(Zone* zone) override; |
private: |
- HDiv(HValue* context, HValue* left, HValue* right) |
- : HArithmeticBinaryOperation(context, left, right) { |
+ HDiv(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HArithmeticBinaryOperation(context, left, right, language_mode) { |
SetFlag(kCanBeDivByZero); |
SetFlag(kCanOverflow); |
} |
@@ -5027,7 +5051,7 @@ class HMathMinMax final : public HArithmeticBinaryOperation { |
private: |
HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
- : HArithmeticBinaryOperation(context, left, right), |
+ : HArithmeticBinaryOperation(context, left, right, SLOPPY), |
operation_(op) { } |
Operation operation_; |
@@ -5037,7 +5061,8 @@ class HMathMinMax final : public HArithmeticBinaryOperation { |
class HBitwise final : public HBitwiseBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- Token::Value op, HValue* left, HValue* right); |
+ Token::Value op, HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
Token::Value op() const { return op_; } |
@@ -5060,8 +5085,9 @@ class HBitwise final : public HBitwiseBinaryOperation { |
HBitwise(HValue* context, |
Token::Value op, |
HValue* left, |
- HValue* right) |
- : HBitwiseBinaryOperation(context, left, right), |
+ HValue* right, |
+ LanguageMode language_mode) |
+ : HBitwiseBinaryOperation(context, left, right, language_mode), |
op_(op) { |
DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
// BIT_AND with a smi-range positive value will always unset the |
@@ -5096,7 +5122,8 @@ class HBitwise final : public HBitwiseBinaryOperation { |
class HShl final : public HBitwiseBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
Range* InferRange(Zone* zone) override; |
@@ -5117,15 +5144,16 @@ class HShl final : public HBitwiseBinaryOperation { |
bool DataEquals(HValue* other) override { return true; } |
private: |
- HShl(HValue* context, HValue* left, HValue* right) |
- : HBitwiseBinaryOperation(context, left, right) { } |
+ HShl(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
}; |
class HShr final : public HBitwiseBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
bool TryDecompose(DecompositionResult* decomposition) override { |
if (right()->IsInteger32Constant()) { |
@@ -5154,15 +5182,16 @@ class HShr final : public HBitwiseBinaryOperation { |
bool DataEquals(HValue* other) override { return true; } |
private: |
- HShr(HValue* context, HValue* left, HValue* right) |
- : HBitwiseBinaryOperation(context, left, right) { } |
+ HShr(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
}; |
class HSar final : public HBitwiseBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY); |
bool TryDecompose(DecompositionResult* decomposition) override { |
if (right()->IsInteger32Constant()) { |
@@ -5191,16 +5220,17 @@ class HSar final : public HBitwiseBinaryOperation { |
bool DataEquals(HValue* other) override { return true; } |
private: |
- HSar(HValue* context, HValue* left, HValue* right) |
- : HBitwiseBinaryOperation(context, left, right) { } |
+ HSar(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
}; |
class HRor final : public HBitwiseBinaryOperation { |
public: |
static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
- HValue* left, HValue* right) { |
- return new(zone) HRor(context, left, right); |
+ HValue* left, HValue* right, |
+ LanguageMode language_mode = SLOPPY) { |
+ return new(zone) HRor(context, left, right, language_mode); |
} |
virtual void UpdateRepresentation(Representation new_rep, |
@@ -5216,8 +5246,8 @@ class HRor final : public HBitwiseBinaryOperation { |
bool DataEquals(HValue* other) override { return true; } |
private: |
- HRor(HValue* context, HValue* left, HValue* right) |
- : HBitwiseBinaryOperation(context, left, right) { |
+ HRor(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
+ : HBitwiseBinaryOperation(context, left, right, language_mode) { |
ChangeRepresentation(Representation::Integer32()); |
} |
}; |
@@ -7234,7 +7264,8 @@ class HStringAdd final : public HBinaryOperation { |
public: |
static HInstruction* New( |
Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
- HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, |
+ HValue* right, LanguageMode language_mode = SLOPPY, |
+ PretenureFlag pretenure_flag = NOT_TENURED, |
StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
@@ -7259,10 +7290,11 @@ class HStringAdd final : public HBinaryOperation { |
HStringAdd(HValue* context, |
HValue* left, |
HValue* right, |
+ LanguageMode language_mode, |
PretenureFlag pretenure_flag, |
StringAddFlags flags, |
Handle<AllocationSite> allocation_site) |
- : HBinaryOperation(context, left, right, HType::String()), |
+ : HBinaryOperation(context, left, right, language_mode, HType::String()), |
flags_(flags), pretenure_flag_(pretenure_flag) { |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |