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

Side by Side Diff: src/arm/code-stubs-arm.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/arm/code-stubs-arm.h ('k') | src/arm/ic-arm.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 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 6021
6022 // Perform the indexed load and tag the result as a smi. 6022 // Perform the indexed load and tag the result as a smi.
6023 __ ldr(scratch1, 6023 __ ldr(scratch1,
6024 FieldMemOperand(elements, PixelArray::kExternalPointerOffset)); 6024 FieldMemOperand(elements, PixelArray::kExternalPointerOffset));
6025 __ ldrb(scratch1, MemOperand(scratch1, scratch2)); 6025 __ ldrb(scratch1, MemOperand(scratch1, scratch2));
6026 __ SmiTag(r0, scratch1); 6026 __ SmiTag(r0, scratch1);
6027 __ Ret(); 6027 __ Ret();
6028 } 6028 }
6029 6029
6030 6030
6031 void GenerateFastPixelArrayStore(MacroAssembler* masm,
6032 Register receiver,
6033 Register key,
6034 Register value,
6035 Register elements,
6036 Register elements_map,
6037 Register scratch1,
6038 Register scratch2,
6039 bool load_elements_from_receiver,
6040 bool load_elements_map_from_elements,
6041 Label* key_not_smi,
6042 Label* value_not_smi,
6043 Label* not_pixel_array,
6044 Label* out_of_range) {
6045 // Register use:
6046 // receiver - holds the receiver and is unchanged unless the
6047 // store succeeds.
6048 // key - holds the key (must be a smi) and is unchanged.
6049 // value - holds the value (must be a smi) and is unchanged.
6050 // elements - holds the element object of the receiver on entry if
6051 // load_elements_from_receiver is false, otherwise used
6052 // internally to store the pixel arrays elements and
6053 // external array pointer.
6054 // elements_map - holds the map of the element object if
6055 // load_elements_map_from_elements is false, otherwise
6056 // loaded with the element map.
6057 //
6058 Register external_pointer = elements;
6059 Register untagged_key = scratch1;
6060 Register untagged_value = scratch2;
6061
6062 if (load_elements_from_receiver) {
6063 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
6064 }
6065
6066 // By passing NULL as not_pixel_array, callers signal that they have already
6067 // verified that the receiver has pixel array elements.
6068 if (not_pixel_array != NULL) {
6069 if (load_elements_map_from_elements) {
6070 __ ldr(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
6071 }
6072 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex);
6073 __ cmp(elements_map, ip);
6074 __ b(ne, not_pixel_array);
6075 } else {
6076 if (FLAG_debug_code) {
6077 // Map check should have already made sure that elements is a pixel array.
6078 __ ldr(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
6079 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex);
6080 __ cmp(elements_map, ip);
6081 __ Assert(eq, "Elements isn't a pixel array");
6082 }
6083 }
6084
6085 // Some callers already have verified that the key is a smi. key_not_smi is
6086 // set to NULL as a sentinel for that case. Otherwise, add an explicit check
6087 // to ensure the key is a smi must be added.
6088 if (key_not_smi != NULL) {
6089 __ JumpIfNotSmi(key, key_not_smi);
6090 } else {
6091 if (FLAG_debug_code) {
6092 __ AbortIfNotSmi(key);
6093 }
6094 }
6095
6096 __ SmiUntag(untagged_key, key);
6097
6098 // Perform bounds check.
6099 __ ldr(scratch2, FieldMemOperand(elements, PixelArray::kLengthOffset));
6100 __ cmp(untagged_key, scratch2);
6101 __ b(hs, out_of_range); // unsigned check handles negative keys.
6102
6103 __ JumpIfNotSmi(value, value_not_smi);
6104 __ SmiUntag(untagged_value, value);
6105
6106 // Clamp the value to [0..255].
6107 __ Usat(untagged_value, 8, Operand(untagged_value));
6108 // Get the pointer to the external array. This clobbers elements.
6109 __ ldr(external_pointer,
6110 FieldMemOperand(elements, PixelArray::kExternalPointerOffset));
6111 __ strb(untagged_value, MemOperand(external_pointer, untagged_key));
6112 __ Ret();
6113 }
6114
6115
6031 #undef __ 6116 #undef __
6032 6117
6033 } } // namespace v8::internal 6118 } } // namespace v8::internal
6034 6119
6035 #endif // V8_TARGET_ARCH_ARM 6120 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698