Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index a0cab6aed1655deb8a6d5a1ba3a198dc39a6afae..95bfa4a58dafd72cc01295fde830a13974e7c106 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -1012,9 +1012,11 @@ class HUnaryOperation: public HTemplateInstruction<1> { |
| }; |
| -class HThrow: public HUnaryOperation { |
| +class HThrow: public HTemplateInstruction<2> { |
| public: |
| - explicit HThrow(HValue* value) : HUnaryOperation(value) { |
| + HThrow(HValue* context, HValue* value) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, value); |
| SetAllSideEffects(); |
| } |
| @@ -1022,6 +1024,9 @@ class HThrow: public HUnaryOperation { |
| return Representation::Tagged(); |
| } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* value() { return OperandAt(1); } |
| + |
| DECLARE_CONCRETE_INSTRUCTION(Throw) |
| }; |
| @@ -1095,8 +1100,7 @@ class HChange: public HUnaryOperation { |
| virtual bool DataEquals(HValue* other) { |
| if (!other->IsChange()) return false; |
| HChange* change = HChange::cast(other); |
| - return value() == change->value() |
| - && to().Equals(change->to()) |
| + return to().Equals(change->to()) |
| && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
| } |
| @@ -1245,17 +1249,21 @@ class HSimulate: public HInstruction { |
| }; |
| -class HStackCheck: public HTemplateInstruction<0> { |
| +class HStackCheck: public HTemplateInstruction<1> { |
| public: |
| enum Type { |
| kFunctionEntry, |
| kBackwardsBranch |
| }; |
| - explicit HStackCheck(Type type) : type_(type) { } |
| + explicit HStackCheck(HValue* context, Type type) : type_(type) { |
| + SetOperandAt(0, context); |
| + } |
| + |
| + HValue* context() { return OperandAt(0); } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return Representation::None(); |
| + return Representation::Tagged(); |
| } |
| void Eliminate() { |
| @@ -1636,19 +1644,24 @@ class HCallNew: public HBinaryCall { |
| }; |
| -class HCallRuntime: public HCall<0> { |
| +class HCallRuntime: public HCall<1> { |
| public: |
| - HCallRuntime(Handle<String> name, |
| + HCallRuntime(HValue* context, |
| + Handle<String> name, |
| const Runtime::Function* c_function, |
| int argument_count) |
| - : HCall<0>(argument_count), c_function_(c_function), name_(name) { } |
| + : HCall<1>(argument_count), c_function_(c_function), name_(name) { |
| + SetOperandAt(0, context); |
| + } |
| + |
| virtual void PrintDataTo(StringStream* stream); |
| + HValue* context() { return OperandAt(0); } |
| const Runtime::Function* function() const { return c_function_; } |
| Handle<String> name() const { return name_; } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return Representation::None(); |
| + return Representation::Tagged(); |
| } |
| DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
| @@ -1761,10 +1774,12 @@ class HBitNot: public HUnaryOperation { |
| }; |
| -class HUnaryMathOperation: public HUnaryOperation { |
| +class HUnaryMathOperation: public HTemplateInstruction<2> { |
| public: |
| - HUnaryMathOperation(HValue* value, BuiltinFunctionId op) |
| - : HUnaryOperation(value), op_(op) { |
| + HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
| + : op_(op) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, value); |
| switch (op) { |
| case kMathFloor: |
| case kMathRound: |
| @@ -1788,6 +1803,9 @@ class HUnaryMathOperation: public HUnaryOperation { |
| SetFlag(kUseGVN); |
| } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* value() { return OperandAt(1); } |
| + |
| virtual void PrintDataTo(StringStream* stream); |
| virtual HType CalculateInferredType(); |
| @@ -1795,21 +1813,25 @@ class HUnaryMathOperation: public HUnaryOperation { |
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - switch (op_) { |
| - case kMathFloor: |
| - case kMathRound: |
| - case kMathCeil: |
| - case kMathSqrt: |
| - case kMathPowHalf: |
| - case kMathLog: |
| - case kMathSin: |
| - case kMathCos: |
| - return Representation::Double(); |
| - case kMathAbs: |
| - return representation(); |
| - default: |
| - UNREACHABLE(); |
| - return Representation::None(); |
| + if (index == 0) { |
| + return Representation::Tagged(); |
| + } else { |
| + switch (op_) { |
| + case kMathFloor: |
| + case kMathRound: |
| + case kMathCeil: |
| + case kMathSqrt: |
| + case kMathPowHalf: |
| + case kMathLog: |
| + case kMathSin: |
| + case kMathCos: |
| + return Representation::Double(); |
| + case kMathAbs: |
| + return representation(); |
| + default: |
| + UNREACHABLE(); |
| + return Representation::None(); |
| + } |
| } |
| } |
| @@ -2312,16 +2334,18 @@ class HConstant: public HTemplateInstruction<0> { |
| }; |
| -class HBinaryOperation: public HTemplateInstruction<2> { |
| +class HBinaryOperation: public HTemplateInstruction<3> { |
| public: |
| - HBinaryOperation(HValue* left, HValue* right) { |
| + HBinaryOperation(HValue* context, HValue* left, HValue* right) { |
| ASSERT(left != NULL && right != NULL); |
| - SetOperandAt(0, left); |
| - SetOperandAt(1, right); |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, left); |
| + SetOperandAt(2, right); |
| } |
| - HValue* left() { return OperandAt(0); } |
| - HValue* right() { return OperandAt(1); } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* left() { return OperandAt(1); } |
| + HValue* right() { return OperandAt(2); } |
| // TODO(kasperl): Move these helpers to the IA-32 Lithium |
| // instruction sequence builder. |
| @@ -2437,10 +2461,11 @@ class HAccessArgumentsAt: public HTemplateInstruction<3> { |
| }; |
| -class HBoundsCheck: public HBinaryOperation { |
| +class HBoundsCheck: public HTemplateInstruction<2> { |
| public: |
| - HBoundsCheck(HValue* index, HValue* length) |
| - : HBinaryOperation(index, length) { |
| + HBoundsCheck(HValue* index, HValue* length) { |
| + SetOperandAt(0, index); |
| + SetOperandAt(1, length); |
| set_representation(Representation::Integer32()); |
| SetFlag(kUseGVN); |
| } |
| @@ -2453,8 +2478,8 @@ class HBoundsCheck: public HBinaryOperation { |
| virtual void Verify(); |
| #endif |
| - HValue* index() { return left(); } |
| - HValue* length() { return right(); } |
| + HValue* index() { return OperandAt(0); } |
| + HValue* length() { return OperandAt(1); } |
| DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
| @@ -2465,15 +2490,19 @@ class HBoundsCheck: public HBinaryOperation { |
| class HBitwiseBinaryOperation: public HBinaryOperation { |
| public: |
| - HBitwiseBinaryOperation(HValue* left, HValue* right) |
| - : HBinaryOperation(left, right) { |
| + HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
| + : HBinaryOperation(context, left, right) { |
| set_representation(Representation::Tagged()); |
| SetFlag(kFlexibleRepresentation); |
| SetAllSideEffects(); |
| } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return representation(); |
| + if (index == 0) { |
|
Kevin Millikin (Chromium)
2011/06/29 08:36:20
I sort of prefer
return (index == 0) ? Representa
William Hesse
2011/06/29 10:30:21
All changed to
return cond
? value1
: valu
|
| + return Representation::Tagged(); |
| + } else { |
| + return representation(); |
| + } |
| } |
| virtual void RepresentationChanged(Representation to) { |
| @@ -2493,8 +2522,8 @@ class HBitwiseBinaryOperation: public HBinaryOperation { |
| class HArithmeticBinaryOperation: public HBinaryOperation { |
| public: |
| - HArithmeticBinaryOperation(HValue* left, HValue* right) |
| - : HBinaryOperation(left, right) { |
| + HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
| + : HBinaryOperation(context, left, right) { |
| set_representation(Representation::Tagged()); |
| SetFlag(kFlexibleRepresentation); |
| SetAllSideEffects(); |
| @@ -2509,7 +2538,11 @@ class HArithmeticBinaryOperation: public HBinaryOperation { |
| virtual HType CalculateInferredType(); |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return representation(); |
| + if (index == 0) { |
| + return Representation::Tagged(); |
| + } else { |
| + return representation(); |
| + } |
| } |
| virtual Representation InferredRepresentation() { |
| if (left()->representation().Equals(right()->representation())) { |
| @@ -2522,8 +2555,8 @@ class HArithmeticBinaryOperation: public HBinaryOperation { |
| class HCompare: public HBinaryOperation { |
| public: |
| - HCompare(HValue* left, HValue* right, Token::Value token) |
| - : HBinaryOperation(left, right), token_(token) { |
| + HCompare(HValue* context, HValue* left, HValue* right, Token::Value token) |
| + : HBinaryOperation(context, left, right), token_(token) { |
| ASSERT(Token::IsCompareOp(token)); |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| @@ -2536,7 +2569,11 @@ class HCompare: public HBinaryOperation { |
| } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return input_representation_; |
| + if (index == 0) { |
| + return Representation::Tagged(); |
| + } else { |
| + return input_representation_; |
| + } |
| } |
| Representation GetInputRepresentation() const { |
| return input_representation_; |
| @@ -2564,15 +2601,19 @@ class HCompare: public HBinaryOperation { |
| }; |
| -class HCompareObjectEq: public HBinaryOperation { |
| +class HCompareObjectEq: public HTemplateInstruction<2> { |
| public: |
| - HCompareObjectEq(HValue* left, HValue* right) |
| - : HBinaryOperation(left, right) { |
| + HCompareObjectEq(HValue* left, HValue* right) { |
| + SetOperandAt(0, left); |
| + SetOperandAt(1, right); |
| set_representation(Representation::Tagged()); |
| SetFlag(kUseGVN); |
| SetFlag(kDependsOnMaps); |
| } |
| + HValue* left() { return OperandAt(0); } |
| + HValue* right() { return OperandAt(1); } |
| + |
| virtual bool EmitAtUses() { |
| return !HasSideEffects() && !HasMultipleUses(); |
| } |
| @@ -2600,6 +2641,7 @@ class HCompareConstantEq: public HUnaryOperation { |
| Token::Value op() const { return op_; } |
| int right() const { return right_; } |
| + HValue* left() { return value(); } |
|
Kevin Millikin (Chromium)
2011/06/29 08:36:20
It might make sense to define left() before right(
William Hesse
2011/06/29 10:30:21
Done.
|
| virtual bool EmitAtUses() { |
| return !HasSideEffects() && !HasMultipleUses(); |
| @@ -2823,20 +2865,14 @@ class HTypeofIs: public HUnaryPredicate { |
| }; |
| -class HInstanceOf: public HTemplateInstruction<3> { |
| +class HInstanceOf: public HBinaryOperation { |
| public: |
| - HInstanceOf(HValue* context, HValue* left, HValue* right) { |
| - SetOperandAt(0, context); |
| - SetOperandAt(1, left); |
| - SetOperandAt(2, right); |
| + HInstanceOf(HValue* context, HValue* left, HValue* right) |
| + : HBinaryOperation(context, left, right) { |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| } |
| - HValue* context() { return OperandAt(0); } |
| - HValue* left() { return OperandAt(1); } |
| - HValue* right() { return OperandAt(2); } |
| - |
| virtual Representation RequiredInputRepresentation(int index) const { |
| return Representation::Tagged(); |
| } |
| @@ -2849,14 +2885,20 @@ class HInstanceOf: public HTemplateInstruction<3> { |
| }; |
| -class HInstanceOfKnownGlobal: public HUnaryOperation { |
| +class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { |
| public: |
| - HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) |
| - : HUnaryOperation(left), function_(right) { |
| + HInstanceOfKnownGlobal(HValue* context, |
| + HValue* left, |
| + Handle<JSFunction> right) |
| + : function_(right) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, left); |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* left() { return OperandAt(1); } |
| Handle<JSFunction> function() { return function_; } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| @@ -2872,16 +2914,24 @@ class HInstanceOfKnownGlobal: public HUnaryOperation { |
| }; |
| -class HPower: public HBinaryOperation { |
| +class HPower: public HTemplateInstruction<2> { |
| public: |
| - HPower(HValue* left, HValue* right) |
| - : HBinaryOperation(left, right) { |
| + HPower(HValue* left, HValue* right) { |
| + SetOperandAt(0, left); |
| + SetOperandAt(1, right); |
| set_representation(Representation::Double()); |
| SetFlag(kUseGVN); |
| } |
| + HValue* left() { return OperandAt(0); } |
| + HValue* right() { return OperandAt(1); } |
| + |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return (index == 1) ? Representation::None() : Representation::Double(); |
| + if (index == 0) { |
| + return Representation::Double(); |
| + } else { |
| + return Representation::None(); |
| + } |
| } |
| DECLARE_CONCRETE_INSTRUCTION(Power) |
| @@ -2893,7 +2943,8 @@ class HPower: public HBinaryOperation { |
| class HAdd: public HArithmeticBinaryOperation { |
| public: |
| - HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| + HAdd(HValue* context, HValue* left, HValue* right) |
| + : HArithmeticBinaryOperation(context, left, right) { |
| SetFlag(kCanOverflow); |
| } |
| @@ -2918,7 +2969,8 @@ class HAdd: public HArithmeticBinaryOperation { |
| class HSub: public HArithmeticBinaryOperation { |
| public: |
| - HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| + HSub(HValue* context, HValue* left, HValue* right) |
| + : HArithmeticBinaryOperation(context, left, right) { |
| SetFlag(kCanOverflow); |
| } |
| @@ -2935,7 +2987,8 @@ class HSub: public HArithmeticBinaryOperation { |
| class HMul: public HArithmeticBinaryOperation { |
| public: |
| - HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| + HMul(HValue* context, HValue* left, HValue* right) |
| + : HArithmeticBinaryOperation(context, left, right) { |
| SetFlag(kCanOverflow); |
| } |
| @@ -2957,7 +3010,8 @@ class HMul: public HArithmeticBinaryOperation { |
| class HMod: public HArithmeticBinaryOperation { |
| public: |
| - HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| + HMod(HValue* context, HValue* left, HValue* right) |
| + : HArithmeticBinaryOperation(context, left, right) { |
| SetFlag(kCanBeDivByZero); |
| } |
| @@ -2984,7 +3038,8 @@ class HMod: public HArithmeticBinaryOperation { |
| class HDiv: public HArithmeticBinaryOperation { |
| public: |
| - HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { |
| + HDiv(HValue* context, HValue* left, HValue* right) |
| + : HArithmeticBinaryOperation(context, left, right) { |
| SetFlag(kCanBeDivByZero); |
| SetFlag(kCanOverflow); |
| } |
| @@ -3002,8 +3057,8 @@ class HDiv: public HArithmeticBinaryOperation { |
| class HBitAnd: public HBitwiseBinaryOperation { |
| public: |
| - HBitAnd(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HBitAnd(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual bool IsCommutative() const { return true; } |
| virtual HType CalculateInferredType(); |
| @@ -3019,8 +3074,8 @@ class HBitAnd: public HBitwiseBinaryOperation { |
| class HBitXor: public HBitwiseBinaryOperation { |
| public: |
| - HBitXor(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HBitXor(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual bool IsCommutative() const { return true; } |
| virtual HType CalculateInferredType(); |
| @@ -3034,8 +3089,8 @@ class HBitXor: public HBitwiseBinaryOperation { |
| class HBitOr: public HBitwiseBinaryOperation { |
| public: |
| - HBitOr(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HBitOr(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual bool IsCommutative() const { return true; } |
| virtual HType CalculateInferredType(); |
| @@ -3051,8 +3106,8 @@ class HBitOr: public HBitwiseBinaryOperation { |
| class HShl: public HBitwiseBinaryOperation { |
| public: |
| - HShl(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HShl(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual Range* InferRange(); |
| virtual HType CalculateInferredType(); |
| @@ -3066,8 +3121,8 @@ class HShl: public HBitwiseBinaryOperation { |
| class HShr: public HBitwiseBinaryOperation { |
| public: |
| - HShr(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HShr(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual HType CalculateInferredType(); |
| @@ -3080,8 +3135,8 @@ class HShr: public HBitwiseBinaryOperation { |
| class HSar: public HBitwiseBinaryOperation { |
| public: |
| - HSar(HValue* left, HValue* right) |
| - : HBitwiseBinaryOperation(left, right) { } |
| + HSar(HValue* context, HValue* left, HValue* right) |
| + : HBitwiseBinaryOperation(context, left, right) { } |
| virtual Range* InferRange(); |
| virtual HType CalculateInferredType(); |
| @@ -3215,15 +3270,16 @@ class HLoadGlobalCell: public HTemplateInstruction<0> { |
| }; |
| -class HLoadGlobalGeneric: public HBinaryOperation { |
| +class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
| public: |
| HLoadGlobalGeneric(HValue* context, |
| HValue* global_object, |
| Handle<Object> name, |
| bool for_typeof) |
| - : HBinaryOperation(context, global_object), |
| - name_(name), |
| + : name_(name), |
| for_typeof_(for_typeof) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, global_object); |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| } |
| @@ -3346,10 +3402,12 @@ static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| } |
| -class HStoreContextSlot: public HBinaryOperation { |
| +class HStoreContextSlot: public HTemplateInstruction<2> { |
| public: |
| HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
| - : HBinaryOperation(context, value), slot_index_(slot_index) { |
| + : slot_index_(slot_index) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, value); |
| SetFlag(kChangesContextSlots); |
| } |
| @@ -3413,13 +3471,15 @@ class HLoadNamedField: public HUnaryOperation { |
| }; |
| -class HLoadNamedFieldPolymorphic: public HUnaryOperation { |
| +class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { |
| public: |
| - HLoadNamedFieldPolymorphic(HValue* object, |
| + HLoadNamedFieldPolymorphic(HValue* context, |
| + HValue* object, |
| ZoneMapList* types, |
| Handle<String> name); |
| - HValue* object() { return OperandAt(0); } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* object() { return OperandAt(1); } |
| ZoneMapList* types() { return &types_; } |
| Handle<String> name() { return name_; } |
| bool need_generic() { return need_generic_; } |
| @@ -3443,10 +3503,12 @@ class HLoadNamedFieldPolymorphic: public HUnaryOperation { |
| -class HLoadNamedGeneric: public HBinaryOperation { |
| +class HLoadNamedGeneric: public HTemplateInstruction<2> { |
| public: |
| HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
| - : HBinaryOperation(context, object), name_(name) { |
| + : name_(name) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, object); |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| } |
| @@ -3488,9 +3550,11 @@ class HLoadFunctionPrototype: public HUnaryOperation { |
| }; |
| -class HLoadKeyedFastElement: public HBinaryOperation { |
| +class HLoadKeyedFastElement: public HTemplateInstruction<2> { |
| public: |
| - HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
| + HLoadKeyedFastElement(HValue* obj, HValue* key) { |
| + SetOperandAt(0, obj); |
| + SetOperandAt(1, key); |
| set_representation(Representation::Tagged()); |
| SetFlag(kDependsOnArrayElements); |
| SetFlag(kUseGVN); |
| @@ -3516,13 +3580,14 @@ class HLoadKeyedFastElement: public HBinaryOperation { |
| }; |
| -class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
| +class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { |
| public: |
| HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
| HValue* key, |
| JSObject::ElementsKind elements_kind) |
| - : HBinaryOperation(external_elements, key), |
| - elements_kind_(elements_kind) { |
| + : elements_kind_(elements_kind) { |
| + SetOperandAt(0, external_elements); |
| + SetOperandAt(1, key); |
| if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
| set_representation(Representation::Double()); |
| @@ -3587,17 +3652,18 @@ class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
| }; |
| -class HStoreNamedField: public HBinaryOperation { |
| +class HStoreNamedField: public HTemplateInstruction<2> { |
| public: |
| HStoreNamedField(HValue* obj, |
| Handle<String> name, |
| HValue* val, |
| bool in_object, |
| int offset) |
| - : HBinaryOperation(obj, val), |
| - name_(name), |
| + : name_(name), |
| is_in_object_(in_object), |
| offset_(offset) { |
| + SetOperandAt(0, obj); |
| + SetOperandAt(1, val); |
| if (is_in_object_) { |
| SetFlag(kChangesInobjectFields); |
| } else { |
| @@ -3775,7 +3841,8 @@ class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
| class HStringAdd: public HBinaryOperation { |
| public: |
| - HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { |
| + HStringAdd(HValue* context, HValue* left, HValue* right) |
| + : HBinaryOperation(context, left, right) { |
| set_representation(Representation::Tagged()); |
| SetFlag(kUseGVN); |
| SetFlag(kDependsOnMaps); |
| @@ -3796,10 +3863,12 @@ class HStringAdd: public HBinaryOperation { |
| }; |
| -class HStringCharCodeAt: public HBinaryOperation { |
| +class HStringCharCodeAt: public HTemplateInstruction<3> { |
| public: |
| - HStringCharCodeAt(HValue* string, HValue* index) |
| - : HBinaryOperation(string, index) { |
| + HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, string); |
| + SetOperandAt(2, index); |
| set_representation(Representation::Integer32()); |
| SetFlag(kUseGVN); |
| SetFlag(kDependsOnMaps); |
| @@ -3807,12 +3876,13 @@ class HStringCharCodeAt: public HBinaryOperation { |
| virtual Representation RequiredInputRepresentation(int index) const { |
| // The index is supposed to be Integer32. |
| - return (index == 1) ? Representation::Integer32() |
| + return (index == 2) ? Representation::Integer32() |
| : Representation::Tagged(); |
| } |
| - HValue* string() { return OperandAt(0); } |
| - HValue* index() { return OperandAt(1); } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* string() { return OperandAt(1); } |
| + HValue* index() { return OperandAt(2); } |
| DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
| @@ -3825,10 +3895,12 @@ class HStringCharCodeAt: public HBinaryOperation { |
| }; |
| -class HStringCharFromCode: public HUnaryOperation { |
| +class HStringCharFromCode: public HTemplateInstruction<2> { |
| public: |
| - explicit HStringCharFromCode(HValue* char_code) : HUnaryOperation(char_code) { |
| - set_representation(Representation::Tagged()); |
| + explicit HStringCharFromCode(HValue* context, HValue* char_code) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, char_code); |
| + set_representation(Representation::Tagged()); |
| SetFlag(kUseGVN); |
| } |
| @@ -3836,6 +3908,9 @@ class HStringCharFromCode: public HUnaryOperation { |
| return Representation::Integer32(); |
|
Kevin Millikin (Chromium)
2011/06/29 08:36:20
Context should be tagged.
|
| } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* value() { return OperandAt(1); } |
| + |
| virtual bool DataEquals(HValue* other) { return true; } |
| DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
| @@ -3887,23 +3962,27 @@ class HMaterializedLiteral: public HTemplateInstruction<V> { |
| }; |
| -class HArrayLiteral: public HMaterializedLiteral<0> { |
| +class HArrayLiteral: public HMaterializedLiteral<1> { |
| public: |
| - HArrayLiteral(Handle<FixedArray> constant_elements, |
| + HArrayLiteral(HValue* context, |
| + Handle<FixedArray> constant_elements, |
| int length, |
| int literal_index, |
| int depth) |
| - : HMaterializedLiteral<0>(literal_index, depth), |
| + : HMaterializedLiteral<1>(literal_index, depth), |
| length_(length), |
| - constant_elements_(constant_elements) {} |
| + constant_elements_(constant_elements) { |
| + SetOperandAt(0, context); |
| + } |
| + HValue* context() { return OperandAt(0); } |
| Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| int length() const { return length_; } |
| bool IsCopyOnWrite() const; |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return Representation::None(); |
| + return Representation::Tagged(); |
| } |
| DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
| @@ -3949,20 +4028,24 @@ class HObjectLiteral: public HMaterializedLiteral<1> { |
| }; |
| -class HRegExpLiteral: public HMaterializedLiteral<0> { |
| +class HRegExpLiteral: public HMaterializedLiteral<1> { |
| public: |
| - HRegExpLiteral(Handle<String> pattern, |
| + HRegExpLiteral(HValue* context, |
| + Handle<String> pattern, |
| Handle<String> flags, |
| int literal_index) |
| - : HMaterializedLiteral<0>(literal_index, 0), |
| + : HMaterializedLiteral<1>(literal_index, 0), |
| pattern_(pattern), |
| - flags_(flags) { } |
| + flags_(flags) { |
| + SetOperandAt(0, context); |
| + } |
| + HValue* context() { return OperandAt(0); } |
| Handle<String> pattern() { return pattern_; } |
| Handle<String> flags() { return flags_; } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return Representation::None(); |
| + return Representation::Tagged(); |
| } |
| DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
| @@ -3973,15 +4056,20 @@ class HRegExpLiteral: public HMaterializedLiteral<0> { |
| }; |
| -class HFunctionLiteral: public HTemplateInstruction<0> { |
| +class HFunctionLiteral: public HTemplateInstruction<1> { |
| public: |
| - HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) |
| + HFunctionLiteral(HValue* context, |
| + Handle<SharedFunctionInfo> shared, |
| + bool pretenure) |
| : shared_info_(shared), pretenure_(pretenure) { |
| + SetOperandAt(0, context); |
| set_representation(Representation::Tagged()); |
| } |
| + HValue* context() { return OperandAt(0); } |
| + |
| virtual Representation RequiredInputRepresentation(int index) const { |
| - return Representation::None(); |
| + return Representation::Tagged(); |
| } |
| DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
| @@ -3995,12 +4083,17 @@ class HFunctionLiteral: public HTemplateInstruction<0> { |
| }; |
| -class HTypeof: public HUnaryOperation { |
| +class HTypeof: public HTemplateInstruction<2> { |
| public: |
| - explicit HTypeof(HValue* value) : HUnaryOperation(value) { |
| + explicit HTypeof(HValue* context, HValue* value) { |
| + SetOperandAt(0, context); |
| + SetOperandAt(1, value); |
| set_representation(Representation::Tagged()); |
| } |
| + HValue* context() { return OperandAt(0); } |
| + HValue* value() { return OperandAt(1); } |
| + |
| virtual Representation RequiredInputRepresentation(int index) const { |
| return Representation::Tagged(); |
| } |
| @@ -4043,8 +4136,8 @@ class HValueOf: public HUnaryOperation { |
| class HDeleteProperty: public HBinaryOperation { |
| public: |
| - HDeleteProperty(HValue* obj, HValue* key) |
| - : HBinaryOperation(obj, key) { |
| + HDeleteProperty(HValue* context, HValue* obj, HValue* key) |
| + : HBinaryOperation(context, obj, key) { |
| set_representation(Representation::Tagged()); |
| SetAllSideEffects(); |
| } |