| Index: src/hydrogen-instructions.h
|
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
|
| index 733347b5b5fc87a07f0f0630be20d30df21418ab..7df1aae544f6311163976d6d47807ed7b204b776 100644
|
| --- a/src/hydrogen-instructions.h
|
| +++ b/src/hydrogen-instructions.h
|
| @@ -638,6 +638,8 @@ class HValue : public ZoneObject {
|
| flags_(0) {}
|
| virtual ~HValue() {}
|
|
|
| + virtual int position() const { return RelocInfo::kNoPosition; }
|
| +
|
| HBasicBlock* block() const { return block_; }
|
| void SetBlock(HBasicBlock* block);
|
| int LoopWeight() const;
|
| @@ -1114,7 +1116,7 @@ class HInstruction : public HValue {
|
| void InsertAfter(HInstruction* previous);
|
|
|
| // The position is a write-once variable.
|
| - int position() const { return position_; }
|
| + virtual int position() const V8_OVERRIDE { return position_; }
|
| bool has_position() const { return position_ != RelocInfo::kNoPosition; }
|
| void set_position(int position) {
|
| ASSERT(!has_position());
|
| @@ -1492,11 +1494,15 @@ class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
|
|
|
| class HAbnormalExit V8_FINAL : public HTemplateControlInstruction<0, 0> {
|
| public:
|
| + DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit);
|
| +
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::None();
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(AbnormalExit)
|
| + private:
|
| + HAbnormalExit() {}
|
| };
|
|
|
|
|
| @@ -1774,8 +1780,7 @@ class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
|
| public:
|
| enum Kind { BIND, LOOKUP };
|
|
|
| - HEnvironmentMarker(Kind kind, int index)
|
| - : kind_(kind), index_(index), next_simulate_(NULL) { }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int);
|
|
|
| Kind kind() { return kind_; }
|
| int index() { return index_; }
|
| @@ -1802,6 +1807,9 @@ class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
|
| DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker);
|
|
|
| private:
|
| + HEnvironmentMarker(Kind kind, int index)
|
| + : kind_(kind), index_(index), next_simulate_(NULL) { }
|
| +
|
| Kind kind_;
|
| int index_;
|
| HSimulate* next_simulate_;
|
| @@ -1977,10 +1985,7 @@ class HPushArgument V8_FINAL : public HUnaryOperation {
|
|
|
| class HThisFunction V8_FINAL : public HTemplateInstruction<0> {
|
| public:
|
| - HThisFunction() {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::None();
|
| @@ -1992,6 +1997,11 @@ class HThisFunction V8_FINAL : public HTemplateInstruction<0> {
|
| virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
|
|
| private:
|
| + HThisFunction() {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
| };
|
|
|
| @@ -2053,14 +2063,7 @@ class HDeclareGlobals V8_FINAL : public HUnaryOperation {
|
|
|
| class HGlobalObject V8_FINAL : public HUnaryOperation {
|
| public:
|
| - explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - }
|
| -
|
| - static HGlobalObject* New(Zone* zone, HValue* context) {
|
| - return new(zone) HGlobalObject(context);
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P0(HGlobalObject);
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(GlobalObject)
|
|
|
| @@ -2072,6 +2075,11 @@ class HGlobalObject V8_FINAL : public HUnaryOperation {
|
| virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
|
|
| private:
|
| + explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
| };
|
|
|
| @@ -2313,10 +2321,7 @@ class HCallGlobal V8_FINAL : public HUnaryCall {
|
|
|
| class HCallKnownGlobal V8_FINAL : public HCall<0> {
|
| public:
|
| - HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
|
| - : HCall<0>(argument_count),
|
| - target_(target),
|
| - formal_parameter_count_(target->shared()->formal_parameter_count()) { }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int);
|
|
|
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
|
|
| @@ -2330,6 +2335,11 @@ class HCallKnownGlobal V8_FINAL : public HCall<0> {
|
| DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
|
|
|
| private:
|
| + HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
|
| + : HCall<0>(argument_count),
|
| + target_(target),
|
| + formal_parameter_count_(target->shared()->formal_parameter_count()) { }
|
| +
|
| Handle<JSFunction> target_;
|
| int formal_parameter_count_;
|
| };
|
| @@ -2767,19 +2777,15 @@ class HCheckValue V8_FINAL : public HUnaryOperation {
|
|
|
| class HCheckInstanceType V8_FINAL : public HUnaryOperation {
|
| public:
|
| - static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) {
|
| - return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT);
|
| - }
|
| - static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) {
|
| - return new(zone) HCheckInstanceType(value, IS_JS_ARRAY);
|
| - }
|
| - static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) {
|
| - return new(zone) HCheckInstanceType(value, IS_STRING);
|
| - }
|
| - static HCheckInstanceType* NewIsInternalizedString(
|
| - HValue* value, Zone* zone) {
|
| - return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING);
|
| - }
|
| + enum Check {
|
| + IS_SPEC_OBJECT,
|
| + IS_JS_ARRAY,
|
| + IS_STRING,
|
| + IS_INTERNALIZED_STRING,
|
| + LAST_INTERVAL_CHECK = IS_JS_ARRAY
|
| + };
|
| +
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
|
|
|
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
|
|
| @@ -2807,14 +2813,6 @@ class HCheckInstanceType V8_FINAL : public HUnaryOperation {
|
| virtual int RedefinedOperandIndex() { return 0; }
|
|
|
| private:
|
| - enum Check {
|
| - IS_SPEC_OBJECT,
|
| - IS_JS_ARRAY,
|
| - IS_STRING,
|
| - IS_INTERNALIZED_STRING,
|
| - LAST_INTERVAL_CHECK = IS_JS_ARRAY
|
| - };
|
| -
|
| const char* GetCheckName();
|
|
|
| HCheckInstanceType(HValue* value, Check check)
|
| @@ -3147,6 +3145,8 @@ class HPhi V8_FINAL : public HValue {
|
| bool IsReceiver() const { return merged_index_ == 0; }
|
| bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; }
|
|
|
| + virtual int position() const V8_OVERRIDE;
|
| +
|
| int merged_index() const { return merged_index_; }
|
|
|
| InductionVariableData* induction_variable_data() {
|
| @@ -3317,6 +3317,8 @@ class HCapturedObject V8_FINAL : public HDematerializedObject {
|
| // Replay effects of this instruction on the given environment.
|
| void ReplayEnvironment(HEnvironment* env);
|
|
|
| + virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
| +
|
| DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
|
|
|
| private:
|
| @@ -3714,17 +3716,8 @@ class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> {
|
|
|
| class HApplyArguments V8_FINAL : public HTemplateInstruction<4> {
|
| public:
|
| - HApplyArguments(HValue* function,
|
| - HValue* receiver,
|
| - HValue* length,
|
| - HValue* elements) {
|
| - set_representation(Representation::Tagged());
|
| - SetOperandAt(0, function);
|
| - SetOperandAt(1, receiver);
|
| - SetOperandAt(2, length);
|
| - SetOperandAt(3, elements);
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*,
|
| + HValue*);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| // The length is untagged, all other inputs are tagged.
|
| @@ -3739,6 +3732,19 @@ class HApplyArguments V8_FINAL : public HTemplateInstruction<4> {
|
| HValue* elements() { return OperandAt(3); }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(ApplyArguments)
|
| +
|
| + private:
|
| + HApplyArguments(HValue* function,
|
| + HValue* receiver,
|
| + HValue* length,
|
| + HValue* elements) {
|
| + set_representation(Representation::Tagged());
|
| + SetOperandAt(0, function);
|
| + SetOperandAt(1, receiver);
|
| + SetOperandAt(2, length);
|
| + SetOperandAt(3, elements);
|
| + SetAllSideEffects();
|
| + }
|
| };
|
|
|
|
|
| @@ -3796,13 +3802,7 @@ class HArgumentsLength V8_FINAL : public HUnaryOperation {
|
|
|
| class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> {
|
| public:
|
| - HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - SetOperandAt(0, arguments);
|
| - SetOperandAt(1, length);
|
| - SetOperandAt(2, index);
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
|
|
|
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
|
|
| @@ -3819,6 +3819,15 @@ class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> {
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
|
|
|
| + private:
|
| + HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + SetOperandAt(0, arguments);
|
| + SetOperandAt(1, length);
|
| + SetOperandAt(2, index);
|
| + }
|
| +
|
| virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
| };
|
|
|
| @@ -3947,11 +3956,12 @@ class HBitwiseBinaryOperation : public HBinaryOperation {
|
| }
|
|
|
| virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
|
| - if (to.IsTagged()) {
|
| + if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
|
| + if (to.IsTagged() &&
|
| + (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
|
| SetAllSideEffects();
|
| ClearFlag(kUseGVN);
|
| } else {
|
| - ASSERT(to.IsSmiOrInteger32());
|
| ClearAllSideEffects();
|
| SetFlag(kUseGVN);
|
| }
|
| @@ -4023,7 +4033,9 @@ class HArithmeticBinaryOperation : public HBinaryOperation {
|
| }
|
|
|
| virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
|
| - if (to.IsTagged()) {
|
| + if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
|
| + if (to.IsTagged() &&
|
| + (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
|
| SetAllSideEffects();
|
| ClearFlag(kUseGVN);
|
| } else {
|
| @@ -4040,16 +4052,8 @@ class HArithmeticBinaryOperation : public HBinaryOperation {
|
|
|
| class HCompareGeneric V8_FINAL : public HBinaryOperation {
|
| public:
|
| - HCompareGeneric(HValue* context,
|
| - HValue* left,
|
| - HValue* right,
|
| - Token::Value token)
|
| - : HBinaryOperation(context, left, right, HType::Boolean()),
|
| - token_(token) {
|
| - ASSERT(Token::IsCompareOp(token));
|
| - set_representation(Representation::Tagged());
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
|
| + HValue*, Token::Value);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return index == 0
|
| @@ -4063,6 +4067,17 @@ class HCompareGeneric V8_FINAL : public HBinaryOperation {
|
| DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
|
|
|
| private:
|
| + HCompareGeneric(HValue* context,
|
| + HValue* left,
|
| + HValue* right,
|
| + Token::Value token)
|
| + : HBinaryOperation(context, left, right, HType::Boolean()),
|
| + token_(token) {
|
| + ASSERT(Token::IsCompareOp(token));
|
| + set_representation(Representation::Tagged());
|
| + SetAllSideEffects();
|
| + }
|
| +
|
| Token::Value token_;
|
| };
|
|
|
| @@ -4314,22 +4329,24 @@ class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> {
|
|
|
| class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
|
| public:
|
| + DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch);
|
| +
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::None();
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
|
| + private:
|
| + HIsConstructCallAndBranch() {}
|
| };
|
|
|
|
|
| class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| public:
|
| - HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
|
| - : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
|
| - HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
|
| - : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
|
| - ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(
|
| + HHasInstanceTypeAndBranch, HValue*, InstanceType);
|
| + DECLARE_INSTRUCTION_FACTORY_P3(
|
| + HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
|
|
|
| InstanceType from() { return from_; }
|
| InstanceType to() { return to_; }
|
| @@ -4343,6 +4360,13 @@ class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
|
|
|
| private:
|
| + HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
|
| + : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
|
| + HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
|
| + : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
|
| + ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
|
| + }
|
| +
|
| InstanceType from_;
|
| InstanceType to_; // Inclusive range, not all combinations work.
|
| };
|
| @@ -4350,23 +4374,22 @@ class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
|
|
|
| class HHasCachedArrayIndexAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| public:
|
| - explicit HHasCachedArrayIndexAndBranch(HValue* value)
|
| - : HUnaryControlInstruction(value, NULL, NULL) { }
|
| + DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::Tagged();
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch)
|
| + private:
|
| + explicit HHasCachedArrayIndexAndBranch(HValue* value)
|
| + : HUnaryControlInstruction(value, NULL, NULL) { }
|
| };
|
|
|
|
|
| class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation {
|
| public:
|
| - explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::Tagged();
|
| @@ -4378,15 +4401,19 @@ class HGetCachedArrayIndex V8_FINAL : public HUnaryOperation {
|
| virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
|
|
| private:
|
| + explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
| };
|
|
|
|
|
| class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| public:
|
| - HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
|
| - : HUnaryControlInstruction(value, NULL, NULL),
|
| - class_name_(class_name) { }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*,
|
| + Handle<String>);
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
|
|
|
| @@ -4399,15 +4426,17 @@ class HClassOfTestAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| Handle<String> class_name() const { return class_name_; }
|
|
|
| private:
|
| + HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
|
| + : HUnaryControlInstruction(value, NULL, NULL),
|
| + class_name_(class_name) { }
|
| +
|
| Handle<String> class_name_;
|
| };
|
|
|
|
|
| class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| public:
|
| - HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
|
| - : HUnaryControlInstruction(value, NULL, NULL),
|
| - type_literal_(type_literal) { }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
|
|
|
| Handle<String> type_literal() { return type_literal_; }
|
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
| @@ -4419,17 +4448,17 @@ class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
|
| }
|
|
|
| private:
|
| + HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
|
| + : HUnaryControlInstruction(value, NULL, NULL),
|
| + type_literal_(type_literal) { }
|
| +
|
| Handle<String> type_literal_;
|
| };
|
|
|
|
|
| class HInstanceOf V8_FINAL : public HBinaryOperation {
|
| public:
|
| - HInstanceOf(HValue* context, HValue* left, HValue* right)
|
| - : HBinaryOperation(context, left, right, HType::Boolean()) {
|
| - set_representation(Representation::Tagged());
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::Tagged();
|
| @@ -4438,6 +4467,13 @@ class HInstanceOf V8_FINAL : public HBinaryOperation {
|
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
|
| +
|
| + private:
|
| + HInstanceOf(HValue* context, HValue* left, HValue* right)
|
| + : HBinaryOperation(context, left, right, HType::Boolean()) {
|
| + set_representation(Representation::Tagged());
|
| + SetAllSideEffects();
|
| + }
|
| };
|
|
|
|
|
| @@ -4513,10 +4549,7 @@ class HPower V8_FINAL : public HTemplateInstruction<2> {
|
|
|
| class HRandom V8_FINAL : public HTemplateInstruction<1> {
|
| public:
|
| - explicit HRandom(HValue* global_object) {
|
| - SetOperandAt(0, global_object);
|
| - set_representation(Representation::Double());
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P1(HRandom, HValue*);
|
|
|
| HValue* global_object() { return OperandAt(0); }
|
|
|
| @@ -4527,6 +4560,11 @@ class HRandom V8_FINAL : public HTemplateInstruction<1> {
|
| DECLARE_CONCRETE_INSTRUCTION(Random)
|
|
|
| private:
|
| + explicit HRandom(HValue* global_object) {
|
| + SetOperandAt(0, global_object);
|
| + set_representation(Representation::Double());
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
| };
|
|
|
| @@ -4562,8 +4600,19 @@ class HAdd V8_FINAL : public HArithmeticBinaryOperation {
|
| }
|
|
|
| virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
|
| - if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN);
|
| - HArithmeticBinaryOperation::RepresentationChanged(to);
|
| + if (to.IsTagged()) {
|
| + SetGVNFlag(kChangesNewSpacePromotion);
|
| + ClearFlag(kAllowUndefinedAsNaN);
|
| + }
|
| + if (to.IsTagged() &&
|
| + (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
|
| + left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
|
| + SetAllSideEffects();
|
| + ClearFlag(kUseGVN);
|
| + } else {
|
| + ClearAllSideEffects();
|
| + SetFlag(kUseGVN);
|
| + }
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(Add)
|
| @@ -5152,12 +5201,8 @@ class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> {
|
|
|
| class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
| public:
|
| - HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
|
| - : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - SetGVNFlag(kDependsOnGlobalVars);
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
|
| + PropertyDetails);
|
|
|
| Unique<Cell> cell() const { return cell_; }
|
| bool RequiresHoleCheck() const;
|
| @@ -5184,6 +5229,13 @@ class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
| }
|
|
|
| private:
|
| + HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
|
| + : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + SetGVNFlag(kDependsOnGlobalVars);
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
|
|
|
| Unique<Cell> cell_;
|
| @@ -5193,17 +5245,8 @@ class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
|
|
|
| class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
|
| public:
|
| - HLoadGlobalGeneric(HValue* context,
|
| - HValue* global_object,
|
| - Handle<Object> name,
|
| - bool for_typeof)
|
| - : name_(name),
|
| - for_typeof_(for_typeof) {
|
| - SetOperandAt(0, context);
|
| - SetOperandAt(1, global_object);
|
| - set_representation(Representation::Tagged());
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
|
| + Handle<Object>, bool);
|
|
|
| HValue* context() { return OperandAt(0); }
|
| HValue* global_object() { return OperandAt(1); }
|
| @@ -5219,6 +5262,18 @@ class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
|
| DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
|
|
|
| private:
|
| + HLoadGlobalGeneric(HValue* context,
|
| + HValue* global_object,
|
| + Handle<Object> name,
|
| + bool for_typeof)
|
| + : name_(name),
|
| + for_typeof_(for_typeof) {
|
| + SetOperandAt(0, context);
|
| + SetOperandAt(1, global_object);
|
| + set_representation(Representation::Tagged());
|
| + SetAllSideEffects();
|
| + }
|
| +
|
| Handle<Object> name_;
|
| bool for_typeof_;
|
| };
|
| @@ -5969,13 +6024,8 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
|
|
|
| class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
|
| public:
|
| - HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
|
| - : name_(name) {
|
| - SetOperandAt(0, context);
|
| - SetOperandAt(1, object);
|
| - set_representation(Representation::Tagged());
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
|
| + Handle<Object>);
|
|
|
| HValue* context() { return OperandAt(0); }
|
| HValue* object() { return OperandAt(1); }
|
| @@ -5990,18 +6040,21 @@ class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
|
| DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
|
|
|
| private:
|
| + HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
|
| + : name_(name) {
|
| + SetOperandAt(0, context);
|
| + SetOperandAt(1, object);
|
| + set_representation(Representation::Tagged());
|
| + SetAllSideEffects();
|
| + }
|
| +
|
| Handle<Object> name_;
|
| };
|
|
|
|
|
| class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation {
|
| public:
|
| - explicit HLoadFunctionPrototype(HValue* function)
|
| - : HUnaryOperation(function) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - SetGVNFlag(kDependsOnCalls);
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*);
|
|
|
| HValue* function() { return OperandAt(0); }
|
|
|
| @@ -6013,6 +6066,14 @@ class HLoadFunctionPrototype V8_FINAL : public HUnaryOperation {
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
|
| +
|
| + private:
|
| + explicit HLoadFunctionPrototype(HValue* function)
|
| + : HUnaryOperation(function) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + SetGVNFlag(kDependsOnCalls);
|
| + }
|
| };
|
|
|
| class ArrayInstructionInterface {
|
| @@ -6200,14 +6261,8 @@ class HLoadKeyed V8_FINAL
|
|
|
| class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> {
|
| public:
|
| - HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
|
| - set_representation(Representation::Tagged());
|
| - SetOperandAt(0, obj);
|
| - SetOperandAt(1, key);
|
| - SetOperandAt(2, context);
|
| - SetAllSideEffects();
|
| - }
|
| -
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
|
| + HValue*);
|
| HValue* object() { return OperandAt(0); }
|
| HValue* key() { return OperandAt(1); }
|
| HValue* context() { return OperandAt(2); }
|
| @@ -6222,6 +6277,15 @@ class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> {
|
| virtual HValue* Canonicalize() V8_OVERRIDE;
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
|
| +
|
| + private:
|
| + HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
|
| + set_representation(Representation::Tagged());
|
| + SetOperandAt(0, obj);
|
| + SetOperandAt(1, key);
|
| + SetOperandAt(2, context);
|
| + SetAllSideEffects();
|
| + }
|
| };
|
|
|
|
|
| @@ -6340,19 +6404,9 @@ class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
|
|
|
| class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
|
| public:
|
| - HStoreNamedGeneric(HValue* context,
|
| - HValue* object,
|
| - Handle<String> name,
|
| - HValue* value,
|
| - StrictModeFlag strict_mode_flag)
|
| - : name_(name),
|
| - strict_mode_flag_(strict_mode_flag) {
|
| - SetOperandAt(0, object);
|
| - SetOperandAt(1, value);
|
| - SetOperandAt(2, context);
|
| - SetAllSideEffects();
|
| - }
|
| -
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
|
| + Handle<String>, HValue*,
|
| + StrictModeFlag);
|
| HValue* object() { return OperandAt(0); }
|
| HValue* value() { return OperandAt(1); }
|
| HValue* context() { return OperandAt(2); }
|
| @@ -6368,6 +6422,19 @@ class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
|
| DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
|
|
|
| private:
|
| + HStoreNamedGeneric(HValue* context,
|
| + HValue* object,
|
| + Handle<String> name,
|
| + HValue* value,
|
| + StrictModeFlag strict_mode_flag)
|
| + : name_(name),
|
| + strict_mode_flag_(strict_mode_flag) {
|
| + SetOperandAt(0, object);
|
| + SetOperandAt(1, value);
|
| + SetOperandAt(2, context);
|
| + SetAllSideEffects();
|
| + }
|
| +
|
| Handle<String> name_;
|
| StrictModeFlag strict_mode_flag_;
|
| };
|
| @@ -6516,18 +6583,8 @@ class HStoreKeyed V8_FINAL
|
|
|
| class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
|
| public:
|
| - HStoreKeyedGeneric(HValue* context,
|
| - HValue* object,
|
| - HValue* key,
|
| - HValue* value,
|
| - StrictModeFlag strict_mode_flag)
|
| - : strict_mode_flag_(strict_mode_flag) {
|
| - SetOperandAt(0, object);
|
| - SetOperandAt(1, key);
|
| - SetOperandAt(2, value);
|
| - SetOperandAt(3, context);
|
| - SetAllSideEffects();
|
| - }
|
| + DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
|
| + HValue*, HValue*, StrictModeFlag);
|
|
|
| HValue* object() { return OperandAt(0); }
|
| HValue* key() { return OperandAt(1); }
|
| @@ -6545,6 +6602,19 @@ class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
|
| DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
|
|
|
| private:
|
| + HStoreKeyedGeneric(HValue* context,
|
| + HValue* object,
|
| + HValue* key,
|
| + HValue* value,
|
| + StrictModeFlag strict_mode_flag)
|
| + : strict_mode_flag_(strict_mode_flag) {
|
| + SetOperandAt(0, object);
|
| + SetOperandAt(1, key);
|
| + SetOperandAt(2, value);
|
| + SetOperandAt(3, context);
|
| + SetAllSideEffects();
|
| + }
|
| +
|
| StrictModeFlag strict_mode_flag_;
|
| };
|
|
|
| @@ -6632,20 +6702,25 @@ class HStringAdd V8_FINAL : public HBinaryOperation {
|
| HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags)
|
| : HBinaryOperation(context, left, right, HType::String()), flags_(flags) {
|
| set_representation(Representation::Tagged());
|
| - if (flags_ == STRING_ADD_CHECK_NONE) {
|
| + if (MightHaveSideEffects()) {
|
| + SetAllSideEffects();
|
| + } else {
|
| SetFlag(kUseGVN);
|
| SetGVNFlag(kDependsOnMaps);
|
| SetGVNFlag(kChangesNewSpacePromotion);
|
| - } else {
|
| - SetAllSideEffects();
|
| }
|
| }
|
|
|
| + bool MightHaveSideEffects() const {
|
| + return flags_ != STRING_ADD_CHECK_NONE &&
|
| + (left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved());
|
| + }
|
| +
|
| // No side-effects except possible allocation:
|
| // NOTE: this instruction does not call ToString() on its inputs, when flags_
|
| // is set to STRING_ADD_CHECK_NONE.
|
| virtual bool IsDeletable() const V8_OVERRIDE {
|
| - return flags_ == STRING_ADD_CHECK_NONE;
|
| + return !MightHaveSideEffects();
|
| }
|
|
|
| const StringAddFlags flags_;
|
| @@ -6918,9 +6993,7 @@ class HToFastProperties V8_FINAL : public HUnaryOperation {
|
|
|
| class HValueOf V8_FINAL : public HUnaryOperation {
|
| public:
|
| - explicit HValueOf(HValue* value) : HUnaryOperation(value) {
|
| - set_representation(Representation::Tagged());
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P1(HValueOf, HValue*);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
| return Representation::Tagged();
|
| @@ -6929,16 +7002,17 @@ class HValueOf V8_FINAL : public HUnaryOperation {
|
| DECLARE_CONCRETE_INSTRUCTION(ValueOf)
|
|
|
| private:
|
| + explicit HValueOf(HValue* value) : HUnaryOperation(value) {
|
| + set_representation(Representation::Tagged());
|
| + }
|
| +
|
| virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
| };
|
|
|
|
|
| class HDateField V8_FINAL : public HUnaryOperation {
|
| public:
|
| - HDateField(HValue* date, Smi* index)
|
| - : HUnaryOperation(date), index_(index) {
|
| - set_representation(Representation::Tagged());
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*);
|
|
|
| Smi* index() const { return index_; }
|
|
|
| @@ -6949,21 +7023,19 @@ class HDateField V8_FINAL : public HUnaryOperation {
|
| DECLARE_CONCRETE_INSTRUCTION(DateField)
|
|
|
| private:
|
| + HDateField(HValue* date, Smi* index)
|
| + : HUnaryOperation(date), index_(index) {
|
| + set_representation(Representation::Tagged());
|
| + }
|
| +
|
| Smi* index_;
|
| };
|
|
|
|
|
| class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
|
| public:
|
| - HSeqStringSetChar(String::Encoding encoding,
|
| - HValue* string,
|
| - HValue* index,
|
| - HValue* value) : encoding_(encoding) {
|
| - SetOperandAt(0, string);
|
| - SetOperandAt(1, index);
|
| - SetOperandAt(2, value);
|
| - set_representation(Representation::Tagged());
|
| - }
|
| + DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
|
| + HValue*, HValue*, HValue*);
|
|
|
| String::Encoding encoding() { return encoding_; }
|
| HValue* string() { return OperandAt(0); }
|
| @@ -6978,6 +7050,16 @@ class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
|
| DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar)
|
|
|
| private:
|
| + HSeqStringSetChar(String::Encoding encoding,
|
| + HValue* string,
|
| + HValue* index,
|
| + HValue* value) : encoding_(encoding) {
|
| + SetOperandAt(0, string);
|
| + SetOperandAt(1, index);
|
| + SetOperandAt(2, value);
|
| + set_representation(Representation::Tagged());
|
| + }
|
| +
|
| String::Encoding encoding_;
|
| };
|
|
|
|
|