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

Side by Side Diff: src/x64/ic-x64.cc

Issue 246076: Change clamping 0..255 instruction sequence for pixel array code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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
« src/ia32/ic-ia32.cc ('K') | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 __ JumpIfNotSmi(rax, &slow); 484 __ JumpIfNotSmi(rax, &slow);
485 __ SmiToInteger32(rbx, rbx); 485 __ SmiToInteger32(rbx, rbx);
486 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); 486 __ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset));
487 __ j(above_equal, &slow); 487 __ j(above_equal, &slow);
488 __ movq(rdx, rax); // Save the value. 488 __ movq(rdx, rax); // Save the value.
489 __ SmiToInteger32(rax, rax); 489 __ SmiToInteger32(rax, rax);
490 { // Clamp the value to [0..255]. 490 { // Clamp the value to [0..255].
491 Label done, is_negative; 491 Label done, is_negative;
492 __ testl(rax, Immediate(0xFFFFFF00)); 492 __ testl(rax, Immediate(0xFFFFFF00));
493 __ j(zero, &done); 493 __ j(zero, &done);
494 __ j(negative, &is_negative); 494 __ setcc(negative, rax); // 1 if negative, 0 if positive.
495 __ movl(rax, Immediate(255)); 495 __ decb(rax); // 0 if negative, 255 if positive.
496 __ jmp(&done);
497 __ bind(&is_negative);
498 __ xorl(rax, rax); // Clear rax.
499 __ bind(&done); 496 __ bind(&done);
500 } 497 }
501 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); 498 __ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset));
502 __ movb(Operand(rcx, rbx, times_1, 0), rax); 499 __ movb(Operand(rcx, rbx, times_1, 0), rax);
503 __ movq(rax, rdx); // Return the original value. 500 __ movq(rax, rdx); // Return the original value.
504 __ ret(0); 501 __ ret(0);
505 502
506 // Extra capacity case: Check if there is extra capacity to 503 // Extra capacity case: Check if there is extra capacity to
507 // perform the store and update the length. Used for adding one 504 // perform the store and update the length. Used for adding one
508 // element to the array by writing to array[array.length]. 505 // element to the array by writing to array[array.length].
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 1009
1013 // Cache miss: Jump to runtime. 1010 // Cache miss: Jump to runtime.
1014 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); 1011 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss)));
1015 } 1012 }
1016 1013
1017 1014
1018 #undef __ 1015 #undef __
1019 1016
1020 1017
1021 } } // namespace v8::internal 1018 } } // namespace v8::internal
OLDNEW
« src/ia32/ic-ia32.cc ('K') | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698