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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 } | 1284 } |
1285 | 1285 |
1286 | 1286 |
1287 HValue* HUnaryMathOperation::Canonicalize() { | 1287 HValue* HUnaryMathOperation::Canonicalize() { |
1288 if (op() == kMathRound) { | 1288 if (op() == kMathRound) { |
1289 HValue* val = value(); | 1289 HValue* val = value(); |
1290 if (val->IsChange()) val = HChange::cast(val)->value(); | 1290 if (val->IsChange()) val = HChange::cast(val)->value(); |
1291 | 1291 |
1292 // If the input is integer32 then we replace the round instruction | 1292 // If the input is integer32 then we replace the round instruction |
1293 // with its input. | 1293 // with its input. |
1294 if (val->representation().IsSmiOrInteger32()) return val; | 1294 if (val->representation().IsSmiOrInteger32()) { |
| 1295 if (!val->representation().Equals(representation())) { |
| 1296 HChange* result = new(block()->zone()) HChange( |
| 1297 val, representation(), false, false, false); |
| 1298 result->InsertBefore(this); |
| 1299 return result; |
| 1300 } |
| 1301 return val; |
| 1302 } |
1295 } | 1303 } |
1296 | 1304 |
1297 if (op() == kMathFloor) { | 1305 if (op() == kMathFloor) { |
1298 HValue* val = value(); | 1306 HValue* val = value(); |
1299 if (val->IsChange()) val = HChange::cast(val)->value(); | 1307 if (val->IsChange()) val = HChange::cast(val)->value(); |
1300 | 1308 |
1301 // If the input is integer32 then we replace the floor instruction | 1309 // If the input is integer32 then we replace the floor instruction |
1302 // with its input. | 1310 // with its input. |
1303 if (val->representation().IsSmiOrInteger32()) return val; | 1311 if (val->representation().IsSmiOrInteger32()) { |
| 1312 if (!val->representation().Equals(representation())) { |
| 1313 HChange* result = new(block()->zone()) HChange( |
| 1314 val, representation(), false, false, false); |
| 1315 result->InsertBefore(this); |
| 1316 return result; |
| 1317 } |
| 1318 return val; |
| 1319 } |
1304 | 1320 |
1305 if (val->IsDiv() && (val->UseCount() == 1)) { | 1321 if (val->IsDiv() && (val->UseCount() == 1)) { |
1306 HDiv* hdiv = HDiv::cast(val); | 1322 HDiv* hdiv = HDiv::cast(val); |
1307 HValue* left = hdiv->left(); | 1323 HValue* left = hdiv->left(); |
1308 HValue* right = hdiv->right(); | 1324 HValue* right = hdiv->right(); |
1309 // Try to simplify left and right values of the division. | 1325 // Try to simplify left and right values of the division. |
1310 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1326 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
1311 if (new_left == NULL && | 1327 if (new_left == NULL && |
1312 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1328 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
1313 new_left = new(block()->zone()) HChange( | 1329 new_left = new(block()->zone()) HChange( |
(...skipping 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4148 break; | 4164 break; |
4149 case kExternalMemory: | 4165 case kExternalMemory: |
4150 stream->Add("[external-memory]"); | 4166 stream->Add("[external-memory]"); |
4151 break; | 4167 break; |
4152 } | 4168 } |
4153 | 4169 |
4154 stream->Add("@%d", offset()); | 4170 stream->Add("@%d", offset()); |
4155 } | 4171 } |
4156 | 4172 |
4157 } } // namespace v8::internal | 4173 } } // namespace v8::internal |
OLD | NEW |