Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: src/hydrogen-instructions.h

Issue 12208013: Separated smi check from HBoundsCheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 53f1b65755beaa3cbaa3ada0086830d60529bc27..55f3f8dd9e41ad2772001b2ecbeaa7cab7e1572a 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -92,6 +92,7 @@ class LChunkBuilder;
V(CheckNonSmi) \
V(CheckPrototypeMaps) \
V(CheckSmi) \
+ V(CheckSmiOrInt32) \
V(ClampToUint8) \
V(ClassOfTestAndBranch) \
V(CompareIDAndBranch) \
@@ -2612,6 +2613,30 @@ class HCheckSmi: public HUnaryOperation {
};
+class HCheckSmiOrInt32: public HUnaryOperation {
+ public:
+ explicit HCheckSmiOrInt32(HValue* value) : HUnaryOperation(value) {
+ SetFlag(kFlexibleRepresentation);
+ 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(CheckSmiOrInt32)
+
+ protected:
+ virtual bool DataEquals(HValue* other) { return true; }
+};
+
+
class HPhi: public HValue {
public:
HPhi(int merged_index, Zone* zone)
@@ -2807,6 +2832,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,17 +3114,25 @@ enum BoundsCheckKeyMode {
};
+class HGraphBuilder;
Jakob Kummerow 2013/02/07 16:17:14 still there?
Massi 2013/02/11 10:35:55 Done.
+
+
class HBoundsCheck: public HTemplateInstruction<2> {
public:
+ // Normally HBoundsCheck should be created using the
+ // HGraphBuilder::AddBoundsCheck() helper, which also guards the index with
+ // a HCheckSmiOrInt32 check.
+ // However when building stubs, where we know that the arguments are Int32,
+ // it makes sense to invoke this constructor directly.
HBoundsCheck(HValue* index, HValue* length,
Jakob Kummerow 2013/02/07 16:17:14 nit: in function/method/ctor definitions (as oppos
Massi 2013/02/11 10:35:55 Done.
BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY,
Representation r = Representation::None())
- : key_mode_(key_mode) {
+ : key_mode_(key_mode), skip_check_(false) {
Jakob Kummerow 2013/02/07 16:17:14 nit: now I want less indentation here :-) (the ':'
Massi 2013/02/11 10:35:55 Done.
SetOperandAt(0, index);
SetOperandAt(1, length);
if (r.IsNone()) {
// In the normal compilation pipeline the representation is flexible
- // (see comment to RequiredInputRepresentation).
+ // (see InferRepresentation).
SetFlag(kFlexibleRepresentation);
} else {
// When compiling stubs we want to set the representation explicitly
@@ -3106,6 +3142,9 @@ class HBoundsCheck: public HTemplateInstruction<2> {
SetFlag(kUseGVN);
}
+ 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();
}
@@ -3126,6 +3165,7 @@ class HBoundsCheck: public HTemplateInstruction<2> {
protected:
virtual bool DataEquals(HValue* other) { return true; }
BoundsCheckKeyMode key_mode_;
+ bool skip_check_;
};

Powered by Google App Engine
This is Rietveld 408576698