OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> | 5 #include <limits.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #if V8_TARGET_ARCH_MIPS64 | 10 #if V8_TARGET_ARCH_MIPS64 |
(...skipping 4312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4323 case BC: | 4323 case BC: |
4324 BranchCompactHelper(true, 26); | 4324 BranchCompactHelper(true, 26); |
4325 break; | 4325 break; |
4326 case BALC: | 4326 case BALC: |
4327 BranchAndLinkCompactHelper(true, 26); | 4327 BranchAndLinkCompactHelper(true, 26); |
4328 break; | 4328 break; |
4329 case POP10: // BOVC, BEQZALC, BEQC / ADDI (pre-r6) | 4329 case POP10: // BOVC, BEQZALC, BEQC / ADDI (pre-r6) |
4330 if (kArchVariant == kMips64r6) { | 4330 if (kArchVariant == kMips64r6) { |
4331 if (rs_reg >= rt_reg) { // BOVC | 4331 if (rs_reg >= rt_reg) { // BOVC |
4332 if (HaveSameSign(rs, rt)) { | 4332 if (HaveSameSign(rs, rt)) { |
4333 if (rs > 0) { | 4333 int64_t sum = rs + rt; |
4334 BranchCompactHelper(rs > Registers::kMaxValue - rt, 16); | 4334 BranchCompactHelper(sum < INT32_MIN || sum > INT32_MAX, 16); |
4335 } else if (rs < 0) { | |
4336 BranchCompactHelper(rs < Registers::kMinValue - rt, 16); | |
4337 } | |
4338 } | 4335 } |
4339 } else { | 4336 } else { |
4340 if (rs_reg == 0) { // BEQZALC | 4337 if (rs_reg == 0) { // BEQZALC |
4341 BranchAndLinkCompactHelper(rt == 0, 16); | 4338 BranchAndLinkCompactHelper(rt == 0, 16); |
4342 } else { // BEQC | 4339 } else { // BEQC |
4343 BranchCompactHelper(rt == rs, 16); | 4340 BranchCompactHelper(rt == rs, 16); |
4344 } | 4341 } |
4345 } | 4342 } |
4346 } else { // ADDI | 4343 } else { // ADDI |
4347 if (HaveSameSign(rs, se_imm16)) { | 4344 if (HaveSameSign(rs, se_imm16)) { |
4348 if (rs > 0) { | 4345 if (rs > 0) { |
4349 if (rs <= Registers::kMaxValue - se_imm16) { | 4346 if (rs <= Registers::kMaxValue - se_imm16) { |
4350 SignalException(kIntegerOverflow); | 4347 SignalException(kIntegerOverflow); |
4351 } | 4348 } |
4352 } else if (rs < 0) { | 4349 } else if (rs < 0) { |
4353 if (rs >= Registers::kMinValue - se_imm16) { | 4350 if (rs >= Registers::kMinValue - se_imm16) { |
4354 SignalException(kIntegerUnderflow); | 4351 SignalException(kIntegerUnderflow); |
4355 } | 4352 } |
4356 } | 4353 } |
4357 } | 4354 } |
4358 SetResult(rt_reg, rs + se_imm16); | 4355 SetResult(rt_reg, rs + se_imm16); |
4359 } | 4356 } |
4360 break; | 4357 break; |
4361 case POP30: // BNVC, BNEZALC, BNEC / DADDI (pre-r6) | 4358 case POP30: // BNVC, BNEZALC, BNEC / DADDI (pre-r6) |
4362 if (kArchVariant == kMips64r6) { | 4359 if (kArchVariant == kMips64r6) { |
4363 if (rs_reg >= rt_reg) { // BNVC | 4360 if (rs_reg >= rt_reg) { // BNVC |
4364 if (!HaveSameSign(rs, rt) || rs == 0 || rt == 0) { | 4361 if (!HaveSameSign(rs, rt) || rs == 0 || rt == 0) { |
4365 BranchCompactHelper(true, 16); | 4362 BranchCompactHelper(true, 16); |
4366 } else { | 4363 } else { |
4367 if (rs > 0) { | 4364 int64_t sum = rs + rt; |
4368 BranchCompactHelper(rs <= Registers::kMaxValue - rt, 16); | 4365 BranchCompactHelper(sum >= INT32_MIN && sum <= INT32_MAX, 16); |
4369 } else if (rs < 0) { | |
4370 BranchCompactHelper(rs >= Registers::kMinValue - rt, 16); | |
4371 } | |
4372 } | 4366 } |
4373 } else { | 4367 } else { |
4374 if (rs_reg == 0) { // BNEZALC | 4368 if (rs_reg == 0) { // BNEZALC |
4375 BranchAndLinkCompactHelper(rt != 0, 16); | 4369 BranchAndLinkCompactHelper(rt != 0, 16); |
4376 } else { // BNEC | 4370 } else { // BNEC |
4377 BranchCompactHelper(rt != rs, 16); | 4371 BranchCompactHelper(rt != rs, 16); |
4378 } | 4372 } |
4379 } | 4373 } |
4380 } | 4374 } |
4381 break; | 4375 break; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4861 } | 4855 } |
4862 | 4856 |
4863 | 4857 |
4864 #undef UNSUPPORTED | 4858 #undef UNSUPPORTED |
4865 } // namespace internal | 4859 } // namespace internal |
4866 } // namespace v8 | 4860 } // namespace v8 |
4867 | 4861 |
4868 #endif // USE_SIMULATOR | 4862 #endif // USE_SIMULATOR |
4869 | 4863 |
4870 #endif // V8_TARGET_ARCH_MIPS64 | 4864 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |