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

Unified Diff: src/hydrogen-instructions.h

Issue 7170012: Crankshaft support for polymorphic array handling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 21994839d1dd14f01b5cce6a7afa7662ea8ee8d4..e031b725092e89eae47a2a29aaddf0c3933a6e58 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -94,11 +94,13 @@ class LChunkBuilder;
V(CompareJSObjectEq) \
V(CompareMap) \
V(CompareSymbolEq) \
+ V(CompareWithConstant) \
V(Constant) \
V(Context) \
V(DeleteProperty) \
V(Deoptimize) \
V(Div) \
+ V(ElementsKind) \
V(EnterInlined) \
V(ExternalArrayLength) \
V(FixedArrayLength) \
@@ -402,7 +404,7 @@ class HType {
kBoolean = 0x85, // 0000 0000 1000 0101
kNonPrimitive = 0x101, // 0000 0001 0000 0001
kJSObject = 0x301, // 0000 0011 0000 0001
- kJSArray = 0x701, // 0000 0111 1000 0001
fschneider 2011/06/15 12:11:46 Accidental edit?
Jakob Kummerow 2011/06/15 12:28:58 Nope. In a drive-by fashion, I noticed that commen
+ kJSArray = 0x701, // 0000 0111 0000 0001
kUninitialized = 0x1fff // 0001 1111 1111 1111
};
@@ -484,7 +486,10 @@ class HValue: public ZoneObject {
GVN_FLAG_LIST(DECLARE_DO)
#undef DECLARE_DO
kFlexibleRepresentation,
- kUseGVN,
+ kUseGVN, // Participate in Global Value Numbering, i.e. elimination of
fschneider 2011/06/15 12:11:46 I'd insert the comment in a separate line before k
Jakob Kummerow 2011/06/15 12:28:58 Done.
+ // unnecessary recomputations. If an instruction sets this flag, it must
+ // implement DataEquals(), which will be used to determine if other
+ // occurrences of the instruction are indeed the same.
kCanOverflow,
kBailoutOnMinusZero,
kCanBeDivByZero,
@@ -1707,6 +1712,25 @@ class HExternalArrayLength: public HUnaryOperation {
};
+class HElementsKind: public HUnaryOperation {
+ public:
+ explicit HElementsKind(HValue* value) : HUnaryOperation(value) {
+ set_representation(Representation::Integer32());
+ SetFlag(kUseGVN);
+ SetFlag(kDependsOnMaps);
+ }
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(ElementsKind)
+
+ protected:
+ virtual bool DataEquals(HValue* other) { return true; }
+};
+
+
class HBitNot: public HUnaryOperation {
public:
explicit HBitNot(HValue* value) : HUnaryOperation(value) {
@@ -2589,6 +2613,43 @@ class HCompareSymbolEq: public HBinaryOperation {
};
+class HCompareWithConstant: public HUnaryOperation {
+ public:
+ HCompareWithConstant(HValue* left, int right, Token::Value op)
+ : HUnaryOperation(left), op_(op), right_(right) {
+ ASSERT(op == Token::EQ || op == Token::EQ_STRICT);
+ set_representation(Representation::Tagged());
+ SetFlag(kUseGVN);
+ }
+
+ Token::Value op() const { return op_; }
+ int right() const { return right_; }
+
+ virtual bool EmitAtUses() {
+ return !HasSideEffects() && !HasMultipleUses();
+ }
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Integer32();
+ }
+
+ virtual HType CalculateInferredType() { return HType::Boolean(); }
+
+ DECLARE_CONCRETE_INSTRUCTION(CompareWithConstant);
+
+ protected:
+ virtual bool DataEquals(HValue* other) {
+ HCompareWithConstant* other_instr = HCompareWithConstant::cast(other);
+ return (op_ == other_instr->op_ &&
+ right_ == other_instr->right_);
+ }
+
+ private:
+ const Token::Value op_;
+ const int right_;
+};
+
+
class HUnaryPredicate: public HUnaryOperation {
public:
explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) {
@@ -2694,6 +2755,10 @@ class HHasInstanceType: public HUnaryPredicate {
InstanceType from() { return from_; }
InstanceType to() { return to_; }
+ virtual bool EmitAtUses() {
+ return !HasSideEffects() && !HasMultipleUses();
+ }
+
virtual void PrintDataTo(StringStream* stream);
DECLARE_CONCRETE_INSTRUCTION(HasInstanceType)

Powered by Google App Engine
This is Rietveld 408576698