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

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

Issue 6478027: Implement specialized IC code stubs for pixel array stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 9 years, 10 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/code-stubs-ia32.cc ('k') | src/ia32/stub-cache-ia32.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // Slow case: call runtime. 802 // Slow case: call runtime.
803 __ bind(&slow); 803 __ bind(&slow);
804 GenerateRuntimeSetProperty(masm); 804 GenerateRuntimeSetProperty(masm);
805 805
806 // Check whether the elements is a pixel array. 806 // Check whether the elements is a pixel array.
807 __ bind(&check_pixel_array); 807 __ bind(&check_pixel_array);
808 // eax: value 808 // eax: value
809 // ecx: key (a smi) 809 // ecx: key (a smi)
810 // edx: receiver 810 // edx: receiver
811 // edi: elements array 811 // edi: elements array
812 __ CheckMap(edi, Factory::pixel_array_map(), &slow, true); 812 GenerateFastPixelArrayStore(masm,
813 // Check that the value is a smi. If a conversion is needed call into the 813 edx,
814 // runtime to convert and clamp. 814 ecx,
815 __ test(eax, Immediate(kSmiTagMask)); 815 eax,
816 __ j(not_zero, &slow); 816 edi,
817 __ mov(ebx, ecx); 817 ebx,
818 __ SmiUntag(ebx); 818 false,
819 __ cmp(ebx, FieldOperand(edi, PixelArray::kLengthOffset)); 819 NULL,
820 __ j(above_equal, &slow); 820 &slow,
821 __ mov(ecx, eax); // Save the value. Key is not longer needed. 821 &slow,
822 __ SmiUntag(ecx); 822 &slow);
823 { // Clamp the value to [0..255].
824 Label done;
825 __ test(ecx, Immediate(0xFFFFFF00));
826 __ j(zero, &done);
827 __ setcc(negative, ecx); // 1 if negative, 0 if positive.
828 __ dec_b(ecx); // 0 if negative, 255 if positive.
829 __ bind(&done);
830 }
831 __ mov(edi, FieldOperand(edi, PixelArray::kExternalPointerOffset));
832 __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
833 __ ret(0); // Return value in eax.
834 823
835 // Extra capacity case: Check if there is extra capacity to 824 // Extra capacity case: Check if there is extra capacity to
836 // perform the store and update the length. Used for adding one 825 // perform the store and update the length. Used for adding one
837 // element to the array by writing to array[array.length]. 826 // element to the array by writing to array[array.length].
838 __ bind(&extra); 827 __ bind(&extra);
839 // eax: value 828 // eax: value
840 // edx: receiver, a JSArray 829 // edx: receiver, a JSArray
841 // ecx: key, a smi. 830 // ecx: key, a smi.
842 // edi: receiver->elements, a FixedArray 831 // edi: receiver->elements, a FixedArray
843 // flags: compare (ecx, edx.length()) 832 // flags: compare (ecx, edx.length())
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 Condition cc = *jmp_address == Assembler::kJncShortOpcode 1770 Condition cc = *jmp_address == Assembler::kJncShortOpcode
1782 ? not_zero 1771 ? not_zero
1783 : zero; 1772 : zero;
1784 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1773 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1785 } 1774 }
1786 1775
1787 1776
1788 } } // namespace v8::internal 1777 } } // namespace v8::internal
1789 1778
1790 #endif // V8_TARGET_ARCH_IA32 1779 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698