Index: src/hydrogen-instructions.h |
=================================================================== |
--- src/hydrogen-instructions.h (revision 9808) |
+++ src/hydrogen-instructions.h (working copy) |
@@ -171,6 +171,7 @@ |
V(Throw) \ |
V(ToFastProperties) \ |
V(ToInt32) \ |
+ V(TransitionElementsKind) \ |
V(Typeof) \ |
V(TypeofIsAndBranch) \ |
V(UnaryMathOperation) \ |
@@ -397,6 +398,11 @@ |
return type_ == kUninitialized; |
} |
+ bool IsHeapObject() { |
+ ASSERT(type_ != kUninitialized); |
+ return IsHeapNumber() || IsString() || IsNonPrimitive(); |
+ } |
+ |
static HType TypeFromValue(Handle<Object> value); |
const char* ToString(); |
@@ -1101,12 +1107,14 @@ |
ASSERT(!value->representation().IsNone() && !to.IsNone()); |
ASSERT(!value->representation().Equals(to)); |
set_representation(to); |
+ set_type(HType::TaggedNumber()); |
SetFlag(kUseGVN); |
if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); |
if (is_truncating) SetFlag(kTruncatingToInt32); |
} |
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
+ virtual HType CalculateInferredType(); |
Representation from() { return value()->representation(); } |
Representation to() { return representation(); } |
@@ -1340,7 +1348,7 @@ |
class HThisFunction: public HTemplateInstruction<0> { |
public: |
- HThisFunction() { |
+ explicit HThisFunction(Handle<JSFunction> closure) : closure_(closure) { |
set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
} |
@@ -1349,10 +1357,18 @@ |
return Representation::None(); |
} |
+ Handle<JSFunction> closure() const { return closure_; } |
+ |
DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
protected: |
- virtual bool DataEquals(HValue* other) { return true; } |
+ virtual bool DataEquals(HValue* other) { |
+ HThisFunction* b = HThisFunction::cast(other); |
+ return *closure() == *b->closure(); |
+ } |
+ |
+ private: |
+ Handle<JSFunction> closure_; |
}; |
@@ -2280,6 +2296,7 @@ |
} |
virtual bool EmitAtUses() { return !representation().IsDouble(); } |
+ virtual HValue* Canonicalize(); |
virtual void PrintDataTo(StringStream* stream); |
virtual HType CalculateInferredType(); |
bool IsInteger() const { return handle_->IsSmi(); } |
@@ -3260,6 +3277,13 @@ |
}; |
+static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
+ return !value->type().IsBoolean() |
+ && !value->type().IsSmi() |
+ && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
+} |
+ |
+ |
class HStoreGlobalCell: public HUnaryOperation { |
public: |
HStoreGlobalCell(HValue* value, |
@@ -3275,6 +3299,9 @@ |
bool RequiresHoleCheck() { |
return !details_.IsDontDelete() || details_.IsReadOnly(); |
} |
+ bool NeedsWriteBarrier() { |
+ return StoringValueNeedsWriteBarrier(value()); |
+ } |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
@@ -3355,13 +3382,6 @@ |
}; |
-static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
- return !value->type().IsBoolean() |
- && !value->type().IsSmi() |
- && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
-} |
- |
- |
class HStoreContextSlot: public HTemplateInstruction<2> { |
public: |
HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
@@ -3700,9 +3720,9 @@ |
HValue* object, |
Handle<String> name, |
HValue* value, |
- bool strict_mode) |
+ StrictModeFlag strict_mode_flag) |
: name_(name), |
- strict_mode_(strict_mode) { |
+ strict_mode_flag_(strict_mode_flag) { |
SetOperandAt(0, object); |
SetOperandAt(1, value); |
SetOperandAt(2, context); |
@@ -3713,7 +3733,7 @@ |
HValue* value() { return OperandAt(1); } |
HValue* context() { return OperandAt(2); } |
Handle<String> name() { return name_; } |
- bool strict_mode() { return strict_mode_; } |
+ StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } |
virtual void PrintDataTo(StringStream* stream); |
@@ -3725,7 +3745,7 @@ |
private: |
Handle<String> name_; |
- bool strict_mode_; |
+ StrictModeFlag strict_mode_flag_; |
}; |
@@ -3886,6 +3906,44 @@ |
}; |
+class HTransitionElementsKind: public HTemplateInstruction<1> { |
+ public: |
+ HTransitionElementsKind(HValue* object, |
+ Handle<Map> original_map, |
+ Handle<Map> transitioned_map) |
+ : original_map_(original_map), |
+ transitioned_map_(transitioned_map) { |
+ SetOperandAt(0, object); |
+ SetFlag(kUseGVN); |
+ SetFlag(kDependsOnMaps); |
+ set_representation(Representation::Tagged()); |
+ } |
+ |
+ virtual Representation RequiredInputRepresentation(int index) { |
+ return Representation::Tagged(); |
+ } |
+ |
+ HValue* object() { return OperandAt(0); } |
+ Handle<Map> original_map() { return original_map_; } |
+ Handle<Map> transitioned_map() { return transitioned_map_; } |
+ |
+ virtual void PrintDataTo(StringStream* stream); |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
+ |
+ protected: |
+ virtual bool DataEquals(HValue* other) { |
+ HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
+ return original_map_.is_identical_to(instr->original_map()) && |
+ transitioned_map_.is_identical_to(instr->transitioned_map()); |
+ } |
+ |
+ private: |
+ Handle<Map> original_map_; |
+ Handle<Map> transitioned_map_; |
+}; |
+ |
+ |
class HStringAdd: public HBinaryOperation { |
public: |
HStringAdd(HValue* context, HValue* left, HValue* right) |
@@ -3948,7 +4006,7 @@ |
HStringCharFromCode(HValue* context, HValue* char_code) { |
SetOperandAt(0, context); |
SetOperandAt(1, char_code); |
- set_representation(Representation::Tagged()); |
+ set_representation(Representation::Tagged()); |
SetFlag(kUseGVN); |
} |
@@ -3957,6 +4015,7 @@ |
? Representation::Tagged() |
: Representation::Integer32(); |
} |
+ virtual HType CalculateInferredType(); |
HValue* context() { return OperandAt(0); } |
HValue* value() { return OperandAt(1); } |
@@ -4034,6 +4093,7 @@ |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
} |
+ virtual HType CalculateInferredType(); |
DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
@@ -4068,6 +4128,7 @@ |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
} |
+ virtual HType CalculateInferredType(); |
DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
@@ -4097,6 +4158,7 @@ |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
} |
+ virtual HType CalculateInferredType(); |
DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
@@ -4121,6 +4183,7 @@ |
virtual Representation RequiredInputRepresentation(int index) { |
return Representation::Tagged(); |
} |
+ virtual HType CalculateInferredType(); |
DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
@@ -4144,6 +4207,7 @@ |
HValue* context() { return OperandAt(0); } |
HValue* value() { return OperandAt(1); } |
+ virtual HValue* Canonicalize(); |
virtual void PrintDataTo(StringStream* stream); |
virtual Representation RequiredInputRepresentation(int index) { |