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

Unified Diff: src/hydrogen-instructions.h

Issue 11962041: Revert r13409 ("Make the array bounds check elimination phase optional (and set the foundation for … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 9d2591b3c2b0ee190bdebd6fb74202c13c29ab39..a9cb99ea45e250f067144948f96f71a68c2b571a 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -672,14 +672,6 @@ class HValue: public ZoneObject {
return NULL;
}
- // There are HInstructions that do not really change a value, they
- // only add pieces of information to it (like bounds checks, map checks
- // or SSI definitions after conditional branches).
- // This method must always return the original HValue SSA definition (the
- // register allocator relies on this to avoid allocating multiple registers
- // for the same value).
- virtual HValue* ActualValue() { return this; }
-
bool IsDefinedAfter(HBasicBlock* other) const;
// Operands.
@@ -2965,40 +2957,44 @@ enum BoundsCheckKeyMode {
class HBoundsCheck: public HTemplateInstruction<2> {
public:
HBoundsCheck(HValue* index, HValue* length,
- BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY,
- Representation r = Representation::None())
+ BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY)
: 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);
- }
+ set_representation(Representation::Integer32());
SetFlag(kUseGVN);
}
virtual Representation RequiredInputRepresentation(int arg_index) {
- return representation();
+ if (key_mode_ == DONT_ALLOW_SMI_KEY ||
+ !length()->representation().IsTagged()) {
+ return Representation::Integer32();
+ }
+ // If the index is tagged and isn't constant, then allow the length
+ // to be tagged, since it is usually already tagged from loading it out of
+ // the length field of a JSArray. This allows for direct comparison without
+ // untagging.
+ if (index()->representation().IsTagged() && !index()->IsConstant()) {
+ return Representation::Tagged();
+ }
+ // Also allow the length to be tagged if the index is constant, because
+ // it can be tagged to allow direct comparison.
+ if (index()->IsConstant() &&
+ index()->representation().IsInteger32() &&
+ arg_index == 1) {
+ return Representation::Tagged();
+ }
+ return Representation::Integer32();
}
virtual Representation observed_input_representation(int index) {
return Representation::Integer32();
}
virtual void PrintDataTo(StringStream* stream);
- virtual void InferRepresentation(HInferRepresentation* h_infer);
HValue* index() { return OperandAt(0); }
HValue* length() { return OperandAt(1); }
- virtual HValue* ActualValue() {
- return index();
- }
-
DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
protected:
@@ -4369,11 +4365,6 @@ class ArrayInstructionInterface {
virtual bool IsDehoisted() = 0;
virtual void SetDehoisted(bool is_dehoisted) = 0;
virtual ~ArrayInstructionInterface() { };
-
- static Representation KeyedAccessIndexRequirement(Representation r) {
- return r.IsInteger32()
- ? Representation::Integer32() : Representation::Tagged();
- }
};
@@ -4457,10 +4448,7 @@ class HLoadKeyed
return is_external() ? Representation::External()
: Representation::Tagged();
}
- if (index == 1) {
- return ArrayInstructionInterface::KeyedAccessIndexRequirement(
- OperandAt(1)->representation());
- }
+ if (index == 1) return Representation::Integer32();
return Representation::None();
}
@@ -4675,8 +4663,7 @@ class HStoreKeyed
return is_external() ? Representation::External()
: Representation::Tagged();
} else if (index == 1) {
- return ArrayInstructionInterface::KeyedAccessIndexRequirement(
- OperandAt(1)->representation());
+ return Representation::Integer32();
}
ASSERT_EQ(index, 2);
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698