OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 if (input->IsRegister()) { | 1107 if (input->IsRegister()) { |
1108 Register input_reg = i.InputRegister(0); | 1108 Register input_reg = i.InputRegister(0); |
1109 __ push(input_reg); | 1109 __ push(input_reg); |
1110 __ fild_s(Operand(esp, 0)); | 1110 __ fild_s(Operand(esp, 0)); |
1111 __ pop(input_reg); | 1111 __ pop(input_reg); |
1112 } else { | 1112 } else { |
1113 __ fild_s(i.InputOperand(0)); | 1113 __ fild_s(i.InputOperand(0)); |
1114 } | 1114 } |
1115 break; | 1115 break; |
1116 } | 1116 } |
| 1117 case kX87Uint32ToFloat32: { |
| 1118 InstructionOperand* input = instr->InputAt(0); |
| 1119 DCHECK(input->IsRegister() || input->IsStackSlot()); |
| 1120 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
| 1121 __ VerifyX87StackDepth(1); |
| 1122 } |
| 1123 __ fstp(0); |
| 1124 Label msb_set_src; |
| 1125 Label jmp_return; |
| 1126 // Put input integer into eax(tmporarilly) |
| 1127 __ push(eax); |
| 1128 if (input->IsRegister()) |
| 1129 __ mov(eax, i.InputRegister(0)); |
| 1130 else |
| 1131 __ mov(eax, i.InputOperand(0)); |
| 1132 |
| 1133 __ test(eax, eax); |
| 1134 __ j(sign, &msb_set_src, Label::kNear); |
| 1135 __ push(eax); |
| 1136 __ fild_s(Operand(esp, 0)); |
| 1137 __ pop(eax); |
| 1138 |
| 1139 __ jmp(&jmp_return, Label::kNear); |
| 1140 __ bind(&msb_set_src); |
| 1141 // Need another temp reg |
| 1142 __ push(ebx); |
| 1143 __ mov(ebx, eax); |
| 1144 __ shr(eax, 1); |
| 1145 // Recover the least significant bit to avoid rounding errors. |
| 1146 __ and_(ebx, Immediate(1)); |
| 1147 __ or_(eax, ebx); |
| 1148 __ push(eax); |
| 1149 __ fild_s(Operand(esp, 0)); |
| 1150 __ pop(eax); |
| 1151 __ fld(0); |
| 1152 __ faddp(); |
| 1153 // Restore the ebx |
| 1154 __ pop(ebx); |
| 1155 __ bind(&jmp_return); |
| 1156 // Restore the eax |
| 1157 __ pop(eax); |
| 1158 break; |
| 1159 } |
1117 case kX87Int32ToFloat64: { | 1160 case kX87Int32ToFloat64: { |
1118 InstructionOperand* input = instr->InputAt(0); | 1161 InstructionOperand* input = instr->InputAt(0); |
1119 DCHECK(input->IsRegister() || input->IsStackSlot()); | 1162 DCHECK(input->IsRegister() || input->IsStackSlot()); |
1120 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 1163 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
1121 __ VerifyX87StackDepth(1); | 1164 __ VerifyX87StackDepth(1); |
1122 } | 1165 } |
1123 __ fstp(0); | 1166 __ fstp(0); |
1124 if (input->IsRegister()) { | 1167 if (input->IsRegister()) { |
1125 Register input_reg = i.InputRegister(0); | 1168 Register input_reg = i.InputRegister(0); |
1126 __ push(input_reg); | 1169 __ push(input_reg); |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 void CodeGenerator::EnsureSpaceForLazyDeopt() { | 2224 void CodeGenerator::EnsureSpaceForLazyDeopt() { |
2182 is_handler_entry_point = true; | 2225 is_handler_entry_point = true; |
2183 DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_); | 2226 DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_); |
2184 } | 2227 } |
2185 | 2228 |
2186 #undef __ | 2229 #undef __ |
2187 | 2230 |
2188 } // namespace compiler | 2231 } // namespace compiler |
2189 } // namespace internal | 2232 } // namespace internal |
2190 } // namespace v8 | 2233 } // namespace v8 |
OLD | NEW |