| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 // Push the double argument. | 76 // Push the double argument. |
| 77 __ Subu(sp, sp, Operand(kDoubleSize)); | 77 __ Subu(sp, sp, Operand(kDoubleSize)); |
| 78 __ sdc1(f12, MemOperand(sp)); | 78 __ sdc1(f12, MemOperand(sp)); |
| 79 __ Move(source_reg, sp); | 79 __ Move(source_reg, sp); |
| 80 | 80 |
| 81 // Save registers make sure they don't get clobbered. | 81 // Save registers make sure they don't get clobbered. |
| 82 int source_reg_offset = kDoubleSize; | 82 int source_reg_offset = kDoubleSize; |
| 83 int reg_num = 2; | 83 int reg_num = 2; |
| 84 for (; reg_num < Register::kNumRegisters; ++reg_num) { | 84 for (; reg_num < Register::kNumRegisters; ++reg_num) { |
| 85 Register reg = Register::from_code(reg_num); | 85 if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( |
| 86 if (reg.IsAllocatable()) { | 86 reg_num)) { |
| 87 Register reg = Register::from_code(reg_num); |
| 87 if (!reg.is(destination_reg)) { | 88 if (!reg.is(destination_reg)) { |
| 88 __ push(reg); | 89 __ push(reg); |
| 89 source_reg_offset += kPointerSize; | 90 source_reg_offset += kPointerSize; |
| 90 } | 91 } |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Re-push the double argument. | 95 // Re-push the double argument. |
| 95 __ Subu(sp, sp, Operand(kDoubleSize)); | 96 __ Subu(sp, sp, Operand(kDoubleSize)); |
| 96 __ sdc1(f12, MemOperand(sp)); | 97 __ sdc1(f12, MemOperand(sp)); |
| 97 | 98 |
| 98 // Call through to the actual stub | 99 // Call through to the actual stub |
| 99 if (inline_fastpath) { | 100 if (inline_fastpath) { |
| 100 __ ldc1(f12, MemOperand(source_reg)); | 101 __ ldc1(f12, MemOperand(source_reg)); |
| 101 __ TryInlineTruncateDoubleToI(destination_reg, f12, &done); | 102 __ TryInlineTruncateDoubleToI(destination_reg, f12, &done); |
| 102 if (destination_reg.is(source_reg) && !source_reg.is(sp)) { | 103 if (destination_reg.is(source_reg) && !source_reg.is(sp)) { |
| 103 // Restore clobbered source_reg. | 104 // Restore clobbered source_reg. |
| 104 __ Addu(source_reg, sp, Operand(source_reg_offset)); | 105 __ Addu(source_reg, sp, Operand(source_reg_offset)); |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); | 108 __ Call(start, RelocInfo::EXTERNAL_REFERENCE); |
| 108 __ bind(&done); | 109 __ bind(&done); |
| 109 | 110 |
| 110 __ Addu(sp, sp, Operand(kDoubleSize)); | 111 __ Addu(sp, sp, Operand(kDoubleSize)); |
| 111 | 112 |
| 112 // Make sure no registers have been unexpectedly clobbered | 113 // Make sure no registers have been unexpectedly clobbered |
| 113 for (--reg_num; reg_num >= 2; --reg_num) { | 114 for (--reg_num; reg_num >= 2; --reg_num) { |
| 114 Register reg = Register::from_code(reg_num); | 115 if (RegisterConfiguration::Crankshaft()->IsAllocatableGeneralCode( |
| 115 if (reg.IsAllocatable()) { | 116 reg_num)) { |
| 117 Register reg = Register::from_code(reg_num); |
| 116 if (!reg.is(destination_reg)) { | 118 if (!reg.is(destination_reg)) { |
| 117 __ lw(at, MemOperand(sp, 0)); | 119 __ lw(at, MemOperand(sp, 0)); |
| 118 __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); | 120 __ Assert(eq, kRegisterWasClobbered, reg, Operand(at)); |
| 119 __ Addu(sp, sp, Operand(kPointerSize)); | 121 __ Addu(sp, sp, Operand(kPointerSize)); |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 | 125 |
| 124 __ Addu(sp, sp, Operand(kDoubleSize)); | 126 __ Addu(sp, sp, Operand(kDoubleSize)); |
| 125 | 127 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 false)); | 196 false)); |
| 195 RunAllTruncationTests( | 197 RunAllTruncationTests( |
| 196 RunGeneratedCodeCallWrapper, | 198 RunGeneratedCodeCallWrapper, |
| 197 MakeConvertDToIFuncTrampoline(isolate, | 199 MakeConvertDToIFuncTrampoline(isolate, |
| 198 source_registers[s], | 200 source_registers[s], |
| 199 dest_registers[d], | 201 dest_registers[d], |
| 200 true)); | 202 true)); |
| 201 } | 203 } |
| 202 } | 204 } |
| 203 } | 205 } |
| OLD | NEW |