Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 6c516f2497e01ae6e63a9cca6f241d55d2929172..6a7623ff401f4bc21b2de84086d36ad8f6203a92 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -161,16 +161,18 @@ class LChunkBuilder; |
| V(UnknownOSRValue) \ |
| V(ValueOf) |
| +// The list of GVN flags. To improve memory usage it should start with |
| +// the flags that allow parameters. |
| #define GVN_FLAG_LIST(V) \ |
| - V(Calls) \ |
| V(InobjectFields) \ |
| V(BackingStoreFields) \ |
| + V(GlobalVars) \ |
| + V(ContextSlots) \ |
| + V(Calls) \ |
| V(ArrayElements) \ |
| V(PixelArrayElements) \ |
| - V(GlobalVars) \ |
| V(Maps) \ |
| V(ArrayLengths) \ |
| - V(ContextSlots) \ |
| V(OsrEntries) |
| #define DECLARE_INSTRUCTION(type) \ |
| @@ -408,11 +410,13 @@ class HValue: public ZoneObject { |
| #undef DECLARE_DO |
| kFlexibleRepresentation, |
| kUseGVN, |
| + kHasGVNParameter, |
| kCanOverflow, |
| kBailoutOnMinusZero, |
| kCanBeDivByZero, |
| kIsArguments, |
| kTruncatingToInt32, |
| + kFirstNonGVNFlag = kFlexibleRepresentation, |
| kLastFlag = kTruncatingToInt32 |
| }; |
| @@ -436,6 +440,9 @@ class HValue: public ZoneObject { |
| static int ConvertChangesToDependsFlags(int flags) { |
| return flags << kChangesToDependsFlagsLeftShift; |
| } |
| + static int ConvertDependsToChangesFlags(int flags) { |
| + return flags >> kChangesToDependsFlagsLeftShift; |
| + } |
| static HValue* cast(HValue* value) { return value; } |
| @@ -549,6 +556,11 @@ class HValue: public ZoneObject { |
| bool Equals(HValue* other); |
| virtual intptr_t Hashcode(); |
| + virtual intptr_t GetGVNParameter() { |
| + UNREACHABLE(); |
| + return 0; |
| + } |
| + |
| // Printing support. |
| virtual void PrintTo(StringStream* stream) = 0; |
| void PrintNameTo(StringStream* stream); |
| @@ -2781,6 +2793,11 @@ class HLoadGlobal: public HTemplateInstruction<0> { |
| set_representation(Representation::Tagged()); |
| SetFlag(kUseGVN); |
| SetFlag(kDependsOnGlobalVars); |
| + SetFlag(kHasGVNParameter); |
| + } |
| + |
| + virtual intptr_t GetGVNParameter() { |
| + return reinterpret_cast<intptr_t>(*cell_); |
| } |
| Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| @@ -2820,6 +2837,11 @@ class HStoreGlobal: public HUnaryOperation { |
| cell_(cell), |
| check_hole_value_(check_hole_value) { |
| SetFlag(kChangesGlobalVars); |
| + SetFlag(kHasGVNParameter); |
| + } |
| + |
| + virtual intptr_t GetGVNParameter() { |
| + return reinterpret_cast<intptr_t>(*cell_); |
| } |
| Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| @@ -2845,8 +2867,11 @@ class HLoadContextSlot: public HUnaryOperation { |
| set_representation(Representation::Tagged()); |
| SetFlag(kUseGVN); |
| SetFlag(kDependsOnContextSlots); |
| + SetFlag(kHasGVNParameter); |
| } |
| + virtual intptr_t GetGVNParameter() { return slot_index_; } |
| + |
| int slot_index() const { return slot_index_; } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| @@ -2879,8 +2904,11 @@ class HStoreContextSlot: public HBinaryOperation { |
| HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
| : HBinaryOperation(context, value), slot_index_(slot_index) { |
| SetFlag(kChangesContextSlots); |
| + SetFlag(kHasGVNParameter); |
| } |
| + virtual intptr_t GetGVNParameter() { return slot_index_; } |
| + |
| HValue* context() { return OperandAt(0); } |
| HValue* value() { return OperandAt(1); } |
| int slot_index() const { return slot_index_; } |
| @@ -2915,6 +2943,11 @@ class HLoadNamedField: public HUnaryOperation { |
| } else { |
| SetFlag(kDependsOnBackingStoreFields); |
| } |
| + SetFlag(kHasGVNParameter); |
| + } |
| + |
| + virtual intptr_t GetGVNParameter() { |
| + return (offset_ << 1) || (is_in_object_ ? 1 : 0); |
|
fschneider
2011/03/16 15:43:28
Shouldn't be this bitwise-or "|"?
|
| } |
| HValue* object() { return OperandAt(0); } |
| @@ -3083,6 +3116,11 @@ class HStoreNamedField: public HBinaryOperation { |
| } else { |
| SetFlag(kChangesBackingStoreFields); |
| } |
| + SetFlag(kHasGVNParameter); |
| + } |
| + |
| + virtual intptr_t GetGVNParameter() { |
| + return (offset_ << 1) || (is_in_object_ ? 1 : 0); |
|
fschneider
2011/03/16 15:43:28
-> use "|" here as well.
|
| } |
| DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") |
| @@ -3099,7 +3137,15 @@ class HStoreNamedField: public HBinaryOperation { |
| bool is_in_object() const { return is_in_object_; } |
| int offset() const { return offset_; } |
| Handle<Map> transition() const { return transition_; } |
| - void set_transition(Handle<Map> map) { transition_ = map; } |
| + void SetTransition(Handle<Map> map) { |
| + transition_ = map; |
| + // TODO(fschneider): Record the new map type of the object in the IR to |
| + // enable elimination of redundant checks after the transition store. |
| + SetFlag(kChangesMaps); |
| + // TODO(vitalyr): GVN parameter is only supported for instructions |
| + // that have a single GVN flag. |
| + ClearFlag(kHasGVNParameter); |
| + } |
| bool NeedsWriteBarrier() { |
| return StoringValueNeedsWriteBarrier(value()); |