| 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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 // A change from an integer32 can be replaced by the integer32 value. | 1278 // A change from an integer32 can be replaced by the integer32 value. |
| 1279 if (dividend->IsChange() && | 1279 if (dividend->IsChange() && |
| 1280 HChange::cast(dividend)->from().IsInteger32()) { | 1280 HChange::cast(dividend)->from().IsInteger32()) { |
| 1281 return HChange::cast(dividend)->value(); | 1281 return HChange::cast(dividend)->value(); |
| 1282 } | 1282 } |
| 1283 return NULL; | 1283 return NULL; |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 | 1286 |
| 1287 HValue* HUnaryMathOperation::Canonicalize() { | 1287 HValue* HUnaryMathOperation::Canonicalize() { |
| 1288 if (op() == kMathRound) { |
| 1289 HValue* val = value(); |
| 1290 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1291 |
| 1292 // If the input is integer32 then we replace the round instruction |
| 1293 // with its input. |
| 1294 if (val->representation().IsSmiOrInteger32()) return val; |
| 1295 } |
| 1296 |
| 1288 if (op() == kMathFloor) { | 1297 if (op() == kMathFloor) { |
| 1289 HValue* val = value(); | 1298 HValue* val = value(); |
| 1290 if (val->IsChange()) val = HChange::cast(val)->value(); | 1299 if (val->IsChange()) val = HChange::cast(val)->value(); |
| 1291 | 1300 |
| 1292 // If the input is integer32 then we replace the floor instruction | 1301 // If the input is integer32 then we replace the floor instruction |
| 1293 // with its input. | 1302 // with its input. |
| 1294 if (val->representation().IsSmiOrInteger32()) return val; | 1303 if (val->representation().IsSmiOrInteger32()) return val; |
| 1295 | 1304 |
| 1296 if (val->IsDiv() && (val->UseCount() == 1)) { | 1305 if (val->IsDiv() && (val->UseCount() == 1)) { |
| 1297 HDiv* hdiv = HDiv::cast(val); | 1306 HDiv* hdiv = HDiv::cast(val); |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3306 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); | 3315 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); |
| 3307 return type(); | 3316 return type(); |
| 3308 } | 3317 } |
| 3309 | 3318 |
| 3310 | 3319 |
| 3311 Representation HUnaryMathOperation::RepresentationFromInputs() { | 3320 Representation HUnaryMathOperation::RepresentationFromInputs() { |
| 3312 Representation rep = representation(); | 3321 Representation rep = representation(); |
| 3313 // If any of the actual input representation is more general than what we | 3322 // If any of the actual input representation is more general than what we |
| 3314 // have so far but not Tagged, use that representation instead. | 3323 // have so far but not Tagged, use that representation instead. |
| 3315 Representation input_rep = value()->representation(); | 3324 Representation input_rep = value()->representation(); |
| 3316 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); | 3325 if (!input_rep.IsTagged()) { |
| 3326 rep = rep.generalize(input_rep); |
| 3327 } else if (flexible_int()) { |
| 3328 rep = Representation::Integer32(); |
| 3329 } |
| 3317 return rep; | 3330 return rep; |
| 3318 } | 3331 } |
| 3319 | 3332 |
| 3320 | 3333 |
| 3321 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | 3334 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
| 3322 HValue* dominator) { | 3335 HValue* dominator) { |
| 3323 ASSERT(side_effect == kChangesNewSpacePromotion); | 3336 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 3324 if (!FLAG_use_allocation_folding) return; | 3337 if (!FLAG_use_allocation_folding) return; |
| 3325 | 3338 |
| 3326 // Try to fold allocations together with their dominating allocations. | 3339 // Try to fold allocations together with their dominating allocations. |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4135 break; | 4148 break; |
| 4136 case kExternalMemory: | 4149 case kExternalMemory: |
| 4137 stream->Add("[external-memory]"); | 4150 stream->Add("[external-memory]"); |
| 4138 break; | 4151 break; |
| 4139 } | 4152 } |
| 4140 | 4153 |
| 4141 stream->Add("@%d", offset()); | 4154 stream->Add("@%d", offset()); |
| 4142 } | 4155 } |
| 4143 | 4156 |
| 4144 } } // namespace v8::internal | 4157 } } // namespace v8::internal |
| OLD | NEW |