Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 875b631595d3893e3e168285c0158e1572c33aac..b9df2ecba1e5ec461f036f9a48cdfd78c28adc00 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -1873,6 +1873,7 @@ class HJSArrayLength: public HTemplateInstruction<2> { |
class HFixedArrayBaseLength: public HUnaryOperation { |
public: |
explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
+ set_type(HType::Smi()); |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
SetGVNFlag(kDependsOnArrayLengths); |
@@ -2742,17 +2743,31 @@ class HAccessArgumentsAt: public HTemplateInstruction<3> { |
}; |
+enum BoundsCheckKeyMode { |
+ DONT_ALLOW_SMI_KEY, |
+ ALLOW_SMI_KEY |
+}; |
+ |
+ |
class HBoundsCheck: public HTemplateInstruction<2> { |
public: |
- HBoundsCheck(HValue* index, HValue* length) { |
+ HBoundsCheck(HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY) |
+ : key_mode_(key_mode) { |
SetOperandAt(0, index); |
SetOperandAt(1, length); |
set_representation(Representation::Integer32()); |
SetFlag(kUseGVN); |
} |
- virtual Representation RequiredInputRepresentation(int index) { |
- return Representation::Integer32(); |
+ virtual Representation RequiredInputRepresentation(int arg_index) { |
+ if (index()->representation().IsTagged() && |
+ !index()->IsConstant() && |
+ key_mode_ == ALLOW_SMI_KEY) { |
+ return Representation::Tagged(); |
+ } else { |
+ return Representation::Integer32(); |
+ } |
} |
virtual void PrintDataTo(StringStream* stream); |
@@ -2764,6 +2779,7 @@ class HBoundsCheck: public HTemplateInstruction<2> { |
protected: |
virtual bool DataEquals(HValue* other) { return true; } |
+ BoundsCheckKeyMode key_mode_; |
}; |