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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/arm/lithium-codegen-arm.cc ('k') | src/version.cc » ('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 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 XMMRegister xmm_scratch = xmm0; 2763 XMMRegister xmm_scratch = xmm0;
2764 Register output_reg = ToRegister(instr->result()); 2764 Register output_reg = ToRegister(instr->result());
2765 XMMRegister input_reg = ToDoubleRegister(instr->value()); 2765 XMMRegister input_reg = ToDoubleRegister(instr->value());
2766 2766
2767 Label below_half, done; 2767 Label below_half, done;
2768 // xmm_scratch = 0.5 2768 // xmm_scratch = 0.5
2769 ExternalReference one_half = ExternalReference::address_of_one_half(); 2769 ExternalReference one_half = ExternalReference::address_of_one_half();
2770 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half)); 2770 __ movdbl(xmm_scratch, Operand::StaticVariable(one_half));
2771 __ ucomisd(xmm_scratch, input_reg); 2771 __ ucomisd(xmm_scratch, input_reg);
2772 __ j(above, &below_half); 2772 __ j(above, &below_half);
2773 // input = input + 0.5 2773 // xmm_scratch = input + 0.5
2774 __ addsd(input_reg, xmm_scratch); 2774 __ addsd(xmm_scratch, input_reg);
2775 2775
2776 // Compute Math.floor(value + 0.5). 2776 // Compute Math.floor(value + 0.5).
2777 // Use truncating instruction (OK because input is positive). 2777 // Use truncating instruction (OK because input is positive).
2778 __ cvttsd2si(output_reg, Operand(input_reg)); 2778 __ cvttsd2si(output_reg, Operand(xmm_scratch));
2779 2779
2780 // Overflow is signalled with minint. 2780 // Overflow is signalled with minint.
2781 __ cmp(output_reg, 0x80000000u); 2781 __ cmp(output_reg, 0x80000000u);
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 2786
2787 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if 2787 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if
2788 // we can ignore the difference between a result of -0 and +0. 2788 // we can ignore the difference between a result of -0 and +0.
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 env->deoptimization_index()); 4378 env->deoptimization_index());
4379 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4379 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4380 } 4380 }
4381 4381
4382 4382
4383 #undef __ 4383 #undef __
4384 4384
4385 } } // namespace v8::internal 4385 } } // namespace v8::internal
4386 4386
4387 #endif // V8_TARGET_ARCH_IA32 4387 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698