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

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