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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 int double_offset = offset(); | 539 int double_offset = offset(); |
540 // Account for saved regs if input is sp. | 540 // Account for saved regs if input is sp. |
541 if (input_reg.is(sp)) double_offset += 3 * kPointerSize; | 541 if (input_reg.is(sp)) double_offset += 3 * kPointerSize; |
542 | 542 |
543 Register scratch = | 543 Register scratch = |
544 GetRegisterThatIsNotOneOf(input_reg, result_reg); | 544 GetRegisterThatIsNotOneOf(input_reg, result_reg); |
545 Register scratch2 = | 545 Register scratch2 = |
546 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); | 546 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); |
547 Register scratch3 = | 547 Register scratch3 = |
548 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch2); | 548 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch2); |
549 DoubleRegister double_scratch = kLithiumScratchDouble.low(); | 549 DoubleRegister double_scratch = kLithiumScratchDouble; |
550 DoubleRegister double_input = f12; | |
551 | 550 |
552 __ Push(scratch, scratch2, scratch3); | 551 __ Push(scratch, scratch2, scratch3); |
553 | 552 |
554 __ ldc1(double_input, MemOperand(input_reg, double_offset)); | 553 if (!skip_fastpath()) { |
| 554 // Load double input. |
| 555 __ ldc1(double_scratch, MemOperand(input_reg, double_offset)); |
555 | 556 |
556 if (!skip_fastpath()) { | |
557 // Clear cumulative exception flags and save the FCSR. | 557 // Clear cumulative exception flags and save the FCSR. |
558 __ cfc1(scratch2, FCSR); | 558 __ cfc1(scratch2, FCSR); |
559 __ ctc1(zero_reg, FCSR); | 559 __ ctc1(zero_reg, FCSR); |
| 560 |
560 // Try a conversion to a signed integer. | 561 // Try a conversion to a signed integer. |
561 __ trunc_w_d(double_scratch, double_input); | 562 __ Trunc_w_d(double_scratch, double_scratch); |
| 563 // Move the converted value into the result register. |
562 __ mfc1(result_reg, double_scratch); | 564 __ mfc1(result_reg, double_scratch); |
| 565 |
563 // Retrieve and restore the FCSR. | 566 // Retrieve and restore the FCSR. |
564 __ cfc1(scratch, FCSR); | 567 __ cfc1(scratch, FCSR); |
565 __ ctc1(scratch2, FCSR); | 568 __ ctc1(scratch2, FCSR); |
| 569 |
566 // Check for overflow and NaNs. | 570 // Check for overflow and NaNs. |
567 __ And( | 571 __ And( |
568 scratch, scratch, | 572 scratch, scratch, |
569 kFCSROverflowFlagMask | kFCSRUnderflowFlagMask | 573 kFCSROverflowFlagMask | kFCSRUnderflowFlagMask |
570 | kFCSRInvalidOpFlagMask); | 574 | kFCSRInvalidOpFlagMask); |
571 // If we had no exceptions we are done. | 575 // If we had no exceptions we are done. |
572 __ Branch(&done, eq, scratch, Operand(zero_reg)); | 576 __ Branch(&done, eq, scratch, Operand(zero_reg)); |
573 } | 577 } |
574 | 578 |
575 // Load the double value and perform a manual truncation. | 579 // Load the double value and perform a manual truncation. |
576 Register input_high = scratch2; | 580 Register input_high = scratch2; |
577 Register input_low = scratch3; | 581 Register input_low = scratch3; |
578 __ Move(input_low, input_high, double_input); | 582 |
| 583 __ lw(input_low, MemOperand(input_reg, double_offset)); |
| 584 __ lw(input_high, MemOperand(input_reg, double_offset + kIntSize)); |
579 | 585 |
580 Label normal_exponent, restore_sign; | 586 Label normal_exponent, restore_sign; |
581 // Extract the biased exponent in result. | 587 // Extract the biased exponent in result. |
582 __ Ext(result_reg, | 588 __ Ext(result_reg, |
583 input_high, | 589 input_high, |
584 HeapNumber::kExponentShift, | 590 HeapNumber::kExponentShift, |
585 HeapNumber::kExponentBits); | 591 HeapNumber::kExponentBits); |
586 | 592 |
587 // Check for Infinity and NaNs, which should return 0. | 593 // Check for Infinity and NaNs, which should return 0. |
588 __ Subu(scratch, result_reg, HeapNumber::kExponentMask); | 594 __ Subu(scratch, result_reg, HeapNumber::kExponentMask); |
(...skipping 5642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6231 __ bind(&fast_elements_case); | 6237 __ bind(&fast_elements_case); |
6232 GenerateCase(masm, FAST_ELEMENTS); | 6238 GenerateCase(masm, FAST_ELEMENTS); |
6233 } | 6239 } |
6234 | 6240 |
6235 | 6241 |
6236 #undef __ | 6242 #undef __ |
6237 | 6243 |
6238 } } // namespace v8::internal | 6244 } } // namespace v8::internal |
6239 | 6245 |
6240 #endif // V8_TARGET_ARCH_MIPS | 6246 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |