| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 V(ArgumentsElements) \ | 65 V(ArgumentsElements) \ |
| 66 V(ArgumentsLength) \ | 66 V(ArgumentsLength) \ |
| 67 V(ArgumentsObject) \ | 67 V(ArgumentsObject) \ |
| 68 V(ArrayLiteral) \ | 68 V(ArrayLiteral) \ |
| 69 V(BitAnd) \ | 69 V(BitAnd) \ |
| 70 V(BitNot) \ | 70 V(BitNot) \ |
| 71 V(BitOr) \ | 71 V(BitOr) \ |
| 72 V(BitXor) \ | 72 V(BitXor) \ |
| 73 V(BlockEntry) \ | 73 V(BlockEntry) \ |
| 74 V(BoundsCheck) \ | 74 V(BoundsCheck) \ |
| 75 V(Branch) \ |
| 75 V(CallConstantFunction) \ | 76 V(CallConstantFunction) \ |
| 76 V(CallFunction) \ | 77 V(CallFunction) \ |
| 77 V(CallGlobal) \ | 78 V(CallGlobal) \ |
| 78 V(CallKeyed) \ | 79 V(CallKeyed) \ |
| 79 V(CallKnownGlobal) \ | 80 V(CallKnownGlobal) \ |
| 80 V(CallNamed) \ | 81 V(CallNamed) \ |
| 81 V(CallNew) \ | 82 V(CallNew) \ |
| 82 V(CallRuntime) \ | 83 V(CallRuntime) \ |
| 83 V(CallStub) \ | 84 V(CallStub) \ |
| 84 V(Change) \ | 85 V(Change) \ |
| 85 V(CheckFunction) \ | 86 V(CheckFunction) \ |
| 86 V(CheckInstanceType) \ | 87 V(CheckInstanceType) \ |
| 87 V(CheckMap) \ | 88 V(CheckMap) \ |
| 88 V(CheckNonSmi) \ | 89 V(CheckNonSmi) \ |
| 89 V(CheckPrototypeMaps) \ | 90 V(CheckPrototypeMaps) \ |
| 90 V(CheckSmi) \ | 91 V(CheckSmi) \ |
| 91 V(ClampToUint8) \ | 92 V(ClampToUint8) \ |
| 92 V(ClassOfTest) \ | 93 V(ClassOfTestAndBranch) \ |
| 93 V(Compare) \ | 94 V(CompareIDAndBranch) \ |
| 94 V(CompareObjectEq) \ | 95 V(CompareGeneric) \ |
| 96 V(CompareObjectEqAndBranch) \ |
| 95 V(CompareMap) \ | 97 V(CompareMap) \ |
| 96 V(CompareConstantEq) \ | 98 V(CompareConstantEqAndBranch) \ |
| 97 V(Constant) \ | 99 V(Constant) \ |
| 98 V(Context) \ | 100 V(Context) \ |
| 99 V(DeleteProperty) \ | 101 V(DeleteProperty) \ |
| 100 V(Deoptimize) \ | 102 V(Deoptimize) \ |
| 101 V(Div) \ | 103 V(Div) \ |
| 102 V(ElementsKind) \ | 104 V(ElementsKind) \ |
| 103 V(EnterInlined) \ | 105 V(EnterInlined) \ |
| 104 V(ExternalArrayLength) \ | 106 V(ExternalArrayLength) \ |
| 105 V(FixedArrayLength) \ | 107 V(FixedArrayLength) \ |
| 106 V(ForceRepresentation) \ | 108 V(ForceRepresentation) \ |
| 107 V(FunctionLiteral) \ | 109 V(FunctionLiteral) \ |
| 108 V(GetCachedArrayIndex) \ | 110 V(GetCachedArrayIndex) \ |
| 109 V(GlobalObject) \ | 111 V(GlobalObject) \ |
| 110 V(GlobalReceiver) \ | 112 V(GlobalReceiver) \ |
| 111 V(Goto) \ | 113 V(Goto) \ |
| 112 V(HasCachedArrayIndex) \ | 114 V(HasCachedArrayIndexAndBranch) \ |
| 113 V(HasInstanceType) \ | 115 V(HasInstanceTypeAndBranch) \ |
| 114 V(In) \ | 116 V(In) \ |
| 115 V(InstanceOf) \ | 117 V(InstanceOf) \ |
| 116 V(InstanceOfKnownGlobal) \ | 118 V(InstanceOfKnownGlobal) \ |
| 117 V(InvokeFunction) \ | 119 V(InvokeFunction) \ |
| 118 V(IsConstructCall) \ | 120 V(IsConstructCallAndBranch) \ |
| 119 V(IsNull) \ | 121 V(IsNullAndBranch) \ |
| 120 V(IsObject) \ | 122 V(IsObjectAndBranch) \ |
| 121 V(IsSmi) \ | 123 V(IsSmiAndBranch) \ |
| 122 V(IsUndetectable) \ | 124 V(IsUndetectableAndBranch) \ |
| 123 V(JSArrayLength) \ | 125 V(JSArrayLength) \ |
| 124 V(LeaveInlined) \ | 126 V(LeaveInlined) \ |
| 125 V(LoadContextSlot) \ | 127 V(LoadContextSlot) \ |
| 126 V(LoadElements) \ | 128 V(LoadElements) \ |
| 127 V(LoadExternalArrayPointer) \ | 129 V(LoadExternalArrayPointer) \ |
| 128 V(LoadFunctionPrototype) \ | 130 V(LoadFunctionPrototype) \ |
| 129 V(LoadGlobalCell) \ | 131 V(LoadGlobalCell) \ |
| 130 V(LoadGlobalGeneric) \ | 132 V(LoadGlobalGeneric) \ |
| 131 V(LoadKeyedFastElement) \ | 133 V(LoadKeyedFastElement) \ |
| 132 V(LoadKeyedGeneric) \ | 134 V(LoadKeyedGeneric) \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 156 V(StoreKeyedFastElement) \ | 158 V(StoreKeyedFastElement) \ |
| 157 V(StoreKeyedGeneric) \ | 159 V(StoreKeyedGeneric) \ |
| 158 V(StoreKeyedSpecializedArrayElement) \ | 160 V(StoreKeyedSpecializedArrayElement) \ |
| 159 V(StoreNamedField) \ | 161 V(StoreNamedField) \ |
| 160 V(StoreNamedGeneric) \ | 162 V(StoreNamedGeneric) \ |
| 161 V(StringAdd) \ | 163 V(StringAdd) \ |
| 162 V(StringCharCodeAt) \ | 164 V(StringCharCodeAt) \ |
| 163 V(StringCharFromCode) \ | 165 V(StringCharFromCode) \ |
| 164 V(StringLength) \ | 166 V(StringLength) \ |
| 165 V(Sub) \ | 167 V(Sub) \ |
| 166 V(Test) \ | |
| 167 V(ThisFunction) \ | 168 V(ThisFunction) \ |
| 168 V(Throw) \ | 169 V(Throw) \ |
| 169 V(ToFastProperties) \ | 170 V(ToFastProperties) \ |
| 170 V(ToInt32) \ | 171 V(ToInt32) \ |
| 171 V(Typeof) \ | 172 V(Typeof) \ |
| 172 V(TypeofIs) \ | 173 V(TypeofIsAndBranch) \ |
| 173 V(UnaryMathOperation) \ | 174 V(UnaryMathOperation) \ |
| 174 V(UnknownOSRValue) \ | 175 V(UnknownOSRValue) \ |
| 175 V(UseConst) \ | 176 V(UseConst) \ |
| 176 V(ValueOf) | 177 V(ValueOf) |
| 177 | 178 |
| 178 #define GVN_FLAG_LIST(V) \ | 179 #define GVN_FLAG_LIST(V) \ |
| 179 V(Calls) \ | 180 V(Calls) \ |
| 180 V(InobjectFields) \ | 181 V(InobjectFields) \ |
| 181 V(BackingStoreFields) \ | 182 V(BackingStoreFields) \ |
| 182 V(ArrayElements) \ | 183 V(ArrayElements) \ |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 775 |
| 775 private: | 776 private: |
| 776 EmbeddedContainer<HValue*, V> inputs_; | 777 EmbeddedContainer<HValue*, V> inputs_; |
| 777 }; | 778 }; |
| 778 | 779 |
| 779 | 780 |
| 780 class HControlInstruction: public HInstruction { | 781 class HControlInstruction: public HInstruction { |
| 781 public: | 782 public: |
| 782 virtual HBasicBlock* SuccessorAt(int i) = 0; | 783 virtual HBasicBlock* SuccessorAt(int i) = 0; |
| 783 virtual int SuccessorCount() = 0; | 784 virtual int SuccessorCount() = 0; |
| 785 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
| 784 | 786 |
| 785 virtual void PrintDataTo(StringStream* stream); | 787 virtual void PrintDataTo(StringStream* stream); |
| 786 | 788 |
| 787 HBasicBlock* FirstSuccessor() { | 789 HBasicBlock* FirstSuccessor() { |
| 788 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 790 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
| 789 } | 791 } |
| 790 HBasicBlock* SecondSuccessor() { | 792 HBasicBlock* SecondSuccessor() { |
| 791 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 793 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
| 792 } | 794 } |
| 793 | 795 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 808 HControlInstruction* instr_; | 810 HControlInstruction* instr_; |
| 809 int current_; | 811 int current_; |
| 810 }; | 812 }; |
| 811 | 813 |
| 812 | 814 |
| 813 template<int S, int V> | 815 template<int S, int V> |
| 814 class HTemplateControlInstruction: public HControlInstruction { | 816 class HTemplateControlInstruction: public HControlInstruction { |
| 815 public: | 817 public: |
| 816 int SuccessorCount() { return S; } | 818 int SuccessorCount() { return S; } |
| 817 HBasicBlock* SuccessorAt(int i) { return successors_[i]; } | 819 HBasicBlock* SuccessorAt(int i) { return successors_[i]; } |
| 820 void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } |
| 818 | 821 |
| 819 int OperandCount() { return V; } | 822 int OperandCount() { return V; } |
| 820 HValue* OperandAt(int i) { return inputs_[i]; } | 823 HValue* OperandAt(int i) { return inputs_[i]; } |
| 821 | 824 |
| 825 |
| 822 protected: | 826 protected: |
| 823 void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } | |
| 824 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } | 827 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
| 825 | 828 |
| 826 private: | 829 private: |
| 827 EmbeddedContainer<HBasicBlock*, S> successors_; | 830 EmbeddedContainer<HBasicBlock*, S> successors_; |
| 828 EmbeddedContainer<HValue*, V> inputs_; | 831 EmbeddedContainer<HValue*, V> inputs_; |
| 829 }; | 832 }; |
| 830 | 833 |
| 831 | 834 |
| 832 class HBlockEntry: public HTemplateInstruction<0> { | 835 class HBlockEntry: public HTemplateInstruction<0> { |
| 833 public: | 836 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 862 | 865 |
| 863 virtual int OperandCount() { return values_.length(); } | 866 virtual int OperandCount() { return values_.length(); } |
| 864 virtual HValue* OperandAt(int index) { return values_[index]; } | 867 virtual HValue* OperandAt(int index) { return values_[index]; } |
| 865 virtual void PrintDataTo(StringStream* stream); | 868 virtual void PrintDataTo(StringStream* stream); |
| 866 | 869 |
| 867 virtual int SuccessorCount() { return 0; } | 870 virtual int SuccessorCount() { return 0; } |
| 868 virtual HBasicBlock* SuccessorAt(int i) { | 871 virtual HBasicBlock* SuccessorAt(int i) { |
| 869 UNREACHABLE(); | 872 UNREACHABLE(); |
| 870 return NULL; | 873 return NULL; |
| 871 } | 874 } |
| 875 virtual void SetSuccessorAt(int i, HBasicBlock* block) { |
| 876 UNREACHABLE(); |
| 877 } |
| 872 | 878 |
| 873 void AddEnvironmentValue(HValue* value) { | 879 void AddEnvironmentValue(HValue* value) { |
| 874 values_.Add(NULL); | 880 values_.Add(NULL); |
| 875 SetOperandAt(values_.length() - 1, value); | 881 SetOperandAt(values_.length() - 1, value); |
| 876 } | 882 } |
| 877 | 883 |
| 878 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 884 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 879 | 885 |
| 880 enum UseEnvironment { | 886 enum UseEnvironment { |
| 881 kNoUses, | 887 kNoUses, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 SetSuccessorAt(0, true_target); | 921 SetSuccessorAt(0, true_target); |
| 916 SetSuccessorAt(1, false_target); | 922 SetSuccessorAt(1, false_target); |
| 917 } | 923 } |
| 918 | 924 |
| 919 virtual void PrintDataTo(StringStream* stream); | 925 virtual void PrintDataTo(StringStream* stream); |
| 920 | 926 |
| 921 HValue* value() { return OperandAt(0); } | 927 HValue* value() { return OperandAt(0); } |
| 922 }; | 928 }; |
| 923 | 929 |
| 924 | 930 |
| 925 class HTest: public HUnaryControlInstruction { | 931 class HBranch: public HUnaryControlInstruction { |
| 926 public: | 932 public: |
| 927 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) | 933 HBranch(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) |
| 928 : HUnaryControlInstruction(value, true_target, false_target) { | 934 : HUnaryControlInstruction(value, true_target, false_target) { |
| 929 ASSERT(true_target != NULL && false_target != NULL); | 935 ASSERT(true_target != NULL && false_target != NULL); |
| 930 } | 936 } |
| 937 explicit HBranch(HValue* value) |
| 938 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 939 |
| 931 | 940 |
| 932 virtual Representation RequiredInputRepresentation(int index) const { | 941 virtual Representation RequiredInputRepresentation(int index) const { |
| 933 return Representation::None(); | 942 return Representation::None(); |
| 934 } | 943 } |
| 935 | 944 |
| 936 DECLARE_CONCRETE_INSTRUCTION(Test) | 945 DECLARE_CONCRETE_INSTRUCTION(Branch) |
| 937 }; | 946 }; |
| 938 | 947 |
| 939 | 948 |
| 940 class HCompareMap: public HUnaryControlInstruction { | 949 class HCompareMap: public HUnaryControlInstruction { |
| 941 public: | 950 public: |
| 942 HCompareMap(HValue* value, | 951 HCompareMap(HValue* value, |
| 943 Handle<Map> map, | 952 Handle<Map> map, |
| 944 HBasicBlock* true_target, | 953 HBasicBlock* true_target, |
| 945 HBasicBlock* false_target) | 954 HBasicBlock* false_target) |
| 946 : HUnaryControlInstruction(value, true_target, false_target), | 955 : HUnaryControlInstruction(value, true_target, false_target), |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 } | 2522 } |
| 2514 virtual Representation InferredRepresentation() { | 2523 virtual Representation InferredRepresentation() { |
| 2515 if (left()->representation().Equals(right()->representation())) { | 2524 if (left()->representation().Equals(right()->representation())) { |
| 2516 return left()->representation(); | 2525 return left()->representation(); |
| 2517 } | 2526 } |
| 2518 return HValue::InferredRepresentation(); | 2527 return HValue::InferredRepresentation(); |
| 2519 } | 2528 } |
| 2520 }; | 2529 }; |
| 2521 | 2530 |
| 2522 | 2531 |
| 2523 class HCompare: public HBinaryOperation { | 2532 class HCompareGeneric: public HBinaryOperation { |
| 2524 public: | 2533 public: |
| 2525 HCompare(HValue* left, HValue* right, Token::Value token) | 2534 HCompareGeneric(HValue* left, HValue* right, Token::Value token) |
| 2526 : HBinaryOperation(left, right), token_(token) { | 2535 : HBinaryOperation(left, right), token_(token) { |
| 2527 ASSERT(Token::IsCompareOp(token)); | 2536 ASSERT(Token::IsCompareOp(token)); |
| 2528 set_representation(Representation::Tagged()); | 2537 set_representation(Representation::Tagged()); |
| 2529 SetAllSideEffects(); | 2538 SetAllSideEffects(); |
| 2530 } | 2539 } |
| 2531 | 2540 |
| 2541 virtual Representation RequiredInputRepresentation(int index) const { |
| 2542 return Representation::Tagged(); |
| 2543 } |
| 2544 Representation GetInputRepresentation() const { |
| 2545 return Representation::Tagged(); |
| 2546 } |
| 2547 |
| 2548 Token::Value token() const { return token_; } |
| 2549 virtual void PrintDataTo(StringStream* stream); |
| 2550 |
| 2551 virtual HType CalculateInferredType(); |
| 2552 |
| 2553 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
| 2554 |
| 2555 private: |
| 2556 Token::Value token_; |
| 2557 }; |
| 2558 |
| 2559 |
| 2560 class HCompareIDAndBranch: public HTemplateControlInstruction<2, 2> { |
| 2561 public: |
| 2562 HCompareIDAndBranch(HValue* left, HValue* right, Token::Value token) |
| 2563 : token_(token) { |
| 2564 ASSERT(Token::IsCompareOp(token)); |
| 2565 SetOperandAt(0, left); |
| 2566 SetOperandAt(1, right); |
| 2567 } |
| 2568 |
| 2569 HValue* left() { return OperandAt(0); } |
| 2570 HValue* right() { return OperandAt(1); } |
| 2571 Token::Value token() const { return token_; } |
| 2572 |
| 2532 void SetInputRepresentation(Representation r); | 2573 void SetInputRepresentation(Representation r); |
| 2533 | |
| 2534 virtual bool EmitAtUses() { | |
| 2535 return !HasSideEffects() && !HasMultipleUses(); | |
| 2536 } | |
| 2537 | |
| 2538 virtual Representation RequiredInputRepresentation(int index) const { | |
| 2539 return input_representation_; | |
| 2540 } | |
| 2541 Representation GetInputRepresentation() const { | 2574 Representation GetInputRepresentation() const { |
| 2542 return input_representation_; | 2575 return input_representation_; |
| 2543 } | 2576 } |
| 2544 Token::Value token() const { return token_; } | 2577 |
| 2578 virtual Representation RequiredInputRepresentation(int index) const { |
| 2579 return input_representation_; |
| 2580 } |
| 2545 virtual void PrintDataTo(StringStream* stream); | 2581 virtual void PrintDataTo(StringStream* stream); |
| 2546 | 2582 |
| 2547 virtual HType CalculateInferredType(); | 2583 DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) |
| 2548 | |
| 2549 virtual intptr_t Hashcode() { | |
| 2550 return HValue::Hashcode() * 7 + token_; | |
| 2551 } | |
| 2552 | |
| 2553 DECLARE_CONCRETE_INSTRUCTION(Compare) | |
| 2554 | |
| 2555 protected: | |
| 2556 virtual bool DataEquals(HValue* other) { | |
| 2557 HCompare* comp = HCompare::cast(other); | |
| 2558 return token_ == comp->token(); | |
| 2559 } | |
| 2560 | 2584 |
| 2561 private: | 2585 private: |
| 2562 Representation input_representation_; | 2586 Representation input_representation_; |
| 2563 Token::Value token_; | 2587 Token::Value token_; |
| 2564 }; | 2588 }; |
| 2565 | 2589 |
| 2566 | 2590 |
| 2567 class HCompareObjectEq: public HBinaryOperation { | 2591 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
| 2568 public: | 2592 public: |
| 2569 HCompareObjectEq(HValue* left, HValue* right) | 2593 HCompareObjectEqAndBranch(HValue* left, HValue* right) { |
| 2570 : HBinaryOperation(left, right) { | 2594 SetOperandAt(0, left); |
| 2571 set_representation(Representation::Tagged()); | 2595 SetOperandAt(1, right); |
| 2572 SetFlag(kUseGVN); | 2596 } |
| 2573 SetFlag(kDependsOnMaps); | 2597 |
| 2574 } | 2598 HValue* left() { return OperandAt(0); } |
| 2575 | 2599 HValue* right() { return OperandAt(1); } |
| 2576 virtual bool EmitAtUses() { | 2600 |
| 2577 return !HasSideEffects() && !HasMultipleUses(); | 2601 virtual Representation RequiredInputRepresentation(int index) const { |
| 2578 } | 2602 return Representation::Tagged(); |
| 2579 | 2603 } |
| 2580 virtual Representation RequiredInputRepresentation(int index) const { | 2604 |
| 2581 return Representation::Tagged(); | 2605 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
| 2582 } | 2606 }; |
| 2583 virtual HType CalculateInferredType(); | 2607 |
| 2584 | 2608 |
| 2585 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEq) | 2609 class HCompareConstantEqAndBranch: public HUnaryControlInstruction { |
| 2610 public: |
| 2611 HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) |
| 2612 : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { |
| 2613 ASSERT(op == Token::EQ_STRICT); |
| 2614 } |
| 2615 |
| 2616 Token::Value op() const { return op_; } |
| 2617 int right() const { return right_; } |
| 2618 |
| 2619 virtual Representation RequiredInputRepresentation(int index) const { |
| 2620 return Representation::Integer32(); |
| 2621 } |
| 2622 |
| 2623 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); |
| 2624 |
| 2625 private: |
| 2626 const Token::Value op_; |
| 2627 const int right_; |
| 2628 }; |
| 2629 |
| 2630 |
| 2631 class HIsNullAndBranch: public HUnaryControlInstruction { |
| 2632 public: |
| 2633 HIsNullAndBranch(HValue* value, bool is_strict) |
| 2634 : HUnaryControlInstruction(value, NULL, NULL), is_strict_(is_strict) { } |
| 2635 |
| 2636 bool is_strict() const { return is_strict_; } |
| 2637 |
| 2638 virtual Representation RequiredInputRepresentation(int index) const { |
| 2639 return Representation::Tagged(); |
| 2640 } |
| 2641 |
| 2642 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch) |
| 2643 |
| 2644 private: |
| 2645 bool is_strict_; |
| 2646 }; |
| 2647 |
| 2648 |
| 2649 class HIsObjectAndBranch: public HUnaryControlInstruction { |
| 2650 public: |
| 2651 explicit HIsObjectAndBranch(HValue* value) |
| 2652 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2653 |
| 2654 virtual Representation RequiredInputRepresentation(int index) const { |
| 2655 return Representation::Tagged(); |
| 2656 } |
| 2657 |
| 2658 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
| 2659 }; |
| 2660 |
| 2661 |
| 2662 class HIsSmiAndBranch: public HUnaryControlInstruction { |
| 2663 public: |
| 2664 explicit HIsSmiAndBranch(HValue* value) |
| 2665 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2666 |
| 2667 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
| 2668 |
| 2669 virtual Representation RequiredInputRepresentation(int index) const { |
| 2670 return Representation::Tagged(); |
| 2671 } |
| 2586 | 2672 |
| 2587 protected: | 2673 protected: |
| 2588 virtual bool DataEquals(HValue* other) { return true; } | 2674 virtual bool DataEquals(HValue* other) { return true; } |
| 2589 }; | 2675 }; |
| 2590 | 2676 |
| 2591 | 2677 |
| 2592 class HCompareConstantEq: public HUnaryOperation { | 2678 class HIsUndetectableAndBranch: public HUnaryControlInstruction { |
| 2593 public: | 2679 public: |
| 2594 HCompareConstantEq(HValue* left, int right, Token::Value op) | 2680 explicit HIsUndetectableAndBranch(HValue* value) |
| 2595 : HUnaryOperation(left), op_(op), right_(right) { | 2681 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2596 ASSERT(op == Token::EQ_STRICT); | 2682 |
| 2597 set_representation(Representation::Tagged()); | 2683 virtual Representation RequiredInputRepresentation(int index) const { |
| 2598 SetFlag(kUseGVN); | 2684 return Representation::Tagged(); |
| 2599 } | 2685 } |
| 2600 | 2686 |
| 2601 Token::Value op() const { return op_; } | 2687 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
| 2602 int right() const { return right_; } | 2688 }; |
| 2603 | 2689 |
| 2604 virtual bool EmitAtUses() { | 2690 |
| 2605 return !HasSideEffects() && !HasMultipleUses(); | 2691 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { |
| 2606 } | 2692 public: |
| 2607 | |
| 2608 virtual Representation RequiredInputRepresentation(int index) const { | |
| 2609 return Representation::Integer32(); | |
| 2610 } | |
| 2611 | |
| 2612 virtual HType CalculateInferredType() { return HType::Boolean(); } | |
| 2613 | |
| 2614 DECLARE_CONCRETE_INSTRUCTION(CompareConstantEq); | |
| 2615 | |
| 2616 protected: | |
| 2617 virtual bool DataEquals(HValue* other) { | |
| 2618 HCompareConstantEq* other_instr = HCompareConstantEq::cast(other); | |
| 2619 return (op_ == other_instr->op_ && | |
| 2620 right_ == other_instr->right_); | |
| 2621 } | |
| 2622 | |
| 2623 private: | |
| 2624 const Token::Value op_; | |
| 2625 const int right_; | |
| 2626 }; | |
| 2627 | |
| 2628 | |
| 2629 class HUnaryPredicate: public HUnaryOperation { | |
| 2630 public: | |
| 2631 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | |
| 2632 set_representation(Representation::Tagged()); | |
| 2633 SetFlag(kUseGVN); | |
| 2634 } | |
| 2635 | |
| 2636 virtual bool EmitAtUses() { | |
| 2637 return !HasSideEffects() && !HasMultipleUses(); | |
| 2638 } | |
| 2639 | |
| 2640 virtual Representation RequiredInputRepresentation(int index) const { | |
| 2641 return Representation::Tagged(); | |
| 2642 } | |
| 2643 virtual HType CalculateInferredType(); | |
| 2644 }; | |
| 2645 | |
| 2646 | |
| 2647 class HIsNull: public HUnaryPredicate { | |
| 2648 public: | |
| 2649 HIsNull(HValue* value, bool is_strict) | |
| 2650 : HUnaryPredicate(value), is_strict_(is_strict) { } | |
| 2651 | |
| 2652 bool is_strict() const { return is_strict_; } | |
| 2653 | |
| 2654 DECLARE_CONCRETE_INSTRUCTION(IsNull) | |
| 2655 | |
| 2656 protected: | |
| 2657 virtual bool DataEquals(HValue* other) { | |
| 2658 HIsNull* b = HIsNull::cast(other); | |
| 2659 return is_strict_ == b->is_strict(); | |
| 2660 } | |
| 2661 | |
| 2662 private: | |
| 2663 bool is_strict_; | |
| 2664 }; | |
| 2665 | |
| 2666 | |
| 2667 class HIsObject: public HUnaryPredicate { | |
| 2668 public: | |
| 2669 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } | |
| 2670 | |
| 2671 DECLARE_CONCRETE_INSTRUCTION(IsObject) | |
| 2672 | |
| 2673 protected: | |
| 2674 virtual bool DataEquals(HValue* other) { return true; } | |
| 2675 }; | |
| 2676 | |
| 2677 | |
| 2678 class HIsSmi: public HUnaryPredicate { | |
| 2679 public: | |
| 2680 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | |
| 2681 | |
| 2682 DECLARE_CONCRETE_INSTRUCTION(IsSmi) | |
| 2683 | |
| 2684 protected: | |
| 2685 virtual bool DataEquals(HValue* other) { return true; } | |
| 2686 }; | |
| 2687 | |
| 2688 | |
| 2689 class HIsUndetectable: public HUnaryPredicate { | |
| 2690 public: | |
| 2691 explicit HIsUndetectable(HValue* value) : HUnaryPredicate(value) { } | |
| 2692 | |
| 2693 DECLARE_CONCRETE_INSTRUCTION(IsUndetectable) | |
| 2694 | |
| 2695 protected: | |
| 2696 virtual bool DataEquals(HValue* other) { return true; } | |
| 2697 }; | |
| 2698 | |
| 2699 | |
| 2700 class HIsConstructCall: public HTemplateInstruction<0> { | |
| 2701 public: | |
| 2702 HIsConstructCall() { | |
| 2703 set_representation(Representation::Tagged()); | |
| 2704 SetFlag(kUseGVN); | |
| 2705 } | |
| 2706 | |
| 2707 virtual bool EmitAtUses() { | |
| 2708 return !HasSideEffects() && !HasMultipleUses(); | |
| 2709 } | |
| 2710 | |
| 2711 virtual Representation RequiredInputRepresentation(int index) const { | 2693 virtual Representation RequiredInputRepresentation(int index) const { |
| 2712 return Representation::None(); | 2694 return Representation::None(); |
| 2713 } | 2695 } |
| 2714 | 2696 |
| 2715 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall) | 2697 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
| 2716 | 2698 }; |
| 2717 protected: | 2699 |
| 2718 virtual bool DataEquals(HValue* other) { return true; } | 2700 |
| 2719 }; | 2701 class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { |
| 2720 | 2702 public: |
| 2721 | 2703 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
| 2722 class HHasInstanceType: public HUnaryPredicate { | 2704 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
| 2723 public: | 2705 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
| 2724 HHasInstanceType(HValue* value, InstanceType type) | 2706 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
| 2725 : HUnaryPredicate(value), from_(type), to_(type) { } | |
| 2726 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) | |
| 2727 : HUnaryPredicate(value), from_(from), to_(to) { | |
| 2728 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 2707 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
| 2729 } | 2708 } |
| 2730 | 2709 |
| 2731 InstanceType from() { return from_; } | 2710 InstanceType from() { return from_; } |
| 2732 InstanceType to() { return to_; } | 2711 InstanceType to() { return to_; } |
| 2733 | 2712 |
| 2734 virtual bool EmitAtUses() { | |
| 2735 return !HasSideEffects() && !HasMultipleUses(); | |
| 2736 } | |
| 2737 | |
| 2738 virtual void PrintDataTo(StringStream* stream); | 2713 virtual void PrintDataTo(StringStream* stream); |
| 2739 | 2714 |
| 2740 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType) | 2715 virtual Representation RequiredInputRepresentation(int index) const { |
| 2741 | 2716 return Representation::Tagged(); |
| 2742 protected: | 2717 } |
| 2743 virtual bool DataEquals(HValue* other) { | 2718 |
| 2744 HHasInstanceType* b = HHasInstanceType::cast(other); | 2719 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
| 2745 return (from_ == b->from()) && (to_ == b->to()); | |
| 2746 } | |
| 2747 | 2720 |
| 2748 private: | 2721 private: |
| 2749 InstanceType from_; | 2722 InstanceType from_; |
| 2750 InstanceType to_; // Inclusive range, not all combinations work. | 2723 InstanceType to_; // Inclusive range, not all combinations work. |
| 2751 }; | 2724 }; |
| 2752 | 2725 |
| 2753 | 2726 |
| 2754 class HHasCachedArrayIndex: public HUnaryPredicate { | 2727 class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { |
| 2755 public: | 2728 public: |
| 2756 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } | 2729 explicit HHasCachedArrayIndexAndBranch(HValue* value) |
| 2757 | 2730 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2758 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex) | 2731 |
| 2759 | 2732 virtual Representation RequiredInputRepresentation(int index) const { |
| 2760 protected: | 2733 return Representation::Tagged(); |
| 2761 virtual bool DataEquals(HValue* other) { return true; } | 2734 } |
| 2762 }; | 2735 |
| 2763 | 2736 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
| 2764 | 2737 }; |
| 2738 |
| 2739 |
| 2765 class HGetCachedArrayIndex: public HUnaryOperation { | 2740 class HGetCachedArrayIndex: public HUnaryOperation { |
| 2766 public: | 2741 public: |
| 2767 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { | 2742 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
| 2768 set_representation(Representation::Tagged()); | 2743 set_representation(Representation::Tagged()); |
| 2769 SetFlag(kUseGVN); | 2744 SetFlag(kUseGVN); |
| 2770 } | 2745 } |
| 2771 | 2746 |
| 2772 virtual Representation RequiredInputRepresentation(int index) const { | 2747 virtual Representation RequiredInputRepresentation(int index) const { |
| 2773 return Representation::Tagged(); | 2748 return Representation::Tagged(); |
| 2774 } | 2749 } |
| 2775 | 2750 |
| 2776 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 2751 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
| 2777 | 2752 |
| 2778 protected: | 2753 protected: |
| 2779 virtual bool DataEquals(HValue* other) { return true; } | 2754 virtual bool DataEquals(HValue* other) { return true; } |
| 2780 }; | 2755 }; |
| 2781 | 2756 |
| 2782 | 2757 |
| 2783 class HClassOfTest: public HUnaryPredicate { | 2758 class HClassOfTestAndBranch: public HUnaryControlInstruction { |
| 2784 public: | 2759 public: |
| 2785 HClassOfTest(HValue* value, Handle<String> class_name) | 2760 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
| 2786 : HUnaryPredicate(value), class_name_(class_name) { } | 2761 : HUnaryControlInstruction(value, NULL, NULL), |
| 2762 class_name_(class_name) { } |
| 2787 | 2763 |
| 2788 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest) | 2764 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
| 2765 |
| 2766 virtual Representation RequiredInputRepresentation(int index) const { |
| 2767 return Representation::Tagged(); |
| 2768 } |
| 2789 | 2769 |
| 2790 virtual void PrintDataTo(StringStream* stream); | 2770 virtual void PrintDataTo(StringStream* stream); |
| 2791 | 2771 |
| 2792 Handle<String> class_name() const { return class_name_; } | 2772 Handle<String> class_name() const { return class_name_; } |
| 2793 | 2773 |
| 2794 protected: | |
| 2795 virtual bool DataEquals(HValue* other) { | |
| 2796 HClassOfTest* b = HClassOfTest::cast(other); | |
| 2797 return class_name_.is_identical_to(b->class_name_); | |
| 2798 } | |
| 2799 | |
| 2800 private: | 2774 private: |
| 2801 Handle<String> class_name_; | 2775 Handle<String> class_name_; |
| 2802 }; | 2776 }; |
| 2803 | 2777 |
| 2804 | 2778 |
| 2805 class HTypeofIs: public HUnaryPredicate { | 2779 class HTypeofIsAndBranch: public HUnaryControlInstruction { |
| 2806 public: | 2780 public: |
| 2807 HTypeofIs(HValue* value, Handle<String> type_literal) | 2781 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
| 2808 : HUnaryPredicate(value), type_literal_(type_literal) { } | 2782 : HUnaryControlInstruction(value, NULL, NULL), |
| 2783 type_literal_(type_literal) { } |
| 2809 | 2784 |
| 2810 Handle<String> type_literal() { return type_literal_; } | 2785 Handle<String> type_literal() { return type_literal_; } |
| 2811 virtual void PrintDataTo(StringStream* stream); | 2786 virtual void PrintDataTo(StringStream* stream); |
| 2812 | 2787 |
| 2813 DECLARE_CONCRETE_INSTRUCTION(TypeofIs) | 2788 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
| 2814 | 2789 |
| 2815 protected: | 2790 virtual Representation RequiredInputRepresentation(int index) const { |
| 2816 virtual bool DataEquals(HValue* other) { | 2791 return Representation::Tagged(); |
| 2817 HTypeofIs* b = HTypeofIs::cast(other); | |
| 2818 return type_literal_.is_identical_to(b->type_literal_); | |
| 2819 } | 2792 } |
| 2820 | 2793 |
| 2821 private: | 2794 private: |
| 2822 Handle<String> type_literal_; | 2795 Handle<String> type_literal_; |
| 2823 }; | 2796 }; |
| 2824 | 2797 |
| 2825 | 2798 |
| 2826 class HInstanceOf: public HTemplateInstruction<3> { | 2799 class HInstanceOf: public HTemplateInstruction<3> { |
| 2827 public: | 2800 public: |
| 2828 HInstanceOf(HValue* context, HValue* left, HValue* right) { | 2801 HInstanceOf(HValue* context, HValue* left, HValue* right) { |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4086 | 4059 |
| 4087 DECLARE_CONCRETE_INSTRUCTION(In) | 4060 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4088 }; | 4061 }; |
| 4089 | 4062 |
| 4090 #undef DECLARE_INSTRUCTION | 4063 #undef DECLARE_INSTRUCTION |
| 4091 #undef DECLARE_CONCRETE_INSTRUCTION | 4064 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4092 | 4065 |
| 4093 } } // namespace v8::internal | 4066 } } // namespace v8::internal |
| 4094 | 4067 |
| 4095 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4068 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |