| 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 | 1046 |
| 1047 HValue* HUnaryMathOperation::Canonicalize() { | 1047 HValue* HUnaryMathOperation::Canonicalize() { |
| 1048 if (op() == kMathFloor) { | 1048 if (op() == kMathFloor) { |
| 1049 // If the input is integer32 then we replace the floor instruction | 1049 // If the input is integer32 then we replace the floor instruction |
| 1050 // with its input. This happens before the representation changes are | 1050 // with its input. This happens before the representation changes are |
| 1051 // introduced. | 1051 // introduced. |
| 1052 if (value()->representation().IsInteger32()) return value(); | 1052 if (value()->representation().IsInteger32()) return value(); |
| 1053 | 1053 |
| 1054 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_IA32) || \ | |
| 1055 defined(V8_TARGET_ARCH_X64) | |
| 1056 if (value()->IsDiv() && (value()->UseCount() == 1)) { | 1054 if (value()->IsDiv() && (value()->UseCount() == 1)) { |
| 1057 // TODO(2038): Implement this optimization for non ARM architectures. | 1055 // TODO(2038): Implement this optimization for non ARM architectures. |
| 1058 HDiv* hdiv = HDiv::cast(value()); | 1056 HDiv* hdiv = HDiv::cast(value()); |
| 1059 HValue* left = hdiv->left(); | 1057 HValue* left = hdiv->left(); |
| 1060 HValue* right = hdiv->right(); | 1058 HValue* right = hdiv->right(); |
| 1061 // Try to simplify left and right values of the division. | 1059 // Try to simplify left and right values of the division. |
| 1062 HValue* new_left = | 1060 HValue* new_left = |
| 1063 LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(left); | 1061 LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(left); |
| 1064 HValue* new_right = | 1062 HValue* new_right = |
| 1065 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); | 1063 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1088 // more. | 1086 // more. |
| 1089 hdiv->DeleteAndReplaceWith(NULL); | 1087 hdiv->DeleteAndReplaceWith(NULL); |
| 1090 ASSERT(left->IsChange() || left->IsConstant()); | 1088 ASSERT(left->IsChange() || left->IsConstant()); |
| 1091 ASSERT(right->IsChange() || right->IsConstant()); | 1089 ASSERT(right->IsChange() || right->IsConstant()); |
| 1092 if (left->HasNoUses()) left->DeleteAndReplaceWith(NULL); | 1090 if (left->HasNoUses()) left->DeleteAndReplaceWith(NULL); |
| 1093 if (right->HasNoUses()) right->DeleteAndReplaceWith(NULL); | 1091 if (right->HasNoUses()) right->DeleteAndReplaceWith(NULL); |
| 1094 | 1092 |
| 1095 // Return NULL to remove this instruction from the graph. | 1093 // Return NULL to remove this instruction from the graph. |
| 1096 return NULL; | 1094 return NULL; |
| 1097 } | 1095 } |
| 1098 #endif // V8_TARGET_ARCH_ARM | |
| 1099 } | 1096 } |
| 1100 return this; | 1097 return this; |
| 1101 } | 1098 } |
| 1102 | 1099 |
| 1103 | 1100 |
| 1104 HValue* HCheckInstanceType::Canonicalize() { | 1101 HValue* HCheckInstanceType::Canonicalize() { |
| 1105 if (check_ == IS_STRING && | 1102 if (check_ == IS_STRING && |
| 1106 !value()->type().IsUninitialized() && | 1103 !value()->type().IsUninitialized() && |
| 1107 value()->type().IsString()) { | 1104 value()->type().IsString()) { |
| 1108 return NULL; | 1105 return NULL; |
| (...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 | 2789 |
| 2793 | 2790 |
| 2794 void HCheckFunction::Verify() { | 2791 void HCheckFunction::Verify() { |
| 2795 HInstruction::Verify(); | 2792 HInstruction::Verify(); |
| 2796 ASSERT(HasNoUses()); | 2793 ASSERT(HasNoUses()); |
| 2797 } | 2794 } |
| 2798 | 2795 |
| 2799 #endif | 2796 #endif |
| 2800 | 2797 |
| 2801 } } // namespace v8::internal | 2798 } } // namespace v8::internal |
| OLD | NEW |