OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "allocation.h" | 10 #include "allocation.h" |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 2055 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
2056 | 2056 |
2057 private: | 2057 private: |
2058 HEnterInlined* entry_; | 2058 HEnterInlined* entry_; |
2059 int drop_count_; | 2059 int drop_count_; |
2060 }; | 2060 }; |
2061 | 2061 |
2062 | 2062 |
2063 class HPushArguments V8_FINAL : public HInstruction { | 2063 class HPushArguments V8_FINAL : public HInstruction { |
2064 public: | 2064 public: |
2065 DECLARE_INSTRUCTION_FACTORY_P1(HPushArguments, Zone*); | 2065 static HPushArguments* New(Zone* zone, HValue* context) { |
2066 DECLARE_INSTRUCTION_FACTORY_P2(HPushArguments, Zone*, HValue*); | 2066 return new(zone) HPushArguments(zone); |
2067 DECLARE_INSTRUCTION_FACTORY_P3(HPushArguments, Zone*, HValue*, HValue*); | 2067 } |
2068 DECLARE_INSTRUCTION_FACTORY_P4(HPushArguments, Zone*, | 2068 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1) { |
2069 HValue*, HValue*, HValue*); | 2069 HPushArguments* instr = new(zone) HPushArguments(zone); |
2070 DECLARE_INSTRUCTION_FACTORY_P5(HPushArguments, Zone*, | 2070 instr->AddInput(arg1); |
2071 HValue*, HValue*, HValue*, HValue*); | 2071 return instr; |
| 2072 } |
| 2073 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, |
| 2074 HValue* arg2) { |
| 2075 HPushArguments* instr = new(zone) HPushArguments(zone); |
| 2076 instr->AddInput(arg1); |
| 2077 instr->AddInput(arg2); |
| 2078 return instr; |
| 2079 } |
| 2080 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, |
| 2081 HValue* arg2, HValue* arg3) { |
| 2082 HPushArguments* instr = new(zone) HPushArguments(zone); |
| 2083 instr->AddInput(arg1); |
| 2084 instr->AddInput(arg2); |
| 2085 instr->AddInput(arg3); |
| 2086 return instr; |
| 2087 } |
| 2088 static HPushArguments* New(Zone* zone, HValue* context, HValue* arg1, |
| 2089 HValue* arg2, HValue* arg3, HValue* arg4) { |
| 2090 HPushArguments* instr = new(zone) HPushArguments(zone); |
| 2091 instr->AddInput(arg1); |
| 2092 instr->AddInput(arg2); |
| 2093 instr->AddInput(arg3); |
| 2094 instr->AddInput(arg4); |
| 2095 return instr; |
| 2096 } |
2072 | 2097 |
2073 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2098 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
2074 return Representation::Tagged(); | 2099 return Representation::Tagged(); |
2075 } | 2100 } |
2076 | 2101 |
2077 virtual int argument_delta() const V8_OVERRIDE { return inputs_.length(); } | 2102 virtual int argument_delta() const V8_OVERRIDE { return inputs_.length(); } |
2078 HValue* argument(int i) { return OperandAt(i); } | 2103 HValue* argument(int i) { return OperandAt(i); } |
2079 | 2104 |
2080 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } | 2105 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } |
2081 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { | 2106 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { |
2082 return inputs_[i]; | 2107 return inputs_[i]; |
2083 } | 2108 } |
2084 | 2109 |
2085 void AddArgument(HValue* arg) { | 2110 void AddInput(HValue* value); |
2086 inputs_.Add(NULL, zone_); | |
2087 SetOperandAt(inputs_.length() - 1, arg); | |
2088 } | |
2089 | 2111 |
2090 DECLARE_CONCRETE_INSTRUCTION(PushArguments) | 2112 DECLARE_CONCRETE_INSTRUCTION(PushArguments) |
2091 | 2113 |
2092 protected: | 2114 protected: |
2093 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { | 2115 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { |
2094 inputs_[i] = value; | 2116 inputs_[i] = value; |
2095 } | 2117 } |
2096 | 2118 |
2097 private: | 2119 private: |
2098 HPushArguments(Zone* zone, | 2120 explicit HPushArguments(Zone* zone) |
2099 HValue* arg1 = NULL, HValue* arg2 = NULL, | 2121 : HInstruction(HType::Tagged()), inputs_(4, zone) { |
2100 HValue* arg3 = NULL, HValue* arg4 = NULL) | |
2101 : HInstruction(HType::Tagged()), zone_(zone), inputs_(4, zone) { | |
2102 set_representation(Representation::Tagged()); | 2122 set_representation(Representation::Tagged()); |
2103 if (arg1) { | |
2104 inputs_.Add(NULL, zone); | |
2105 SetOperandAt(0, arg1); | |
2106 } | |
2107 if (arg2) { | |
2108 inputs_.Add(NULL, zone); | |
2109 SetOperandAt(1, arg2); | |
2110 } | |
2111 if (arg3) { | |
2112 inputs_.Add(NULL, zone); | |
2113 SetOperandAt(2, arg3); | |
2114 } | |
2115 if (arg4) { | |
2116 inputs_.Add(NULL, zone); | |
2117 SetOperandAt(3, arg4); | |
2118 } | |
2119 } | 2123 } |
2120 | 2124 |
2121 Zone* zone_; | |
2122 ZoneList<HValue*> inputs_; | 2125 ZoneList<HValue*> inputs_; |
2123 }; | 2126 }; |
2124 | 2127 |
2125 | 2128 |
2126 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { | 2129 class HThisFunction V8_FINAL : public HTemplateInstruction<0> { |
2127 public: | 2130 public: |
2128 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); | 2131 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); |
2129 | 2132 |
2130 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2133 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
2131 return Representation::None(); | 2134 return Representation::None(); |
(...skipping 5582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7714 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7717 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7715 }; | 7718 }; |
7716 | 7719 |
7717 | 7720 |
7718 #undef DECLARE_INSTRUCTION | 7721 #undef DECLARE_INSTRUCTION |
7719 #undef DECLARE_CONCRETE_INSTRUCTION | 7722 #undef DECLARE_CONCRETE_INSTRUCTION |
7720 | 7723 |
7721 } } // namespace v8::internal | 7724 } } // namespace v8::internal |
7722 | 7725 |
7723 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7726 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |