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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 uint32_t constant_abs = (constant + mask) ^ mask; | 1261 uint32_t constant_abs = (constant + mask) ^ mask; |
1262 | 1262 |
1263 if (IsPowerOf2(constant_abs) || | 1263 if (IsPowerOf2(constant_abs) || |
1264 IsPowerOf2(constant_abs - 1) || | 1264 IsPowerOf2(constant_abs - 1) || |
1265 IsPowerOf2(constant_abs + 1)) { | 1265 IsPowerOf2(constant_abs + 1)) { |
1266 if (IsPowerOf2(constant_abs)) { | 1266 if (IsPowerOf2(constant_abs)) { |
1267 int32_t shift = WhichPowerOf2(constant_abs); | 1267 int32_t shift = WhichPowerOf2(constant_abs); |
1268 __ sll(result, left, shift); | 1268 __ sll(result, left, shift); |
1269 } else if (IsPowerOf2(constant_abs - 1)) { | 1269 } else if (IsPowerOf2(constant_abs - 1)) { |
1270 int32_t shift = WhichPowerOf2(constant_abs - 1); | 1270 int32_t shift = WhichPowerOf2(constant_abs - 1); |
1271 __ sll(result, left, shift); | 1271 __ sll(scratch, left, shift); |
1272 __ Addu(result, result, left); | 1272 __ Addu(result, scratch, left); |
1273 } else if (IsPowerOf2(constant_abs + 1)) { | 1273 } else if (IsPowerOf2(constant_abs + 1)) { |
1274 int32_t shift = WhichPowerOf2(constant_abs + 1); | 1274 int32_t shift = WhichPowerOf2(constant_abs + 1); |
1275 __ sll(result, left, shift); | 1275 __ sll(scratch, left, shift); |
1276 __ Subu(result, result, left); | 1276 __ Subu(result, scratch, left); |
1277 } | 1277 } |
1278 | 1278 |
1279 // Correct the sign of the result is the constant is negative. | 1279 // Correct the sign of the result is the constant is negative. |
1280 if (constant < 0) { | 1280 if (constant < 0) { |
1281 __ Subu(result, zero_reg, result); | 1281 __ Subu(result, zero_reg, result); |
1282 } | 1282 } |
1283 | 1283 |
1284 } else { | 1284 } else { |
1285 // Generate standard code. | 1285 // Generate standard code. |
1286 __ li(at, constant); | 1286 __ li(at, constant); |
(...skipping 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6102 __ Subu(scratch, result, scratch); | 6102 __ Subu(scratch, result, scratch); |
6103 __ lw(result, FieldMemOperand(scratch, | 6103 __ lw(result, FieldMemOperand(scratch, |
6104 FixedArray::kHeaderSize - kPointerSize)); | 6104 FixedArray::kHeaderSize - kPointerSize)); |
6105 __ bind(&done); | 6105 __ bind(&done); |
6106 } | 6106 } |
6107 | 6107 |
6108 | 6108 |
6109 #undef __ | 6109 #undef __ |
6110 | 6110 |
6111 } } // namespace v8::internal | 6111 } } // namespace v8::internal |
OLD | NEW |