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

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

Issue 8833010: Merge r10190 to 3.6 branch: Fix a bug with register use in optimized Math.round. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.6/
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/version.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 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE); 2766 __ movq(kScratchRegister, V8_INT64_C(0x3FE0000000000000), RelocInfo::NONE);
2767 __ movq(xmm_scratch, kScratchRegister); 2767 __ movq(xmm_scratch, kScratchRegister);
2768 Label below_half; 2768 Label below_half;
2769 __ ucomisd(xmm_scratch, input_reg); 2769 __ ucomisd(xmm_scratch, input_reg);
2770 // If input_reg is NaN, this doesn't jump. 2770 // If input_reg is NaN, this doesn't jump.
2771 __ j(above, &below_half, Label::kNear); 2771 __ j(above, &below_half, Label::kNear);
2772 // input = input + 0.5 2772 // input = input + 0.5
2773 // This addition might give a result that isn't the correct for 2773 // This addition might give a result that isn't the correct for
2774 // rounding, due to loss of precision, but only for a number that's 2774 // rounding, due to loss of precision, but only for a number that's
2775 // so big that the conversion below will overflow anyway. 2775 // so big that the conversion below will overflow anyway.
2776 __ addsd(input_reg, xmm_scratch); 2776 __ addsd(xmm_scratch, input_reg);
2777 // Compute Math.floor(input). 2777 // Compute Math.floor(input).
2778 // Use truncating instruction (OK because input is positive). 2778 // Use truncating instruction (OK because input is positive).
2779 __ cvttsd2si(output_reg, input_reg); 2779 __ cvttsd2si(output_reg, xmm_scratch);
2780 // Overflow is signalled with minint. 2780 // Overflow is signalled with minint.
2781 __ cmpl(output_reg, Immediate(0x80000000)); 2781 __ cmpl(output_reg, Immediate(0x80000000));
2782 DeoptimizeIf(equal, instr->environment()); 2782 DeoptimizeIf(equal, instr->environment());
2783 __ jmp(&done); 2783 __ jmp(&done);
2784 2784
2785 __ bind(&below_half); 2785 __ bind(&below_half);
2786 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 2786 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2787 // Bailout if negative (including -0). 2787 // Bailout if negative (including -0).
2788 __ movq(output_reg, input_reg); 2788 __ movq(output_reg, input_reg);
2789 __ testq(output_reg, output_reg); 2789 __ testq(output_reg, output_reg);
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
4148 RegisterEnvironmentForDeoptimization(environment); 4148 RegisterEnvironmentForDeoptimization(environment);
4149 ASSERT(osr_pc_offset_ == -1); 4149 ASSERT(osr_pc_offset_ == -1);
4150 osr_pc_offset_ = masm()->pc_offset(); 4150 osr_pc_offset_ = masm()->pc_offset();
4151 } 4151 }
4152 4152
4153 #undef __ 4153 #undef __
4154 4154
4155 } } // namespace v8::internal 4155 } } // namespace v8::internal
4156 4156
4157 #endif // V8_TARGET_ARCH_X64 4157 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | test/mjsunit/compiler/regress-106351.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698