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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 | 601 |
602 void DoubleToIStub::Generate(MacroAssembler* masm) { | 602 void DoubleToIStub::Generate(MacroAssembler* masm) { |
603 Label out_of_range, only_low, negate, done; | 603 Label out_of_range, only_low, negate, done; |
604 Register input_reg = source(); | 604 Register input_reg = source(); |
605 Register result_reg = destination(); | 605 Register result_reg = destination(); |
606 | 606 |
607 int double_offset = offset(); | 607 int double_offset = offset(); |
608 // Account for saved regs if input is sp. | 608 // Account for saved regs if input is sp. |
609 if (input_reg.is(sp)) double_offset += 2 * kPointerSize; | 609 if (input_reg.is(sp)) double_offset += 2 * kPointerSize; |
610 | 610 |
611 // Immediate values for this stub fit in instructions, so it's safe to use ip. | 611 Register scratch = GetRegisterThatIsNotOneOf(input_reg, result_reg); |
612 Register scratch = ip; | |
613 Register scratch_low = | 612 Register scratch_low = |
614 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); | 613 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); |
615 Register scratch_high = | 614 Register scratch_high = |
616 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); | 615 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); |
617 LowDwVfpRegister double_scratch = kScratchDoubleReg; | 616 LowDwVfpRegister double_scratch = kScratchDoubleReg; |
618 | 617 |
619 __ Push(scratch_high, scratch_low); | 618 __ Push(scratch, scratch_high, scratch_low); |
rmcilroy
2014/01/14 14:50:20
Please move 'scratch' to the end of the arguments
Mostyn Bramley-Moore
2014/01/14 15:01:50
Done.
| |
620 | 619 |
621 if (!skip_fastpath()) { | 620 if (!skip_fastpath()) { |
622 // Load double input. | 621 // Load double input. |
623 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); | 622 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); |
624 __ vmov(scratch_low, scratch_high, double_scratch); | 623 __ vmov(scratch_low, scratch_high, double_scratch); |
625 | 624 |
626 // Do fast-path convert from double to int. | 625 // Do fast-path convert from double to int. |
627 __ vcvt_s32_f64(double_scratch.low(), double_scratch); | 626 __ vcvt_s32_f64(double_scratch.low(), double_scratch); |
628 __ vmov(result_reg, double_scratch.low()); | 627 __ vmov(result_reg, double_scratch.low()); |
629 | 628 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 // scratch_high LSR 31 equals zero. | 691 // scratch_high LSR 31 equals zero. |
693 // New result = (result eor 0) + 0 = result. | 692 // New result = (result eor 0) + 0 = result. |
694 // If the input was negative, we have to negate the result. | 693 // If the input was negative, we have to negate the result. |
695 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. | 694 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. |
696 // New result = (result eor 0xffffffff) + 1 = 0 - result. | 695 // New result = (result eor 0xffffffff) + 1 = 0 - result. |
697 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); | 696 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); |
698 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); | 697 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); |
699 | 698 |
700 __ bind(&done); | 699 __ bind(&done); |
701 | 700 |
702 __ Pop(scratch_high, scratch_low); | 701 __ Pop(scratch, scratch_high, scratch_low); |
703 __ Ret(); | 702 __ Ret(); |
704 } | 703 } |
705 | 704 |
706 | 705 |
707 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( | 706 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( |
708 Isolate* isolate) { | 707 Isolate* isolate) { |
709 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); | 708 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); |
710 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); | 709 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); |
711 stub1.GetCode(isolate); | 710 stub1.GetCode(isolate); |
712 stub2.GetCode(isolate); | 711 stub2.GetCode(isolate); |
(...skipping 5087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5800 __ bind(&fast_elements_case); | 5799 __ bind(&fast_elements_case); |
5801 GenerateCase(masm, FAST_ELEMENTS); | 5800 GenerateCase(masm, FAST_ELEMENTS); |
5802 } | 5801 } |
5803 | 5802 |
5804 | 5803 |
5805 #undef __ | 5804 #undef __ |
5806 | 5805 |
5807 } } // namespace v8::internal | 5806 } } // namespace v8::internal |
5808 | 5807 |
5809 #endif // V8_TARGET_ARCH_ARM | 5808 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |