Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: src/hydrogen-instructions.h

Issue 10829169: Refactor Math.min/max to be a single HInstruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback; removed VORR instruction Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 V(In) \ 117 V(In) \
118 V(InstanceOf) \ 118 V(InstanceOf) \
119 V(InstanceOfKnownGlobal) \ 119 V(InstanceOfKnownGlobal) \
120 V(InvokeFunction) \ 120 V(InvokeFunction) \
121 V(IsConstructCallAndBranch) \ 121 V(IsConstructCallAndBranch) \
122 V(IsNilAndBranch) \ 122 V(IsNilAndBranch) \
123 V(IsObjectAndBranch) \ 123 V(IsObjectAndBranch) \
124 V(IsStringAndBranch) \ 124 V(IsStringAndBranch) \
125 V(IsSmiAndBranch) \ 125 V(IsSmiAndBranch) \
126 V(IsUndetectableAndBranch) \ 126 V(IsUndetectableAndBranch) \
127 V(StringCompareAndBranch) \
128 V(JSArrayLength) \ 127 V(JSArrayLength) \
129 V(LeaveInlined) \ 128 V(LeaveInlined) \
130 V(LoadContextSlot) \ 129 V(LoadContextSlot) \
131 V(LoadElements) \ 130 V(LoadElements) \
132 V(LoadExternalArrayPointer) \ 131 V(LoadExternalArrayPointer) \
133 V(LoadFunctionPrototype) \ 132 V(LoadFunctionPrototype) \
134 V(LoadGlobalCell) \ 133 V(LoadGlobalCell) \
135 V(LoadGlobalGeneric) \ 134 V(LoadGlobalGeneric) \
136 V(LoadKeyedFastDoubleElement) \ 135 V(LoadKeyedFastDoubleElement) \
137 V(LoadKeyedFastElement) \ 136 V(LoadKeyedFastElement) \
138 V(LoadKeyedGeneric) \ 137 V(LoadKeyedGeneric) \
139 V(LoadKeyedSpecializedArrayElement) \ 138 V(LoadKeyedSpecializedArrayElement) \
140 V(LoadNamedField) \ 139 V(LoadNamedField) \
141 V(LoadNamedFieldPolymorphic) \ 140 V(LoadNamedFieldPolymorphic) \
142 V(LoadNamedGeneric) \ 141 V(LoadNamedGeneric) \
143 V(MathFloorOfDiv) \ 142 V(MathFloorOfDiv) \
143 V(MathMinMax) \
144 V(Mod) \ 144 V(Mod) \
145 V(Mul) \ 145 V(Mul) \
146 V(ObjectLiteral) \ 146 V(ObjectLiteral) \
147 V(OsrEntry) \ 147 V(OsrEntry) \
148 V(OuterContext) \ 148 V(OuterContext) \
149 V(Parameter) \ 149 V(Parameter) \
150 V(Power) \ 150 V(Power) \
151 V(PushArgument) \ 151 V(PushArgument) \
152 V(Random) \ 152 V(Random) \
153 V(RegExpLiteral) \ 153 V(RegExpLiteral) \
154 V(Return) \ 154 V(Return) \
155 V(Sar) \ 155 V(Sar) \
156 V(Shl) \ 156 V(Shl) \
157 V(Shr) \ 157 V(Shr) \
158 V(Simulate) \ 158 V(Simulate) \
159 V(SoftDeoptimize) \ 159 V(SoftDeoptimize) \
160 V(StackCheck) \ 160 V(StackCheck) \
161 V(StoreContextSlot) \ 161 V(StoreContextSlot) \
162 V(StoreGlobalCell) \ 162 V(StoreGlobalCell) \
163 V(StoreGlobalGeneric) \ 163 V(StoreGlobalGeneric) \
164 V(StoreKeyedFastDoubleElement) \ 164 V(StoreKeyedFastDoubleElement) \
165 V(StoreKeyedFastElement) \ 165 V(StoreKeyedFastElement) \
166 V(StoreKeyedGeneric) \ 166 V(StoreKeyedGeneric) \
167 V(StoreKeyedSpecializedArrayElement) \ 167 V(StoreKeyedSpecializedArrayElement) \
168 V(StoreNamedField) \ 168 V(StoreNamedField) \
169 V(StoreNamedGeneric) \ 169 V(StoreNamedGeneric) \
170 V(StringAdd) \ 170 V(StringAdd) \
171 V(StringCharCodeAt) \ 171 V(StringCharCodeAt) \
172 V(StringCharFromCode) \ 172 V(StringCharFromCode) \
173 V(StringCompareAndBranch) \
173 V(StringLength) \ 174 V(StringLength) \
174 V(Sub) \ 175 V(Sub) \
175 V(ThisFunction) \ 176 V(ThisFunction) \
176 V(Throw) \ 177 V(Throw) \
177 V(ToFastProperties) \ 178 V(ToFastProperties) \
178 V(TransitionElementsKind) \ 179 V(TransitionElementsKind) \
179 V(Typeof) \ 180 V(Typeof) \
180 V(TypeofIsAndBranch) \ 181 V(TypeofIsAndBranch) \
181 V(UnaryMathOperation) \ 182 V(UnaryMathOperation) \
182 V(UnknownOSRValue) \ 183 V(UnknownOSRValue) \
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 void Verify() const; 280 void Verify() const;
280 #endif 281 #endif
281 282
282 void StackUpon(Range* other) { 283 void StackUpon(Range* other) {
283 Intersect(other); 284 Intersect(other);
284 next_ = other; 285 next_ = other;
285 } 286 }
286 287
287 void Intersect(Range* other); 288 void Intersect(Range* other);
288 void Union(Range* other); 289 void Union(Range* other);
290 void CombinedMax(Range* other);
291 void CombinedMin(Range* other);
289 292
290 void AddConstant(int32_t value); 293 void AddConstant(int32_t value);
291 void Sar(int32_t value); 294 void Sar(int32_t value);
292 void Shl(int32_t value); 295 void Shl(int32_t value);
293 bool AddAndCheckOverflow(Range* other); 296 bool AddAndCheckOverflow(Range* other);
294 bool SubAndCheckOverflow(Range* other); 297 bool SubAndCheckOverflow(Range* other);
295 bool MulAndCheckOverflow(Range* other); 298 bool MulAndCheckOverflow(Range* other);
296 299
297 private: 300 private:
298 int32_t lower_; 301 int32_t lower_;
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3463 3466
3464 DECLARE_CONCRETE_INSTRUCTION(Div) 3467 DECLARE_CONCRETE_INSTRUCTION(Div)
3465 3468
3466 protected: 3469 protected:
3467 virtual bool DataEquals(HValue* other) { return true; } 3470 virtual bool DataEquals(HValue* other) { return true; }
3468 3471
3469 virtual Range* InferRange(Zone* zone); 3472 virtual Range* InferRange(Zone* zone);
3470 }; 3473 };
3471 3474
3472 3475
3476 class HMathMinMax: public HArithmeticBinaryOperation {
3477 public:
3478 enum Operation { kMathMin, kMathMax };
3479
3480 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op)
3481 : HArithmeticBinaryOperation(context, left, right),
3482 operation_(op) { }
3483
3484 virtual Representation RequiredInputRepresentation(int index) {
3485 return index == 0
3486 ? Representation::Tagged()
3487 : representation();
3488 }
3489
3490 virtual Representation InferredRepresentation() {
3491 if (left()->representation().IsInteger32() &&
3492 right()->representation().IsInteger32()) {
3493 return Representation::Integer32();
3494 }
3495 return Representation::Double();
3496 }
3497
3498 virtual bool IsCommutative() const { return true; }
3499
3500 Operation operation() { return operation_; }
3501
3502 DECLARE_CONCRETE_INSTRUCTION(MathMinMax)
3503
3504 protected:
3505 virtual bool DataEquals(HValue* other) {
3506 return other->IsMathMinMax() &&
3507 HMathMinMax::cast(other)->operation_ == operation_;
3508 }
3509
3510 virtual Range* InferRange(Zone* zone);
3511
3512 private:
3513 Operation operation_;
3514 };
3515
3516
3473 class HBitwise: public HBitwiseBinaryOperation { 3517 class HBitwise: public HBitwiseBinaryOperation {
3474 public: 3518 public:
3475 HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right) 3519 HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right)
3476 : HBitwiseBinaryOperation(context, left, right), op_(op) { 3520 : HBitwiseBinaryOperation(context, left, right), op_(op) {
3477 ASSERT(op == Token::BIT_AND || 3521 ASSERT(op == Token::BIT_AND ||
3478 op == Token::BIT_OR || 3522 op == Token::BIT_OR ||
3479 op == Token::BIT_XOR); 3523 op == Token::BIT_XOR);
3480 } 3524 }
3481 3525
3482 Token::Value op() const { return op_; } 3526 Token::Value op() const { return op_; }
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
5196 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 5240 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
5197 }; 5241 };
5198 5242
5199 5243
5200 #undef DECLARE_INSTRUCTION 5244 #undef DECLARE_INSTRUCTION
5201 #undef DECLARE_CONCRETE_INSTRUCTION 5245 #undef DECLARE_CONCRETE_INSTRUCTION
5202 5246
5203 } } // namespace v8::internal 5247 } } // namespace v8::internal
5204 5248
5205 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 5249 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698