OLD | NEW |
---|---|
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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1187 class HUnaryOperation: public HTemplateInstruction<1> { | 1187 class HUnaryOperation: public HTemplateInstruction<1> { |
1188 public: | 1188 public: |
1189 explicit HUnaryOperation(HValue* value) { | 1189 explicit HUnaryOperation(HValue* value) { |
1190 SetOperandAt(0, value); | 1190 SetOperandAt(0, value); |
1191 } | 1191 } |
1192 | 1192 |
1193 static HUnaryOperation* cast(HValue* value) { | 1193 static HUnaryOperation* cast(HValue* value) { |
1194 return reinterpret_cast<HUnaryOperation*>(value); | 1194 return reinterpret_cast<HUnaryOperation*>(value); |
1195 } | 1195 } |
1196 | 1196 |
1197 HValue* value() { return OperandAt(0); } | 1197 HValue* value() const { return OperandAt(0); } |
1198 virtual void PrintDataTo(StringStream* stream); | 1198 virtual void PrintDataTo(StringStream* stream); |
1199 }; | 1199 }; |
1200 | 1200 |
1201 | 1201 |
1202 class HThrow: public HTemplateInstruction<2> { | 1202 class HThrow: public HTemplateInstruction<2> { |
1203 public: | 1203 public: |
1204 HThrow(HValue* context, HValue* value) { | 1204 HThrow(HValue* context, HValue* value) { |
1205 SetOperandAt(0, context); | 1205 SetOperandAt(0, context); |
1206 SetOperandAt(1, value); | 1206 SetOperandAt(1, value); |
1207 SetAllSideEffects(); | 1207 SetAllSideEffects(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1263 SetFlag(kUseGVN); | 1263 SetFlag(kUseGVN); |
1264 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); | 1264 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); |
1265 if (is_truncating) SetFlag(kTruncatingToInt32); | 1265 if (is_truncating) SetFlag(kTruncatingToInt32); |
1266 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); | 1266 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
1267 } | 1267 } |
1268 | 1268 |
1269 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1269 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1270 virtual HType CalculateInferredType(); | 1270 virtual HType CalculateInferredType(); |
1271 virtual HValue* Canonicalize(); | 1271 virtual HValue* Canonicalize(); |
1272 | 1272 |
1273 Representation from() { return value()->representation(); } | 1273 Representation from() const { return value()->representation(); } |
1274 Representation to() { return representation(); } | 1274 Representation to() const { return representation(); } |
1275 bool deoptimize_on_undefined() const { | 1275 bool deoptimize_on_undefined() const { |
1276 return CheckFlag(kDeoptimizeOnUndefined); | 1276 return CheckFlag(kDeoptimizeOnUndefined); |
1277 } | 1277 } |
1278 bool deoptimize_on_minus_zero() const { | 1278 bool deoptimize_on_minus_zero() const { |
1279 return CheckFlag(kBailoutOnMinusZero); | 1279 return CheckFlag(kBailoutOnMinusZero); |
1280 } | 1280 } |
1281 virtual Representation RequiredInputRepresentation(int index) { | 1281 virtual Representation RequiredInputRepresentation(int index) { |
1282 return from(); | 1282 return from(); |
1283 } | 1283 } |
1284 | 1284 |
1285 virtual Range* InferRange(Zone* zone); | 1285 virtual Range* InferRange(Zone* zone); |
1286 | 1286 |
1287 virtual void PrintDataTo(StringStream* stream); | 1287 virtual void PrintDataTo(StringStream* stream); |
1288 | 1288 |
1289 DECLARE_CONCRETE_INSTRUCTION(Change) | 1289 DECLARE_CONCRETE_INSTRUCTION(Change) |
1290 | 1290 |
1291 protected: | 1291 protected: |
1292 virtual bool DataEquals(HValue* other) { return true; } | 1292 virtual bool DataEquals(HValue* other) { return true; } |
1293 | 1293 |
1294 private: | 1294 private: |
1295 virtual bool IsDeletable() const { return true; } | 1295 virtual bool IsDeletable() const { |
1296 return !from().IsTagged() || (!to().IsDouble() && value()->type().IsSmi()); | |
Michael Starzinger
2012/10/11 13:48:43
Why do we check that Smi->Double is not deleted? S
Sven Panne
2012/10/11 14:11:50
Yep, it seems that the !to().IsDouble() part can b
| |
1297 } | |
1296 }; | 1298 }; |
1297 | 1299 |
1298 | 1300 |
1299 class HClampToUint8: public HUnaryOperation { | 1301 class HClampToUint8: public HUnaryOperation { |
1300 public: | 1302 public: |
1301 explicit HClampToUint8(HValue* value) | 1303 explicit HClampToUint8(HValue* value) |
1302 : HUnaryOperation(value) { | 1304 : HUnaryOperation(value) { |
1303 set_representation(Representation::Integer32()); | 1305 set_representation(Representation::Integer32()); |
1304 SetFlag(kUseGVN); | 1306 SetFlag(kUseGVN); |
1305 } | 1307 } |
(...skipping 4101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5407 virtual bool IsDeletable() const { return true; } | 5409 virtual bool IsDeletable() const { return true; } |
5408 }; | 5410 }; |
5409 | 5411 |
5410 | 5412 |
5411 #undef DECLARE_INSTRUCTION | 5413 #undef DECLARE_INSTRUCTION |
5412 #undef DECLARE_CONCRETE_INSTRUCTION | 5414 #undef DECLARE_CONCRETE_INSTRUCTION |
5413 | 5415 |
5414 } } // namespace v8::internal | 5416 } } // namespace v8::internal |
5415 | 5417 |
5416 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5418 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |