OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 case kMipsRoundWS: { | 1321 case kMipsRoundWS: { |
1322 FPURegister scratch = kScratchDoubleReg; | 1322 FPURegister scratch = kScratchDoubleReg; |
1323 __ round_w_s(scratch, i.InputDoubleRegister(0)); | 1323 __ round_w_s(scratch, i.InputDoubleRegister(0)); |
1324 __ mfc1(i.OutputRegister(), scratch); | 1324 __ mfc1(i.OutputRegister(), scratch); |
1325 break; | 1325 break; |
1326 } | 1326 } |
1327 case kMipsTruncWS: { | 1327 case kMipsTruncWS: { |
1328 FPURegister scratch = kScratchDoubleReg; | 1328 FPURegister scratch = kScratchDoubleReg; |
1329 __ trunc_w_s(scratch, i.InputDoubleRegister(0)); | 1329 __ trunc_w_s(scratch, i.InputDoubleRegister(0)); |
1330 __ mfc1(i.OutputRegister(), scratch); | 1330 __ mfc1(i.OutputRegister(), scratch); |
| 1331 // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead, |
| 1332 // because INT32_MIN allows easier out-of-bounds detection. |
| 1333 __ addiu(kScratchReg, i.OutputRegister(), 1); |
| 1334 __ slt(kScratchReg2, kScratchReg, i.OutputRegister()); |
| 1335 __ Movn(i.OutputRegister(), kScratchReg, kScratchReg2); |
1331 break; | 1336 break; |
1332 } | 1337 } |
1333 case kMipsTruncUwD: { | 1338 case kMipsTruncUwD: { |
1334 FPURegister scratch = kScratchDoubleReg; | 1339 FPURegister scratch = kScratchDoubleReg; |
1335 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function. | 1340 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function. |
1336 __ Trunc_uw_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch); | 1341 __ Trunc_uw_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch); |
1337 break; | 1342 break; |
1338 } | 1343 } |
1339 case kMipsTruncUwS: { | 1344 case kMipsTruncUwS: { |
1340 FPURegister scratch = kScratchDoubleReg; | 1345 FPURegister scratch = kScratchDoubleReg; |
1341 // TODO(plind): Fix wrong param order of Trunc_uw_s() macro-asm function. | 1346 // TODO(plind): Fix wrong param order of Trunc_uw_s() macro-asm function. |
1342 __ Trunc_uw_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch); | 1347 __ Trunc_uw_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch); |
| 1348 // Avoid UINT32_MAX as an overflow indicator and use 0 instead, |
| 1349 // because 0 allows easier out-of-bounds detection. |
| 1350 __ addiu(kScratchReg, i.OutputRegister(), 1); |
| 1351 __ Movz(i.OutputRegister(), zero_reg, kScratchReg); |
1343 break; | 1352 break; |
1344 } | 1353 } |
1345 case kMipsFloat64ExtractLowWord32: | 1354 case kMipsFloat64ExtractLowWord32: |
1346 __ FmoveLow(i.OutputRegister(), i.InputDoubleRegister(0)); | 1355 __ FmoveLow(i.OutputRegister(), i.InputDoubleRegister(0)); |
1347 break; | 1356 break; |
1348 case kMipsFloat64ExtractHighWord32: | 1357 case kMipsFloat64ExtractHighWord32: |
1349 __ FmoveHigh(i.OutputRegister(), i.InputDoubleRegister(0)); | 1358 __ FmoveHigh(i.OutputRegister(), i.InputDoubleRegister(0)); |
1350 break; | 1359 break; |
1351 case kMipsFloat64InsertLowWord32: | 1360 case kMipsFloat64InsertLowWord32: |
1352 __ FmoveLow(i.OutputDoubleRegister(), i.InputRegister(1)); | 1361 __ FmoveLow(i.OutputDoubleRegister(), i.InputRegister(1)); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 padding_size -= v8::internal::Assembler::kInstrSize; | 2134 padding_size -= v8::internal::Assembler::kInstrSize; |
2126 } | 2135 } |
2127 } | 2136 } |
2128 } | 2137 } |
2129 | 2138 |
2130 #undef __ | 2139 #undef __ |
2131 | 2140 |
2132 } // namespace compiler | 2141 } // namespace compiler |
2133 } // namespace internal | 2142 } // namespace internal |
2134 } // namespace v8 | 2143 } // namespace v8 |
OLD | NEW |