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

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

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