OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2709 __ PrepareCallCFunction(4, scratch); | 2709 __ PrepareCallCFunction(4, scratch); |
2710 __ vmov(r0, r1, ToDoubleRegister(left)); | 2710 __ vmov(r0, r1, ToDoubleRegister(left)); |
2711 __ vmov(r2, r3, result_reg); | 2711 __ vmov(r2, r3, result_reg); |
2712 __ CallCFunction(ExternalReference::power_double_double_function(), 4); | 2712 __ CallCFunction(ExternalReference::power_double_double_function(), 4); |
2713 } | 2713 } |
2714 // Store the result in the result register. | 2714 // Store the result in the result register. |
2715 __ GetCFunctionDoubleResult(result_reg); | 2715 __ GetCFunctionDoubleResult(result_reg); |
2716 } | 2716 } |
2717 | 2717 |
2718 | 2718 |
2719 void LCodeGen::TryVcvtTruncation(Register result, | |
2720 DwVfpRegister double_input, | |
2721 Register saved_fpscr, | |
2722 Register current_fpscr, | |
2723 SwVfpRegister single_scratch, | |
2724 TruncationType type, | |
2725 Label* success) { | |
2726 // Cumulative exception flags. | |
2727 __ bic(current_fpscr, saved_fpscr, Operand(kVFPExceptionMask | | |
2728 kVFPFlushToZeroMask)); | |
2729 __ vmsr(current_fpscr); | |
2730 // Try a standard vfp floating-point to integer truncation, using the | |
2731 // default 'round to zero' mode. | |
2732 if (type == kSignedTruncation) { | |
2733 __ vcvt_s32_f64(single_scratch, double_input); | |
2734 } else { | |
2735 __ vcvt_u32_f64(single_scratch, double_input); | |
2736 } | |
2737 | |
2738 // Retrieve FPSCR and check for vfp exceptions. | |
2739 __ vmrs(current_fpscr); | |
2740 __ tst(current_fpscr, Operand(kVFPExceptionMask)); | |
2741 // Load the result and restore the FPSCR. | |
2742 __ vmov(result, single_scratch); | |
2743 // Restore the saved FPSCR. | |
2744 __ vmsr(saved_fpscr); | |
2745 // If no vfp exceptions were raised we are done. Otherwise fall through. | |
2746 __ b(eq, success); | |
2747 } | |
2748 | |
2749 | |
2750 // The truncation process is: | |
2751 // 1: Try to truncate using VFP floating-point to integer vcvt instructions. | |
2752 // a: Try to truncate to a signed int. | |
2753 // b: If that fails, try to truncate to an unsigned int. | |
2754 // 2: If that fails, try to bring back the input value in the 32bit int range. | |
2755 // If we succeed jump backward to let vcvt instructions truncate the value. | |
2756 // 3: If we could not bring back the value to the int32 range, check for special | |
2757 // cases. | |
2758 // 4: If that also fails, fall through. The following code should handle the | |
2759 // failure, probably by deoptimizing. | |
2760 void LCodeGen::EmitECMATruncate(Register result, | |
Karl Klose
2011/03/09 10:37:51
As fschneider suggested, it would be good to move
Alexandre
2011/03/15 08:45:39
I first moved everything to a stub. Then I refact
| |
2761 Register scratch1, | |
2762 Register scratch2, | |
2763 DwVfpRegister double_input, | |
2764 DwVfpRegister double_scratch1, | |
2765 DwVfpRegister double_scratch2, | |
2766 Label* done) { | |
2767 ASSERT(!scratch1.is(result)); | |
2768 ASSERT(!scratch2.is(result)); | |
2769 ASSERT(!scratch1.is(scratch2)); | |
2770 ASSERT(!double_scratch1.is(double_input)); | |
2771 ASSERT(!double_scratch2.is(double_input)); | |
2772 ASSERT(!double_scratch1.is(double_scratch2)); | |
2773 | |
2774 Register prev_fpscr = scratch1; | |
2775 Register curr_fpscr = scratch2; | |
2776 scratch1 = no_reg; | |
2777 scratch2 = no_reg; | |
2778 | |
2779 SwVfpRegister single_scratch = double_scratch2.low(); | |
2780 | |
2781 Label retry, check_special_cases; | |
2782 | |
2783 // Save the current FPSCR. | |
2784 __ vmrs(prev_fpscr); | |
2785 __ bind(&retry); | |
2786 | |
2787 // Try standard vfp floating-point to integer truncations, using the | |
2788 // default 'round to zero' mode. | |
Søren Thygesen Gjesse
2011/03/08 16:15:03
Drive-by:
How fast is the VFP rounding? Maybe just
Karl Klose
2011/03/09 10:37:51
We should measure later, if bit-fiddeling code as
Alexandre
2011/03/15 08:45:39
I initially thought that the vfp would be faster.
| |
2789 TryVcvtTruncation(result, | |
2790 double_input, | |
2791 prev_fpscr, | |
2792 curr_fpscr, | |
2793 single_scratch, | |
2794 kSignedTruncation, | |
2795 done); | |
2796 | |
2797 // Exceptions were raised. Try an unsigned conversion. | |
2798 TryVcvtTruncation(result, | |
2799 double_input, | |
2800 prev_fpscr, | |
2801 curr_fpscr, | |
2802 single_scratch, | |
2803 kUnsignedTruncation, | |
2804 done); | |
2805 | |
2806 | |
2807 // Standard conversion did not work. Try to handle manually. | |
2808 | |
2809 // Clear vfp cumulative exception flags. | |
2810 __ bic(curr_fpscr, curr_fpscr, Operand(kVFPExceptionMask)); | |
2811 __ vmsr(curr_fpscr); | |
2812 | |
2813 // The truncating conversion is invariant modulo 2^32. | |
2814 // If we are lucky, we can easily bring the input value to the | |
2815 // [-2^32, 2^32] range. | |
2816 Label positive, in_two_31_range; | |
2817 const double two_31_value = 2147483648.0; | |
Karl Klose
2011/03/09 10:37:51
Constants should be formatted as follows: kTwo31Va
Alexandre
2011/03/15 08:45:39
Done.
| |
2818 const double two_32_value = 4294967296.0; | |
2819 // Start bringing the input value to the [-2^32, 2^32] range. | |
2820 DwVfpRegister two_32 = double_scratch2; | |
2821 __ vmov(two_32, two_32_value); | |
2822 __ vdiv(double_scratch1, double_input, two_32); | |
2823 __ vcvt_s32_f64(double_scratch1.low(), double_scratch1); | |
2824 __ vcvt_f64_s32(double_scratch1, double_scratch1.low()); | |
2825 __ vmul(double_scratch1, double_scratch1, two_32); | |
2826 // Test for vfp exceptions. | |
2827 __ vmrs(curr_fpscr); | |
2828 __ tst(curr_fpscr, Operand(kVFPExceptionMask)); | |
2829 // The following code won't work if vfp exceptions were raised. | |
2830 // (Overflow is raised for high values, infinity. Invalid exception for NaN.) | |
2831 __ b(ne, &check_special_cases); | |
2832 // Perform the subtraction after the branch to preserve the input. | |
2833 __ vsub(double_input, double_input, double_scratch1); | |
2834 | |
2835 // double_input: value brought back to [-2^32, 2^32]. | |
2836 | |
2837 // Get the value rounded toward 0. | |
2838 DwVfpRegister two_31 = double_scratch2; | |
2839 __ vabs(double_scratch1, double_input); | |
2840 __ vmov(two_31, two_31_value); | |
2841 __ vcmp(double_scratch1, two_31); | |
2842 __ vmrs(pc); | |
2843 __ b(lt, &in_two_31_range); | |
2844 | |
2845 // The value is in the [-2^32, -2^31] U [2^31, 2^32] range. | |
2846 // Add or subtrct 2^31 to easily round it toward zero. | |
Karl Klose
2011/03/09 10:37:51
subtrct -> subtract.
Alexandre
2011/03/15 08:45:39
Done.
| |
2847 // Push negative values below -2^31 to the positive range to let vcvt_u32_f64 | |
2848 // handle the conversion. (For negative value we add 2^31 to easily round, | |
2849 // then add 2^31 again instead of subtracting. This works because the | |
2850 // operation is invariant modulo 2^32.) | |
2851 __ vcmp(double_input, 0.0); | |
2852 __ vmrs(pc); | |
2853 __ vadd(double_input, double_input, two_31, lt); | |
2854 __ vsub(double_input, double_input, two_31, ge); | |
2855 __ vcvt_s32_f64(double_input.low(), double_input); | |
Karl Klose
2011/03/09 10:37:51
Should this code not use vcvt_u32_f64 as stated in
Alexandre
2011/03/15 08:45:39
No it should not. I updated the comment before to
| |
2856 __ vcvt_f64_s32(double_input, double_input.low()); | |
2857 __ vadd(double_input, double_input, two_31); | |
2858 __ b(&retry); | |
2859 | |
2860 __ bind(&in_two_31_range); | |
2861 // Round the value toward zero and jump back to let the standard | |
2862 // code handle the conversion. | |
2863 __ vcvt_s32_f64(double_input.low(), double_input); | |
2864 __ vcvt_f64_s32(double_input, double_input.low()); | |
2865 __ b(&retry); | |
2866 | |
2867 // We never fall through to here. | |
2868 // We always jump to 'done' if conversion was successful. | |
2869 if (FLAG_debug_code) { | |
2870 __ Abort("We should never fall through."); | |
2871 } | |
2872 | |
2873 // Check for a high exponent, infinity, and NaN, which should all return 0. | |
2874 // * If the unbiased exponent is greater than 52 + 32 = 84 then all mantissa | |
2875 // bits are shifted out of the 32bit integer range and the result is 0. | |
2876 // * NaN and Infinity have an exponent of 0x7ff, so the test below will also | |
2877 // detect them. | |
2878 | |
2879 __ bind(&check_special_cases); | |
2880 | |
2881 scratch2 = curr_fpscr; | |
2882 curr_fpscr = no_reg; | |
2883 | |
2884 // Get exponent alone in scratch2. | |
2885 __ vmov(scratch2, double_input.high()); | |
2886 __ Ubfx(scratch2, | |
2887 scratch2, | |
2888 HeapNumber::kExponentShift, | |
2889 HeapNumber::kExponentBits); | |
2890 const int32_t big_exp = 84; | |
2891 __ cmp(scratch2, Operand(HeapNumber::kExponentBias + big_exp)); | |
2892 __ mov(result, Operand(0)); | |
2893 __ b(ge, done); | |
2894 | |
2895 // We could not handle the truncation manually. | |
2896 // Restore the FPSCR and fall through. | |
2897 __ vmsr(prev_fpscr); | |
2898 } | |
2899 | |
2900 | |
2719 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2901 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
2720 ASSERT(ToDoubleRegister(instr->result()).is(d2)); | 2902 ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
2721 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2903 TranscendentalCacheStub stub(TranscendentalCache::LOG, |
2722 TranscendentalCacheStub::UNTAGGED); | 2904 TranscendentalCacheStub::UNTAGGED); |
2723 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 2905 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
2724 } | 2906 } |
2725 | 2907 |
2726 | 2908 |
2727 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { | 2909 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { |
2728 ASSERT(ToDoubleRegister(instr->result()).is(d2)); | 2910 ASSERT(ToDoubleRegister(instr->result()).is(d2)); |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3274 public: | 3456 public: |
3275 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 3457 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
3276 : LDeferredCode(codegen), instr_(instr) { } | 3458 : LDeferredCode(codegen), instr_(instr) { } |
3277 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } | 3459 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } |
3278 private: | 3460 private: |
3279 LTaggedToI* instr_; | 3461 LTaggedToI* instr_; |
3280 }; | 3462 }; |
3281 | 3463 |
3282 | 3464 |
3283 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 3465 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
3466 Register input_reg = ToRegister(instr->InputAt(0)); | |
3467 Register scratch1 = scratch0(); | |
3468 Register scratch2 = ToRegister(instr->TempAt(0)); | |
3469 SwVfpRegister single_scratch = s0; | |
3470 DwVfpRegister double_scratch1 = d0; | |
3471 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->TempAt(1)); | |
3472 DwVfpRegister double_scratch3 = ToDoubleRegister(instr->TempAt(2)); | |
3473 | |
3474 ASSERT(!scratch1.is(input_reg)); | |
3475 ASSERT(!scratch2.is(input_reg)); | |
3476 ASSERT(!scratch2.is(scratch1)); | |
3477 ASSERT(!double_scratch1.is(double_scratch2)); | |
3478 ASSERT(!double_scratch1.is(double_scratch3)); | |
3479 ASSERT(!double_scratch2.is(double_scratch3)); | |
3480 | |
3284 Label done; | 3481 Label done; |
3285 Register input_reg = ToRegister(instr->InputAt(0)); | |
3286 Register scratch = scratch0(); | |
3287 DoubleRegister dbl_scratch = d0; | |
3288 SwVfpRegister flt_scratch = s0; | |
3289 DoubleRegister dbl_tmp = ToDoubleRegister(instr->TempAt(0)); | |
3290 | 3482 |
3291 // Heap number map check. | 3483 // Heap number map check. |
3292 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 3484 __ ldr(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
3293 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3485 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
3294 __ cmp(scratch, Operand(ip)); | 3486 __ cmp(scratch1, Operand(ip)); |
3295 | 3487 |
3488 CpuFeatures::Scope scope(VFP3); | |
3296 if (instr->truncating()) { | 3489 if (instr->truncating()) { |
3297 Label heap_number; | 3490 // Performs a truncating conversion of a floating point number as used by |
3491 // the JS bitwise operations. | |
3492 Label heap_number, success; | |
3298 __ b(eq, &heap_number); | 3493 __ b(eq, &heap_number); |
3299 // Check for undefined. Undefined is converted to zero for truncating | 3494 // Check for undefined. Undefined is converted to zero for truncating |
3300 // conversions. | 3495 // conversions. |
3301 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3496 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
3302 __ cmp(input_reg, Operand(ip)); | 3497 __ cmp(input_reg, Operand(ip)); |
3303 DeoptimizeIf(ne, instr->environment()); | 3498 DeoptimizeIf(ne, instr->environment()); |
3304 __ mov(input_reg, Operand(0)); | 3499 __ mov(input_reg, Operand(0)); |
3305 __ b(&done); | 3500 __ b(&done); |
3306 | 3501 |
3307 __ bind(&heap_number); | 3502 __ bind(&heap_number); |
3308 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 3503 DwVfpRegister double_value = double_scratch3; |
3309 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); | 3504 double_scratch3 = no_dreg; |
3310 __ vcmp(dbl_tmp, 0.0); // Sets overflow bit in FPSCR flags if NaN. | 3505 __ sub(scratch1, input_reg, Operand(kHeapObjectTag)); |
3311 __ vcvt_s32_f64(flt_scratch, dbl_tmp); | 3506 __ vldr(double_value, scratch1, HeapNumber::kValueOffset); |
3312 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. | 3507 |
3313 __ vmrs(pc); // Move vector status bits to normal status bits. | 3508 EmitECMATruncate(input_reg, |
3314 // Overflow bit is set if dbl_tmp is Nan. | 3509 scratch1, |
3315 __ cmn(input_reg, Operand(1), vc); // 0x7fffffff + 1 -> overflow. | 3510 scratch2, |
3316 __ cmp(input_reg, Operand(1), vc); // 0x80000000 - 1 -> overflow. | 3511 double_value, |
3317 DeoptimizeIf(vs, instr->environment()); // Saturation may have occured. | 3512 double_scratch1, |
3513 double_scratch2, | |
3514 &success); | |
3515 DeoptimizeIf(al, instr->environment()); | |
3516 __ bind(&success); | |
3318 | 3517 |
3319 } else { | 3518 } else { |
3320 // Deoptimize if we don't have a heap number. | 3519 // Deoptimize if we don't have a heap number. |
3321 DeoptimizeIf(ne, instr->environment()); | 3520 DeoptimizeIf(ne, instr->environment()); |
3322 | 3521 |
3323 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 3522 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
3324 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); | 3523 __ vldr(double_scratch1, ip, HeapNumber::kValueOffset); |
3325 __ vcvt_s32_f64(flt_scratch, dbl_tmp); | 3524 __ EmitVFPTruncate(kRoundToZero, |
3326 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. | 3525 single_scratch, |
3327 // Non-truncating conversion means that we cannot lose bits, so we convert | 3526 double_scratch1, |
3328 // back to check; note that using non-overlapping s and d regs would be | 3527 scratch1, |
3329 // slightly faster. | 3528 scratch2, |
3330 __ vcvt_f64_s32(dbl_scratch, flt_scratch); | 3529 kCheckForInexactConversion); |
3331 __ VFPCompareAndSetFlags(dbl_scratch, dbl_tmp); | 3530 DeoptimizeIf(ne, instr->environment()); |
3332 DeoptimizeIf(ne, instr->environment()); // Not equal or unordered. | 3531 // Load the result. |
3532 __ vmov(input_reg, single_scratch); | |
3533 | |
3333 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3534 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
3334 __ tst(input_reg, Operand(input_reg)); | 3535 __ cmp(input_reg, Operand(0)); |
3335 __ b(ne, &done); | 3536 __ b(ne, &done); |
3336 __ vmov(lr, ip, dbl_tmp); | 3537 __ vmov(scratch1, double_scratch1.high()); |
3337 __ tst(ip, Operand(1 << 31)); // Test sign bit. | 3538 __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
3338 DeoptimizeIf(ne, instr->environment()); | 3539 DeoptimizeIf(ne, instr->environment()); |
3339 } | 3540 } |
3340 } | 3541 } |
3341 __ bind(&done); | 3542 __ bind(&done); |
3342 } | 3543 } |
3343 | 3544 |
3344 | 3545 |
3345 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 3546 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
3346 LOperand* input = instr->InputAt(0); | 3547 LOperand* input = instr->InputAt(0); |
3347 ASSERT(input->IsRegister()); | 3548 ASSERT(input->IsRegister()); |
(...skipping 22 matching lines...) Expand all Loading... | |
3370 | 3571 |
3371 Register input_reg = ToRegister(input); | 3572 Register input_reg = ToRegister(input); |
3372 DoubleRegister result_reg = ToDoubleRegister(result); | 3573 DoubleRegister result_reg = ToDoubleRegister(result); |
3373 | 3574 |
3374 EmitNumberUntagD(input_reg, result_reg, instr->environment()); | 3575 EmitNumberUntagD(input_reg, result_reg, instr->environment()); |
3375 } | 3576 } |
3376 | 3577 |
3377 | 3578 |
3378 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 3579 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
3379 LOperand* input = instr->InputAt(0); | 3580 LOperand* input = instr->InputAt(0); |
3581 LOperand* result = instr->result(); | |
3380 ASSERT(input->IsDoubleRegister()); | 3582 ASSERT(input->IsDoubleRegister()); |
3381 LOperand* result = instr->result(); | |
3382 ASSERT(result->IsRegister()); | 3583 ASSERT(result->IsRegister()); |
3383 | 3584 |
3384 DoubleRegister double_input = ToDoubleRegister(input); | |
3385 Register result_reg = ToRegister(result); | 3585 Register result_reg = ToRegister(result); |
3386 SwVfpRegister single_scratch = double_scratch0().low(); | |
3387 Register scratch1 = scratch0(); | 3586 Register scratch1 = scratch0(); |
3388 Register scratch2 = ToRegister(instr->TempAt(0)); | 3587 Register scratch2 = ToRegister(instr->TempAt(0)); |
3588 DwVfpRegister double_input = ToDoubleRegister(input); | |
3589 DwVfpRegister double_scratch1 = double_scratch0(); | |
3590 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->TempAt(1)); | |
3591 SwVfpRegister single_scratch = double_scratch0().low(); | |
3389 | 3592 |
3390 __ EmitVFPTruncate(kRoundToZero, | 3593 Label done; |
3391 single_scratch, | 3594 |
3595 if (instr->truncating()) { | |
3596 Label success; | |
3597 EmitECMATruncate(result_reg, | |
3598 scratch1, | |
3599 scratch2, | |
3392 double_input, | 3600 double_input, |
3393 scratch1, | 3601 double_scratch1, |
3394 scratch2); | 3602 double_scratch2, |
3395 | 3603 &success); |
3396 // Deoptimize if we had a vfp invalid exception. | 3604 DeoptimizeIf(al, instr->environment()); |
3397 DeoptimizeIf(ne, instr->environment()); | 3605 __ bind(&success); |
3398 | 3606 } else { |
3399 // Retrieve the result. | 3607 VFPRoundingMode rounding_mode = kRoundToMinusInf; |
3400 __ vmov(result_reg, single_scratch); | 3608 __ EmitVFPTruncate(rounding_mode, |
3401 | 3609 single_scratch, |
3402 if (!instr->truncating()) { | 3610 double_input, |
3403 // Convert result back to double and compare with input | 3611 scratch1, |
3404 // to check if the conversion was exact. | 3612 scratch2, |
3405 __ vmov(single_scratch, result_reg); | 3613 kCheckForInexactConversion); |
3406 __ vcvt_f64_s32(double_scratch0(), single_scratch); | 3614 // Deoptimize if we had a vfp invalid exception, |
3407 __ VFPCompareAndSetFlags(double_scratch0(), double_input); | 3615 // including inexact operation. |
3408 DeoptimizeIf(ne, instr->environment()); | 3616 DeoptimizeIf(ne, instr->environment()); |
3409 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3617 // Retrieve the result. |
3410 Label done; | 3618 __ vmov(result_reg, single_scratch); |
3411 __ cmp(result_reg, Operand(0)); | |
3412 __ b(ne, &done); | |
3413 // Check for -0. | |
3414 __ vmov(scratch1, double_input.high()); | |
3415 __ tst(scratch1, Operand(HeapNumber::kSignMask)); | |
3416 DeoptimizeIf(ne, instr->environment()); | |
3417 | |
3418 __ bind(&done); | |
3419 } | |
3420 } | 3619 } |
3620 __ bind(&done); | |
3421 } | 3621 } |
3422 | 3622 |
3423 | 3623 |
3424 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { | 3624 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
3425 LOperand* input = instr->InputAt(0); | 3625 LOperand* input = instr->InputAt(0); |
3426 ASSERT(input->IsRegister()); | 3626 ASSERT(input->IsRegister()); |
3427 __ tst(ToRegister(input), Operand(kSmiTagMask)); | 3627 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
3428 DeoptimizeIf(instr->condition(), instr->environment()); | 3628 DeoptimizeIf(instr->condition(), instr->environment()); |
3429 } | 3629 } |
3430 | 3630 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3848 ASSERT(!environment->HasBeenRegistered()); | 4048 ASSERT(!environment->HasBeenRegistered()); |
3849 RegisterEnvironmentForDeoptimization(environment); | 4049 RegisterEnvironmentForDeoptimization(environment); |
3850 ASSERT(osr_pc_offset_ == -1); | 4050 ASSERT(osr_pc_offset_ == -1); |
3851 osr_pc_offset_ = masm()->pc_offset(); | 4051 osr_pc_offset_ = masm()->pc_offset(); |
3852 } | 4052 } |
3853 | 4053 |
3854 | 4054 |
3855 #undef __ | 4055 #undef __ |
3856 | 4056 |
3857 } } // namespace v8::internal | 4057 } } // namespace v8::internal |
OLD | NEW |