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

Side by Side Diff: src/ia32/macro-assembler-ia32.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 | « src/ia32/disasm-ia32.cc ('k') | src/objects.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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, 128 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg,
129 XMMRegister scratch_reg, 129 XMMRegister scratch_reg,
130 Register result_reg) { 130 Register result_reg) {
131 Label done; 131 Label done;
132 ExternalReference zero_ref = ExternalReference::address_of_zero(); 132 ExternalReference zero_ref = ExternalReference::address_of_zero();
133 movdbl(scratch_reg, Operand::StaticVariable(zero_ref)); 133 movdbl(scratch_reg, Operand::StaticVariable(zero_ref));
134 Set(result_reg, Immediate(0)); 134 Set(result_reg, Immediate(0));
135 ucomisd(input_reg, scratch_reg); 135 ucomisd(input_reg, scratch_reg);
136 j(below, &done, Label::kNear); 136 j(below, &done, Label::kNear);
137 ExternalReference half_ref = ExternalReference::address_of_one_half(); 137 cvtsd2si(result_reg, input_reg);
138 movdbl(scratch_reg, Operand::StaticVariable(half_ref));
139 addsd(scratch_reg, input_reg);
140 cvttsd2si(result_reg, Operand(scratch_reg));
141 test(result_reg, Immediate(0xFFFFFF00)); 138 test(result_reg, Immediate(0xFFFFFF00));
142 j(zero, &done, Label::kNear); 139 j(zero, &done, Label::kNear);
143 Set(result_reg, Immediate(255)); 140 Set(result_reg, Immediate(255));
144 bind(&done); 141 bind(&done);
145 } 142 }
146 143
147 144
148 void MacroAssembler::ClampUint8(Register reg) { 145 void MacroAssembler::ClampUint8(Register reg) {
149 Label done; 146 Label done;
150 test(reg, Immediate(0xFFFFFF00)); 147 test(reg, Immediate(0xFFFFFF00));
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 // Load the prototype from the map and loop if non-null. 2921 // Load the prototype from the map and loop if non-null.
2925 bind(&check_prototype); 2922 bind(&check_prototype);
2926 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2923 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2927 cmp(ecx, isolate()->factory()->null_value()); 2924 cmp(ecx, isolate()->factory()->null_value());
2928 j(not_equal, &next); 2925 j(not_equal, &next);
2929 } 2926 }
2930 2927
2931 } } // namespace v8::internal 2928 } } // namespace v8::internal
2932 2929
2933 #endif // V8_TARGET_ARCH_IA32 2930 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698