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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 10831409: Fix rounding in Uint8ClampedArray setter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix manual rounding Created 8 years, 4 months 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 | « no previous file | src/ia32/assembler-ia32.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 // Double value is >= 255, return 255. 3677 // Double value is >= 255, return 255.
3678 bind(&above_zero); 3678 bind(&above_zero);
3679 Vmov(temp_double_reg, 255.0); 3679 Vmov(temp_double_reg, 255.0);
3680 VFPCompareAndSetFlags(input_reg, temp_double_reg); 3680 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3681 b(le, &in_bounds); 3681 b(le, &in_bounds);
3682 mov(result_reg, Operand(255)); 3682 mov(result_reg, Operand(255));
3683 b(al, &done); 3683 b(al, &done);
3684 3684
3685 // In 0-255 range, round and truncate. 3685 // In 0-255 range, round and truncate.
3686 bind(&in_bounds); 3686 bind(&in_bounds);
3687 Vmov(temp_double_reg, 0.5); 3687 // Save FPSCR.
3688 vadd(temp_double_reg, input_reg, temp_double_reg); 3688 vmrs(ip);
3689 vcvt_u32_f64(temp_double_reg.low(), temp_double_reg); 3689 // Set rounding mode to round to the nearest integer by clearing bits[23:22].
3690 vmov(result_reg, temp_double_reg.low()); 3690 bic(result_reg, ip, Operand(kVFPRoundingModeMask));
3691 vmsr(result_reg);
3692 vcvt_s32_f64(input_reg.low(), input_reg, kFPSCRRounding);
3693 vmov(result_reg, input_reg.low());
3694 // Restore FPSCR.
3695 vmsr(ip);
3691 bind(&done); 3696 bind(&done);
3692 } 3697 }
3693 3698
3694 3699
3695 void MacroAssembler::LoadInstanceDescriptors(Register map, 3700 void MacroAssembler::LoadInstanceDescriptors(Register map,
3696 Register descriptors, 3701 Register descriptors,
3697 Register scratch) { 3702 Register scratch) {
3698 Register temp = descriptors; 3703 Register temp = descriptors;
3699 ldr(temp, FieldMemOperand(map, Map::kTransitionsOrBackPointerOffset)); 3704 ldr(temp, FieldMemOperand(map, Map::kTransitionsOrBackPointerOffset));
3700 3705
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 void CodePatcher::EmitCondition(Condition cond) { 3829 void CodePatcher::EmitCondition(Condition cond) {
3825 Instr instr = Assembler::instr_at(masm_.pc_); 3830 Instr instr = Assembler::instr_at(masm_.pc_);
3826 instr = (instr & ~kCondMask) | cond; 3831 instr = (instr & ~kCondMask) | cond;
3827 masm_.emit(instr); 3832 masm_.emit(instr);
3828 } 3833 }
3829 3834
3830 3835
3831 } } // namespace v8::internal 3836 } } // namespace v8::internal
3832 3837
3833 #endif // V8_TARGET_ARCH_ARM 3838 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698