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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 8833007: Fix a bug with register use in optimized Math.round. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years 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/mips/lithium-codegen-mips.cc ('k') | test/mjsunit/compiler/regress-106351.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution 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 // * Redistributions of source code must retain the above copyright 6 // * Redistributions 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 // * Redistributions in binary form must reproduce the above 8 // * Redistributions 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 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); 2785 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE);
2786 __ movq(xmm_scratch, kScratchRegister); 2786 __ movq(xmm_scratch, kScratchRegister);
2787 Label below_half; 2787 Label below_half;
2788 __ ucomisd(xmm_scratch, input_reg); 2788 __ ucomisd(xmm_scratch, input_reg);
2789 // If input_reg is NaN, this doesn't jump. 2789 // If input_reg is NaN, this doesn't jump.
2790 __ j(above, &below_half, Label::kNear); 2790 __ j(above, &below_half, Label::kNear);
2791 // input = input + 0.5 2791 // input = input + 0.5
2792 // This addition might give a result that isn't the correct for 2792 // This addition might give a result that isn't the correct for
2793 // rounding, due to loss of precision, but only for a number that's 2793 // rounding, due to loss of precision, but only for a number that's
2794 // so big that the conversion below will overflow anyway. 2794 // so big that the conversion below will overflow anyway.
2795 __ addsd(input_reg, xmm_scratch); 2795 __ addsd(xmm_scratch, input_reg);
2796 // Compute Math.floor(input). 2796 // Compute Math.floor(input).
2797 // Use truncating instruction (OK because input is positive). 2797 // Use truncating instruction (OK because input is positive).
2798 __ cvttsd2si(output_reg, input_reg); 2798 __ cvttsd2si(output_reg, xmm_scratch);
2799 // Overflow is signalled with minint. 2799 // Overflow is signalled with minint.
2800 __ cmpl(output_reg, Immediate(0x80000000)); 2800 __ cmpl(output_reg, Immediate(0x80000000));
2801 DeoptimizeIf(equal, instr->environment()); 2801 DeoptimizeIf(equal, instr->environment());
2802 __ jmp(&done); 2802 __ jmp(&done);
2803 2803
2804 __ bind(&below_half); 2804 __ bind(&below_half);
2805 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 2805 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2806 // Bailout if negative (including -0). 2806 // Bailout if negative (including -0).
2807 __ movq(output_reg, input_reg); 2807 __ movq(output_reg, input_reg);
2808 __ testq(output_reg, output_reg); 2808 __ testq(output_reg, output_reg);
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
4308 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4308 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4309 ASSERT(osr_pc_offset_ == -1); 4309 ASSERT(osr_pc_offset_ == -1);
4310 osr_pc_offset_ = masm()->pc_offset(); 4310 osr_pc_offset_ = masm()->pc_offset();
4311 } 4311 }
4312 4312
4313 #undef __ 4313 #undef __
4314 4314
4315 } } // namespace v8::internal 4315 } } // namespace v8::internal
4316 4316
4317 #endif // V8_TARGET_ARCH_X64 4317 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | test/mjsunit/compiler/regress-106351.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698