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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6546036: Combine typed and pixel arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: feedback, propagate external array type Created 9 years, 9 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
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 1130 }
1131 1131
1132 1132
1133 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { 1133 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
1134 Register result = ToRegister(instr->result()); 1134 Register result = ToRegister(instr->result());
1135 Register array = ToRegister(instr->InputAt(0)); 1135 Register array = ToRegister(instr->InputAt(0));
1136 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset)); 1136 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset));
1137 } 1137 }
1138 1138
1139 1139
1140 void LCodeGen::DoPixelArrayLength(LPixelArrayLength* instr) { 1140 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) {
1141 Register result = ToRegister(instr->result()); 1141 Register result = ToRegister(instr->result());
1142 Register array = ToRegister(instr->InputAt(0)); 1142 Register array = ToRegister(instr->InputAt(0));
1143 __ ldr(result, FieldMemOperand(array, PixelArray::kLengthOffset)); 1143 __ ldr(result, FieldMemOperand(array, ExternalArray::kLengthOffset));
1144 } 1144 }
1145 1145
1146 1146
1147 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { 1147 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
1148 Register result = ToRegister(instr->result()); 1148 Register result = ToRegister(instr->result());
1149 Register array = ToRegister(instr->InputAt(0)); 1149 Register array = ToRegister(instr->InputAt(0));
1150 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); 1150 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset));
1151 } 1151 }
1152 1152
1153 1153
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 Register input = ToRegister(instr->InputAt(0)); 2200 Register input = ToRegister(instr->InputAt(0));
2201 Register scratch = scratch0(); 2201 Register scratch = scratch0();
2202 2202
2203 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); 2203 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset));
2204 if (FLAG_debug_code) { 2204 if (FLAG_debug_code) {
2205 Label done; 2205 Label done;
2206 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); 2206 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset));
2207 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 2207 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
2208 __ cmp(scratch, ip); 2208 __ cmp(scratch, ip);
2209 __ b(eq, &done); 2209 __ b(eq, &done);
2210 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex); 2210 __ LoadRoot(ip, Heap::kExternalPixelArrayMapRootIndex);
2211 __ cmp(scratch, ip); 2211 __ cmp(scratch, ip);
2212 __ b(eq, &done); 2212 __ b(eq, &done);
2213 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); 2213 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex);
2214 __ cmp(scratch, ip); 2214 __ cmp(scratch, ip);
2215 __ Check(eq, "Check for fast elements failed."); 2215 __ Check(eq, "Check for fast elements failed.");
2216 __ bind(&done); 2216 __ bind(&done);
2217 } 2217 }
2218 } 2218 }
2219 2219
2220 2220
2221 void LCodeGen::DoLoadPixelArrayExternalPointer( 2221 void LCodeGen::DoLoadExternalArrayPointer(
2222 LLoadPixelArrayExternalPointer* instr) { 2222 LLoadExternalArrayPointer* instr) {
2223 Register to_reg = ToRegister(instr->result()); 2223 Register to_reg = ToRegister(instr->result());
2224 Register from_reg = ToRegister(instr->InputAt(0)); 2224 Register from_reg = ToRegister(instr->InputAt(0));
2225 __ ldr(to_reg, FieldMemOperand(from_reg, PixelArray::kExternalPointerOffset)); 2225 __ ldr(to_reg, FieldMemOperand(from_reg,
2226 ExternalArray::kExternalPointerOffset));
2226 } 2227 }
2227 2228
2228 2229
2229 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 2230 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
2230 Register arguments = ToRegister(instr->arguments()); 2231 Register arguments = ToRegister(instr->arguments());
2231 Register length = ToRegister(instr->length()); 2232 Register length = ToRegister(instr->length());
2232 Register index = ToRegister(instr->index()); 2233 Register index = ToRegister(instr->index());
2233 Register result = ToRegister(instr->result()); 2234 Register result = ToRegister(instr->result());
2234 2235
2235 // Bailout index is not a valid argument index. Use unsigned check to get 2236 // Bailout index is not a valid argument index. Use unsigned check to get
(...skipping 20 matching lines...) Expand all
2256 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); 2257 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
2257 2258
2258 // Check for the hole value. 2259 // Check for the hole value.
2259 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); 2260 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
2260 __ cmp(result, scratch); 2261 __ cmp(result, scratch);
2261 DeoptimizeIf(eq, instr->environment()); 2262 DeoptimizeIf(eq, instr->environment());
2262 } 2263 }
2263 2264
2264 2265
2265 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { 2266 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) {
2266 Register external_elements = ToRegister(instr->external_pointer()); 2267 Register external_pointer = ToRegister(instr->external_pointer());
2267 Register key = ToRegister(instr->key()); 2268 Register key = ToRegister(instr->key());
2268 Register result = ToRegister(instr->result()); 2269 Register result = ToRegister(instr->result());
2269 2270
2270 // Load the result. 2271 // Load the result.
2271 __ ldrb(result, MemOperand(external_elements, key)); 2272 __ ldrb(result, MemOperand(external_pointer, key));
2272 } 2273 }
2273 2274
2274 2275
2275 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { 2276 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
2276 ASSERT(ToRegister(instr->object()).is(r1)); 2277 ASSERT(ToRegister(instr->object()).is(r1));
2277 ASSERT(ToRegister(instr->key()).is(r0)); 2278 ASSERT(ToRegister(instr->key()).is(r0));
2278 2279
2279 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 2280 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
2280 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2281 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2281 } 2282 }
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 } 2895 }
2895 2896
2896 if (instr->hydrogen()->NeedsWriteBarrier()) { 2897 if (instr->hydrogen()->NeedsWriteBarrier()) {
2897 // Compute address of modified element and store it into key register. 2898 // Compute address of modified element and store it into key register.
2898 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); 2899 __ add(key, scratch, Operand(FixedArray::kHeaderSize));
2899 __ RecordWrite(elements, key, value); 2900 __ RecordWrite(elements, key, value);
2900 } 2901 }
2901 } 2902 }
2902 2903
2903 2904
2905 void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) {
2906 Register external_pointer = ToRegister(instr->external_pointer());
2907 Register key = ToRegister(instr->key());
2908 Register value = ToRegister(instr->value());
2909
2910 // Clamp the value to [0..255].
2911 __ Usat(value, 8, Operand(value));
2912 __ strb(value, MemOperand(external_pointer, key, LSL, 0));
2913 }
2914
2915
2904 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 2916 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
2905 ASSERT(ToRegister(instr->object()).is(r2)); 2917 ASSERT(ToRegister(instr->object()).is(r2));
2906 ASSERT(ToRegister(instr->key()).is(r1)); 2918 ASSERT(ToRegister(instr->key()).is(r1));
2907 ASSERT(ToRegister(instr->value()).is(r0)); 2919 ASSERT(ToRegister(instr->value()).is(r0));
2908 2920
2909 Handle<Code> ic(Builtins::builtin( 2921 Handle<Code> ic(Builtins::builtin(
2910 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict 2922 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict
2911 : Builtins::KeyedStoreIC_Initialize)); 2923 : Builtins::KeyedStoreIC_Initialize));
2912 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2924 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2913 } 2925 }
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
3833 ASSERT(!environment->HasBeenRegistered()); 3845 ASSERT(!environment->HasBeenRegistered());
3834 RegisterEnvironmentForDeoptimization(environment); 3846 RegisterEnvironmentForDeoptimization(environment);
3835 ASSERT(osr_pc_offset_ == -1); 3847 ASSERT(osr_pc_offset_ == -1);
3836 osr_pc_offset_ = masm()->pc_offset(); 3848 osr_pc_offset_ = masm()->pc_offset();
3837 } 3849 }
3838 3850
3839 3851
3840 #undef __ 3852 #undef __
3841 3853
3842 } } // namespace v8::internal 3854 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698