Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 53f1b65755beaa3cbaa3ada0086830d60529bc27..b8e055ea75abd30dfb2871e2275be1af26203f49 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -104,6 +104,7 @@ class LChunkBuilder; |
V(DeclareGlobals) \ |
V(DeleteProperty) \ |
V(Deoptimize) \ |
+ V(DeoptimizeIfTaggedIsNotSmi) \ |
V(Div) \ |
V(DummyUse) \ |
V(ElementsKind) \ |
@@ -2612,6 +2613,41 @@ class HCheckSmi: public HUnaryOperation { |
}; |
+class HDeoptimizeIfTaggedIsNotSmi: public HUnaryOperation { |
Jakob Kummerow
2013/02/06 13:43:59
For consistency with HCheckSmi, I'd call this HChe
Massi
2013/02/06 19:12:31
Done.
|
+ public: |
+ explicit HDeoptimizeIfTaggedIsNotSmi( |
Jakob Kummerow
2013/02/06 13:43:59
no "explicit" necessary (unless you remove the Rep
Massi
2013/02/06 19:12:31
Done.
|
+ HValue* value, |
+ Representation r = Representation::None()) |
+ : HUnaryOperation(value) { |
+ if (r.IsNone()) { |
+ // In the normal compilation pipeline the representation is flexible |
+ // (see InferRepresentation). |
+ SetFlag(kFlexibleRepresentation); |
+ } else { |
Jakob Kummerow
2013/02/06 13:43:59
I don't think we need this case. This instruction
Massi
2013/02/06 19:12:31
Done.
|
+ // When compiling stubs we want to set the representation explicitly |
+ // so the compilation pipeline can skip the HInferRepresentation phase. |
+ set_representation(r); |
+ } |
+ SetFlag(kUseGVN); |
+ } |
+ |
+ virtual int RedefinedOperandIndex() { return 0; } |
+ virtual Representation RequiredInputRepresentation(int index) { |
+ return representation(); |
+ } |
+ virtual void InferRepresentation(HInferRepresentation* h_infer); |
+ |
+#ifdef DEBUG |
+ virtual void Verify(); |
+#endif |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(DeoptimizeIfTaggedIsNotSmi) |
+ |
+ protected: |
+ virtual bool DataEquals(HValue* other) { return true; } |
+}; |
+ |
+ |
class HPhi: public HValue { |
public: |
HPhi(int merged_index, Zone* zone) |
@@ -2807,6 +2843,9 @@ class HConstant: public HTemplateInstruction<0> { |
ASSERT(HasInteger32Value()); |
return int32_value_; |
} |
+ bool HasSmiValue() const { |
+ return HasInteger32Value() && Smi::IsValid(Integer32Value()); |
+ } |
bool HasDoubleValue() const { return has_double_value_; } |
double DoubleValue() const { |
ASSERT(HasDoubleValue()); |
@@ -3086,25 +3125,21 @@ enum BoundsCheckKeyMode { |
}; |
+class HGraphBuilder; |
Jakob Kummerow
2013/02/06 13:43:59
Please don't do this. Instead, move the insertion
Massi
2013/02/06 19:12:31
Done.
|
+ |
+ |
class HBoundsCheck: public HTemplateInstruction<2> { |
public: |
- HBoundsCheck(HValue* index, HValue* length, |
- BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
- Representation r = Representation::None()) |
- : key_mode_(key_mode) { |
- SetOperandAt(0, index); |
- SetOperandAt(1, length); |
- if (r.IsNone()) { |
- // In the normal compilation pipeline the representation is flexible |
- // (see comment to RequiredInputRepresentation). |
- SetFlag(kFlexibleRepresentation); |
- } else { |
- // When compiling stubs we want to set the representation explicitly |
- // so the compilation pipeline can skip the HInferRepresentation phase. |
- set_representation(r); |
- } |
- SetFlag(kUseGVN); |
- } |
+ static HBoundsCheck* AddAfter( |
+ HInstruction* insertion_point, HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
+ Representation r = Representation::None()); |
+ static HBoundsCheck* AddToGraph( |
+ HGraphBuilder* graph_builder, HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
+ Representation r = Representation::None()); |
+ bool skip_check() { return skip_check_; } |
+ void set_skip_check(bool skip_check) { skip_check_ = skip_check; } |
virtual Representation RequiredInputRepresentation(int arg_index) { |
return representation(); |
@@ -3124,8 +3159,27 @@ class HBoundsCheck: public HTemplateInstruction<2> { |
DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
protected: |
+ HBoundsCheck(HValue* index, HValue* length, |
+ BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
+ Representation r = Representation::None()) |
+ : key_mode_(key_mode), skip_check_(false) { |
Jakob Kummerow
2013/02/06 13:43:59
nit: more indentation
Massi
2013/02/06 19:12:31
Done.
|
+ SetOperandAt(0, index); |
+ SetOperandAt(1, length); |
+ if (r.IsNone()) { |
+ // In the normal compilation pipeline the representation is flexible |
+ // (see InferRepresentation). |
+ SetFlag(kFlexibleRepresentation); |
+ } else { |
+ // When compiling stubs we want to set the representation explicitly |
+ // so the compilation pipeline can skip the HInferRepresentation phase. |
+ set_representation(r); |
+ } |
+ SetFlag(kUseGVN); |
+ } |
+ |
virtual bool DataEquals(HValue* other) { return true; } |
BoundsCheckKeyMode key_mode_; |
+ bool skip_check_; |
}; |