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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // Push the double argument. | 66 // Push the double argument. |
67 __ Push(d0); | 67 __ Push(d0); |
68 __ Mov(source_reg, jssp); | 68 __ Mov(source_reg, jssp); |
69 | 69 |
70 MacroAssembler::PushPopQueue queue(&masm); | 70 MacroAssembler::PushPopQueue queue(&masm); |
71 | 71 |
72 // Save registers make sure they don't get clobbered. | 72 // Save registers make sure they don't get clobbered. |
73 int source_reg_offset = kDoubleSize; | 73 int source_reg_offset = kDoubleSize; |
74 int reg_num = 0; | 74 int reg_num = 0; |
75 for (; reg_num < Register::kNumRegisters; ++reg_num) { | 75 for (;reg_num < Register::NumAllocatableRegisters(); ++reg_num) { |
76 Register reg = Register::from_code(reg_num); | 76 Register reg = Register::from_code(reg_num); |
77 if (reg.IsAllocatable()) { | 77 if (!reg.is(destination_reg)) { |
78 if (!reg.is(destination_reg)) { | 78 queue.Queue(reg); |
79 queue.Queue(reg); | 79 source_reg_offset += kPointerSize; |
80 source_reg_offset += kPointerSize; | |
81 } | |
82 } | 80 } |
83 } | 81 } |
84 // Re-push the double argument. | 82 // Re-push the double argument. |
85 queue.Queue(d0); | 83 queue.Queue(d0); |
86 | 84 |
87 queue.PushQueued(); | 85 queue.PushQueued(); |
88 | 86 |
89 // Call through to the actual stub | 87 // Call through to the actual stub |
90 if (inline_fastpath) { | 88 if (inline_fastpath) { |
91 __ Ldr(d0, MemOperand(source_reg)); | 89 __ Ldr(d0, MemOperand(source_reg)); |
92 __ TryConvertDoubleToInt64(destination_reg, d0, &done); | 90 __ TryConvertDoubleToInt64(destination_reg, d0, &done); |
93 if (destination_reg.is(source_reg)) { | 91 if (destination_reg.is(source_reg)) { |
94 // Restore clobbered source_reg. | 92 // Restore clobbered source_reg. |
95 __ add(source_reg, jssp, Operand(source_reg_offset)); | 93 __ add(source_reg, jssp, Operand(source_reg_offset)); |
96 } | 94 } |
97 } | 95 } |
98 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); | 96 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); |
99 __ bind(&done); | 97 __ bind(&done); |
100 | 98 |
101 __ Drop(1, kDoubleSize); | 99 __ Drop(1, kDoubleSize); |
102 | 100 |
103 // // Make sure no registers have been unexpectedly clobbered | 101 // // Make sure no registers have been unexpectedly clobbered |
104 for (--reg_num; reg_num >= 0; --reg_num) { | 102 for (--reg_num; reg_num >= 0; --reg_num) { |
105 Register reg = Register::from_code(reg_num); | 103 Register reg = Register::from_code(reg_num); |
106 if (reg.IsAllocatable()) { | 104 if (!reg.is(destination_reg)) { |
107 if (!reg.is(destination_reg)) { | 105 __ Pop(ip0); |
108 __ Pop(ip0); | 106 __ cmp(reg, ip0); |
109 __ cmp(reg, ip0); | 107 __ Assert(eq, kRegisterWasClobbered); |
110 __ Assert(eq, kRegisterWasClobbered); | |
111 } | |
112 } | 108 } |
113 } | 109 } |
114 | 110 |
115 __ Drop(1, kDoubleSize); | 111 __ Drop(1, kDoubleSize); |
116 | 112 |
117 if (!destination_reg.is(x0)) | 113 if (!destination_reg.is(x0)) |
118 __ Mov(x0, destination_reg); | 114 __ Mov(x0, destination_reg); |
119 | 115 |
120 // Restore callee save registers. | 116 // Restore callee save registers. |
121 __ Mov(csp, jssp); | 117 __ Mov(csp, jssp); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 false)); | 180 false)); |
185 RunAllTruncationTests( | 181 RunAllTruncationTests( |
186 RunGeneratedCodeCallWrapper, | 182 RunGeneratedCodeCallWrapper, |
187 MakeConvertDToIFuncTrampoline(isolate, | 183 MakeConvertDToIFuncTrampoline(isolate, |
188 source_registers[s], | 184 source_registers[s], |
189 dest_registers[d], | 185 dest_registers[d], |
190 true)); | 186 true)); |
191 } | 187 } |
192 } | 188 } |
193 } | 189 } |
OLD | NEW |