Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: src/x87/macro-assembler-x87.cc

Issue 578583002: Fixed deopt reasons in TaggedToI. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed feedback Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 void MacroAssembler::TruncateHeapNumberToI(Register result_reg, 248 void MacroAssembler::TruncateHeapNumberToI(Register result_reg,
249 Register input_reg) { 249 Register input_reg) {
250 Label done, slow_case; 250 Label done, slow_case;
251 251
252 SlowTruncateToI(result_reg, input_reg); 252 SlowTruncateToI(result_reg, input_reg);
253 bind(&done); 253 bind(&done);
254 } 254 }
255 255
256 256
257 void MacroAssembler::TaggedToI(Register result_reg,
258 Register input_reg,
259 MinusZeroMode minus_zero_mode,
260 Label* lost_precision) {
261 Label done;
262
263 cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
264 isolate()->factory()->heap_number_map());
265 j(not_equal, lost_precision, Label::kNear);
266
267 // TODO(olivf) Converting a number on the fpu is actually quite slow. We
268 // should first try a fast conversion and then bailout to this slow case.
269 Label lost_precision_pop, zero_check;
270 Label* lost_precision_int = (minus_zero_mode == FAIL_ON_MINUS_ZERO)
271 ? &lost_precision_pop : lost_precision;
272 sub(esp, Immediate(kPointerSize));
273 fld_d(FieldOperand(input_reg, HeapNumber::kValueOffset));
274 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) fld(0);
275 fist_s(MemOperand(esp, 0));
276 fild_s(MemOperand(esp, 0));
277 FCmp();
278 pop(result_reg);
279 j(not_equal, lost_precision_int, Label::kNear);
280 j(parity_even, lost_precision_int, Label::kNear); // NaN.
281 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) {
282 test(result_reg, Operand(result_reg));
283 j(zero, &zero_check, Label::kNear);
284 fstp(0);
285 jmp(&done, Label::kNear);
286 bind(&zero_check);
287 // To check for minus zero, we load the value again as float, and check
288 // if that is still 0.
289 sub(esp, Immediate(kPointerSize));
290 fstp_s(Operand(esp, 0));
291 pop(result_reg);
292 test(result_reg, Operand(result_reg));
293 j(zero, &done, Label::kNear);
294 jmp(lost_precision, Label::kNear);
295
296 bind(&lost_precision_pop);
297 fstp(0);
298 jmp(lost_precision, Label::kNear);
299 }
300 bind(&done);
301 }
302
303
304 void MacroAssembler::LoadUint32NoSSE2(Register src) { 257 void MacroAssembler::LoadUint32NoSSE2(Register src) {
305 Label done; 258 Label done;
306 push(src); 259 push(src);
307 fild_s(Operand(esp, 0)); 260 fild_s(Operand(esp, 0));
308 cmp(src, Immediate(0)); 261 cmp(src, Immediate(0));
309 j(not_sign, &done, Label::kNear); 262 j(not_sign, &done, Label::kNear);
310 ExternalReference uint32_bias = 263 ExternalReference uint32_bias =
311 ExternalReference::address_of_uint32_bias(); 264 ExternalReference::address_of_uint32_bias();
312 fld_d(Operand::StaticVariable(uint32_bias)); 265 fld_d(Operand::StaticVariable(uint32_bias));
313 faddp(1); 266 faddp(1);
(...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 if (mag.shift > 0) sar(edx, mag.shift); 3268 if (mag.shift > 0) sar(edx, mag.shift);
3316 mov(eax, dividend); 3269 mov(eax, dividend);
3317 shr(eax, 31); 3270 shr(eax, 31);
3318 add(edx, eax); 3271 add(edx, eax);
3319 } 3272 }
3320 3273
3321 3274
3322 } } // namespace v8::internal 3275 } } // namespace v8::internal
3323 3276
3324 #endif // V8_TARGET_ARCH_X87 3277 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698