OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 return Representation::Integer32(); | 1359 return Representation::Integer32(); |
1360 } | 1360 } |
1361 virtual HType CalculateInferredType() const; | 1361 virtual HType CalculateInferredType() const; |
1362 | 1362 |
1363 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") | 1363 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") |
1364 }; | 1364 }; |
1365 | 1365 |
1366 | 1366 |
1367 class HUnaryMathOperation: public HUnaryOperation { | 1367 class HUnaryMathOperation: public HUnaryOperation { |
1368 public: | 1368 public: |
1369 HUnaryMathOperation(HValue* value, MathFunctionId op) | 1369 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) |
1370 : HUnaryOperation(value), op_(op) { | 1370 : HUnaryOperation(value), op_(op) { |
1371 switch (op) { | 1371 switch (op) { |
1372 case kMathFloor: | 1372 case kMathFloor: |
1373 case kMathRound: | 1373 case kMathRound: |
1374 case kMathCeil: | 1374 case kMathCeil: |
1375 set_representation(Representation::Integer32()); | 1375 set_representation(Representation::Integer32()); |
1376 break; | 1376 break; |
1377 case kMathAbs: | 1377 case kMathAbs: |
1378 set_representation(Representation::Tagged()); | 1378 set_representation(Representation::Tagged()); |
1379 SetFlag(kFlexibleRepresentation); | 1379 SetFlag(kFlexibleRepresentation); |
1380 break; | 1380 break; |
1381 case kMathSqrt: | 1381 case kMathSqrt: |
1382 case kMathPowHalf: | 1382 case kMathPowHalf: |
| 1383 set_representation(Representation::Double()); |
| 1384 break; |
1383 default: | 1385 default: |
1384 set_representation(Representation::Double()); | 1386 UNREACHABLE(); |
1385 } | 1387 } |
1386 SetFlag(kUseGVN); | 1388 SetFlag(kUseGVN); |
1387 } | 1389 } |
1388 | 1390 |
1389 virtual void PrintDataTo(StringStream* stream) const; | 1391 virtual void PrintDataTo(StringStream* stream) const; |
1390 | 1392 |
1391 virtual HType CalculateInferredType() const; | 1393 virtual HType CalculateInferredType() const; |
1392 | 1394 |
1393 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1395 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1394 | 1396 |
(...skipping 17 matching lines...) Expand all Loading... |
1412 virtual HValue* Canonicalize() { | 1414 virtual HValue* Canonicalize() { |
1413 // If the input is integer32 then we replace the floor instruction | 1415 // If the input is integer32 then we replace the floor instruction |
1414 // with its inputs. This happens before the representation changes are | 1416 // with its inputs. This happens before the representation changes are |
1415 // introduced. | 1417 // introduced. |
1416 if (op() == kMathFloor) { | 1418 if (op() == kMathFloor) { |
1417 if (value()->representation().IsInteger32()) return value(); | 1419 if (value()->representation().IsInteger32()) return value(); |
1418 } | 1420 } |
1419 return this; | 1421 return this; |
1420 } | 1422 } |
1421 | 1423 |
1422 MathFunctionId op() const { return op_; } | 1424 BuiltinFunctionId op() const { return op_; } |
1423 const char* OpName() const; | 1425 const char* OpName() const; |
1424 | 1426 |
1425 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") | 1427 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") |
1426 | 1428 |
1427 private: | 1429 private: |
1428 MathFunctionId op_; | 1430 BuiltinFunctionId op_; |
1429 }; | 1431 }; |
1430 | 1432 |
1431 | 1433 |
1432 class HLoadElements: public HUnaryOperation { | 1434 class HLoadElements: public HUnaryOperation { |
1433 public: | 1435 public: |
1434 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { | 1436 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
1435 set_representation(Representation::Tagged()); | 1437 set_representation(Representation::Tagged()); |
1436 SetFlag(kUseGVN); | 1438 SetFlag(kUseGVN); |
1437 SetFlag(kDependsOnMaps); | 1439 SetFlag(kDependsOnMaps); |
1438 } | 1440 } |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 HValue* object() const { return left(); } | 2898 HValue* object() const { return left(); } |
2897 HValue* key() const { return right(); } | 2899 HValue* key() const { return right(); } |
2898 }; | 2900 }; |
2899 | 2901 |
2900 #undef DECLARE_INSTRUCTION | 2902 #undef DECLARE_INSTRUCTION |
2901 #undef DECLARE_CONCRETE_INSTRUCTION | 2903 #undef DECLARE_CONCRETE_INSTRUCTION |
2902 | 2904 |
2903 } } // namespace v8::internal | 2905 } } // namespace v8::internal |
2904 | 2906 |
2905 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 2907 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |