| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Rrdistribution and use in source and binary forms, with or without | 2 // Rrdistribution 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 // * Rrdistributions of source code must retain the above copyright | 6 // * Rrdistributions 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 // * Rrdistributions in binary form must reproduce the above | 8 // * Rrdistributions 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Push the double argument. | 69 // Push the double argument. |
| 70 __ sub(sp, sp, Operand(kDoubleSize)); | 70 __ sub(sp, sp, Operand(kDoubleSize)); |
| 71 __ vstr(d0, sp, 0); | 71 __ vstr(d0, sp, 0); |
| 72 if (!source_reg.is(sp)) { | 72 if (!source_reg.is(sp)) { |
| 73 __ mov(source_reg, sp); | 73 __ mov(source_reg, sp); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Save registers make sure they don't get clobbered. | 76 // Save registers make sure they don't get clobbered. |
| 77 int source_reg_offset = kDoubleSize; | 77 int source_reg_offset = kDoubleSize; |
| 78 int reg_num = 0; | 78 int reg_num = 0; |
| 79 for (; reg_num < Register::NumAllocatableRegisters(); ++reg_num) { | 79 for (; reg_num < Register::kNumRegisters; ++reg_num) { |
| 80 Register reg = Register::from_code(reg_num); | 80 Register reg = Register::from_code(reg_num); |
| 81 if (!reg.is(destination_reg)) { | 81 if (reg.IsAllocatable()) { |
| 82 __ push(reg); | 82 if (!reg.is(destination_reg)) { |
| 83 source_reg_offset += kPointerSize; | 83 __ push(reg); |
| 84 source_reg_offset += kPointerSize; |
| 85 } |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 | 88 |
| 87 // Re-push the double argument. | 89 // Re-push the double argument. |
| 88 __ sub(sp, sp, Operand(kDoubleSize)); | 90 __ sub(sp, sp, Operand(kDoubleSize)); |
| 89 __ vstr(d0, sp, 0); | 91 __ vstr(d0, sp, 0); |
| 90 | 92 |
| 91 // Call through to the actual stub | 93 // Call through to the actual stub |
| 92 if (inline_fastpath) { | 94 if (inline_fastpath) { |
| 93 __ vldr(d0, MemOperand(source_reg)); | 95 __ vldr(d0, MemOperand(source_reg)); |
| 94 __ TryInlineTruncateDoubleToI(destination_reg, d0, &done); | 96 __ TryInlineTruncateDoubleToI(destination_reg, d0, &done); |
| 95 if (destination_reg.is(source_reg) && !source_reg.is(sp)) { | 97 if (destination_reg.is(source_reg) && !source_reg.is(sp)) { |
| 96 // Restore clobbered source_reg. | 98 // Restore clobbered source_reg. |
| 97 __ add(source_reg, sp, Operand(source_reg_offset)); | 99 __ add(source_reg, sp, Operand(source_reg_offset)); |
| 98 } | 100 } |
| 99 } | 101 } |
| 100 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); | 102 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); |
| 101 __ bind(&done); | 103 __ bind(&done); |
| 102 | 104 |
| 103 __ add(sp, sp, Operand(kDoubleSize)); | 105 __ add(sp, sp, Operand(kDoubleSize)); |
| 104 | 106 |
| 105 // Make sure no registers have been unexpectedly clobbered | 107 // Make sure no registers have been unexpectedly clobbered |
| 106 for (--reg_num; reg_num >= 0; --reg_num) { | 108 for (--reg_num; reg_num >= 0; --reg_num) { |
| 107 Register reg = Register::from_code(reg_num); | 109 Register reg = Register::from_code(reg_num); |
| 108 if (!reg.is(destination_reg)) { | 110 if (reg.IsAllocatable()) { |
| 109 __ ldr(ip, MemOperand(sp, 0)); | 111 if (!reg.is(destination_reg)) { |
| 110 __ cmp(reg, ip); | 112 __ ldr(ip, MemOperand(sp, 0)); |
| 111 __ Assert(eq, kRegisterWasClobbered); | 113 __ cmp(reg, ip); |
| 112 __ add(sp, sp, Operand(kPointerSize)); | 114 __ Assert(eq, kRegisterWasClobbered); |
| 115 __ add(sp, sp, Operand(kPointerSize)); |
| 116 } |
| 113 } | 117 } |
| 114 } | 118 } |
| 115 | 119 |
| 116 __ add(sp, sp, Operand(kDoubleSize)); | 120 __ add(sp, sp, Operand(kDoubleSize)); |
| 117 | 121 |
| 118 if (!destination_reg.is(r0)) | 122 if (!destination_reg.is(r0)) |
| 119 __ mov(r0, destination_reg); | 123 __ mov(r0, destination_reg); |
| 120 | 124 |
| 121 // Restore callee save registers. | 125 // Restore callee save registers. |
| 122 __ Pop(lr); | 126 __ Pop(lr); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 false)); | 179 false)); |
| 176 RunAllTruncationTests( | 180 RunAllTruncationTests( |
| 177 RunGeneratedCodeCallWrapper, | 181 RunGeneratedCodeCallWrapper, |
| 178 MakeConvertDToIFuncTrampoline(isolate, | 182 MakeConvertDToIFuncTrampoline(isolate, |
| 179 source_registers[s], | 183 source_registers[s], |
| 180 dest_registers[d], | 184 dest_registers[d], |
| 181 true)); | 185 true)); |
| 182 } | 186 } |
| 183 } | 187 } |
| 184 } | 188 } |
| OLD | NEW |