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

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

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 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 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3206 key = ToRegister(instr->key()); 3206 key = ToRegister(instr->key());
3207 } 3207 }
3208 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3208 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3209 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3209 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3210 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3210 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3211 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind) 3211 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind)
3212 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag 3212 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
3213 : 0; 3213 : 0;
3214 3214
3215 3215
3216 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3216 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
3217 elements_kind == FLOAT32_ELEMENTS || 3217 elements_kind == FLOAT32_ELEMENTS ||
3218 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || 3218 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3219 elements_kind == FLOAT64_ELEMENTS) { 3219 elements_kind == FLOAT64_ELEMENTS) {
3220 int base_offset = 3220 int base_offset =
3221 (instr->additional_index() << element_size_shift) + additional_offset; 3221 (instr->additional_index() << element_size_shift) + additional_offset;
3222 DwVfpRegister result = ToDoubleRegister(instr->result()); 3222 DwVfpRegister result = ToDoubleRegister(instr->result());
3223 Operand operand = key_is_constant 3223 Operand operand = key_is_constant
3224 ? Operand(constant_key << element_size_shift) 3224 ? Operand(constant_key << element_size_shift)
3225 : Operand(key, LSL, shift_size); 3225 : Operand(key, LSL, shift_size);
3226 __ add(scratch0(), external_pointer, operand); 3226 __ add(scratch0(), external_pointer, operand);
3227 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3227 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
3228 elements_kind == FLOAT32_ELEMENTS) { 3228 elements_kind == FLOAT32_ELEMENTS) {
3229 __ vldr(double_scratch0().low(), scratch0(), base_offset); 3229 __ vldr(double_scratch0().low(), scratch0(), base_offset);
3230 __ vcvt_f64_f32(result, double_scratch0().low()); 3230 __ vcvt_f64_f32(result, double_scratch0().low());
3231 } else { // loading doubles, not floats. 3231 } else { // loading doubles, not floats.
3232 __ vldr(result, scratch0(), base_offset); 3232 __ vldr(result, scratch0(), base_offset);
3233 } 3233 }
3234 } else { 3234 } else {
3235 Register result = ToRegister(instr->result()); 3235 Register result = ToRegister(instr->result());
3236 MemOperand mem_operand = PrepareKeyedOperand( 3236 MemOperand mem_operand = PrepareKeyedOperand(
3237 key, external_pointer, key_is_constant, constant_key, 3237 key, external_pointer, key_is_constant, constant_key,
3238 element_size_shift, shift_size, 3238 element_size_shift, shift_size,
3239 instr->additional_index(), additional_offset); 3239 instr->additional_index(), additional_offset);
3240 switch (elements_kind) { 3240 switch (elements_kind) {
3241 case EXTERNAL_BYTE_ELEMENTS: 3241 case EXTERNAL_INT8_ELEMENTS:
3242 case INT8_ELEMENTS: 3242 case INT8_ELEMENTS:
3243 __ ldrsb(result, mem_operand); 3243 __ ldrsb(result, mem_operand);
3244 break; 3244 break;
3245 case EXTERNAL_PIXEL_ELEMENTS: 3245 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3246 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3246 case EXTERNAL_UINT8_ELEMENTS:
3247 case UINT8_ELEMENTS: 3247 case UINT8_ELEMENTS:
3248 case UINT8_CLAMPED_ELEMENTS: 3248 case UINT8_CLAMPED_ELEMENTS:
3249 __ ldrb(result, mem_operand); 3249 __ ldrb(result, mem_operand);
3250 break; 3250 break;
3251 case EXTERNAL_SHORT_ELEMENTS: 3251 case EXTERNAL_INT16_ELEMENTS:
3252 case INT16_ELEMENTS: 3252 case INT16_ELEMENTS:
3253 __ ldrsh(result, mem_operand); 3253 __ ldrsh(result, mem_operand);
3254 break; 3254 break;
3255 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3255 case EXTERNAL_UINT16_ELEMENTS:
3256 case UINT16_ELEMENTS: 3256 case UINT16_ELEMENTS:
3257 __ ldrh(result, mem_operand); 3257 __ ldrh(result, mem_operand);
3258 break; 3258 break;
3259 case EXTERNAL_INT_ELEMENTS: 3259 case EXTERNAL_INT32_ELEMENTS:
3260 case INT32_ELEMENTS: 3260 case INT32_ELEMENTS:
3261 __ ldr(result, mem_operand); 3261 __ ldr(result, mem_operand);
3262 break; 3262 break;
3263 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3263 case EXTERNAL_UINT32_ELEMENTS:
3264 case UINT32_ELEMENTS: 3264 case UINT32_ELEMENTS:
3265 __ ldr(result, mem_operand); 3265 __ ldr(result, mem_operand);
3266 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3266 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3267 __ cmp(result, Operand(0x80000000)); 3267 __ cmp(result, Operand(0x80000000));
3268 DeoptimizeIf(cs, instr->environment()); 3268 DeoptimizeIf(cs, instr->environment());
3269 } 3269 }
3270 break; 3270 break;
3271 case FLOAT32_ELEMENTS: 3271 case FLOAT32_ELEMENTS:
3272 case FLOAT64_ELEMENTS: 3272 case FLOAT64_ELEMENTS:
3273 case EXTERNAL_FLOAT_ELEMENTS: 3273 case EXTERNAL_FLOAT32_ELEMENTS:
3274 case EXTERNAL_DOUBLE_ELEMENTS: 3274 case EXTERNAL_FLOAT64_ELEMENTS:
3275 case FAST_HOLEY_DOUBLE_ELEMENTS: 3275 case FAST_HOLEY_DOUBLE_ELEMENTS:
3276 case FAST_HOLEY_ELEMENTS: 3276 case FAST_HOLEY_ELEMENTS:
3277 case FAST_HOLEY_SMI_ELEMENTS: 3277 case FAST_HOLEY_SMI_ELEMENTS:
3278 case FAST_DOUBLE_ELEMENTS: 3278 case FAST_DOUBLE_ELEMENTS:
3279 case FAST_ELEMENTS: 3279 case FAST_ELEMENTS:
3280 case FAST_SMI_ELEMENTS: 3280 case FAST_SMI_ELEMENTS:
3281 case DICTIONARY_ELEMENTS: 3281 case DICTIONARY_ELEMENTS:
3282 case NON_STRICT_ARGUMENTS_ELEMENTS: 3282 case NON_STRICT_ARGUMENTS_ELEMENTS:
3283 UNREACHABLE(); 3283 UNREACHABLE();
3284 break; 3284 break;
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4268 } else { 4268 } else {
4269 key = ToRegister(instr->key()); 4269 key = ToRegister(instr->key());
4270 } 4270 }
4271 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4271 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4272 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4272 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4273 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4273 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4274 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind) 4274 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind)
4275 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag 4275 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
4276 : 0; 4276 : 0;
4277 4277
4278 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4278 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4279 elements_kind == FLOAT32_ELEMENTS || 4279 elements_kind == FLOAT32_ELEMENTS ||
4280 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || 4280 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4281 elements_kind == FLOAT64_ELEMENTS) { 4281 elements_kind == FLOAT64_ELEMENTS) {
4282 int base_offset = 4282 int base_offset =
4283 (instr->additional_index() << element_size_shift) + additional_offset; 4283 (instr->additional_index() << element_size_shift) + additional_offset;
4284 Register address = scratch0(); 4284 Register address = scratch0();
4285 DwVfpRegister value(ToDoubleRegister(instr->value())); 4285 DwVfpRegister value(ToDoubleRegister(instr->value()));
4286 if (key_is_constant) { 4286 if (key_is_constant) {
4287 if (constant_key != 0) { 4287 if (constant_key != 0) {
4288 __ add(address, external_pointer, 4288 __ add(address, external_pointer,
4289 Operand(constant_key << element_size_shift)); 4289 Operand(constant_key << element_size_shift));
4290 } else { 4290 } else {
4291 address = external_pointer; 4291 address = external_pointer;
4292 } 4292 }
4293 } else { 4293 } else {
4294 __ add(address, external_pointer, Operand(key, LSL, shift_size)); 4294 __ add(address, external_pointer, Operand(key, LSL, shift_size));
4295 } 4295 }
4296 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4296 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4297 elements_kind == FLOAT32_ELEMENTS) { 4297 elements_kind == FLOAT32_ELEMENTS) {
4298 __ vcvt_f32_f64(double_scratch0().low(), value); 4298 __ vcvt_f32_f64(double_scratch0().low(), value);
4299 __ vstr(double_scratch0().low(), address, base_offset); 4299 __ vstr(double_scratch0().low(), address, base_offset);
4300 } else { // Storing doubles, not floats. 4300 } else { // Storing doubles, not floats.
4301 __ vstr(value, address, base_offset); 4301 __ vstr(value, address, base_offset);
4302 } 4302 }
4303 } else { 4303 } else {
4304 Register value(ToRegister(instr->value())); 4304 Register value(ToRegister(instr->value()));
4305 MemOperand mem_operand = PrepareKeyedOperand( 4305 MemOperand mem_operand = PrepareKeyedOperand(
4306 key, external_pointer, key_is_constant, constant_key, 4306 key, external_pointer, key_is_constant, constant_key,
4307 element_size_shift, shift_size, 4307 element_size_shift, shift_size,
4308 instr->additional_index(), additional_offset); 4308 instr->additional_index(), additional_offset);
4309 switch (elements_kind) { 4309 switch (elements_kind) {
4310 case EXTERNAL_PIXEL_ELEMENTS: 4310 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4311 case EXTERNAL_BYTE_ELEMENTS: 4311 case EXTERNAL_INT8_ELEMENTS:
4312 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 4312 case EXTERNAL_UINT8_ELEMENTS:
4313 case UINT8_ELEMENTS: 4313 case UINT8_ELEMENTS:
4314 case UINT8_CLAMPED_ELEMENTS: 4314 case UINT8_CLAMPED_ELEMENTS:
4315 case INT8_ELEMENTS: 4315 case INT8_ELEMENTS:
4316 __ strb(value, mem_operand); 4316 __ strb(value, mem_operand);
4317 break; 4317 break;
4318 case EXTERNAL_SHORT_ELEMENTS: 4318 case EXTERNAL_INT16_ELEMENTS:
4319 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 4319 case EXTERNAL_UINT16_ELEMENTS:
4320 case INT16_ELEMENTS: 4320 case INT16_ELEMENTS:
4321 case UINT16_ELEMENTS: 4321 case UINT16_ELEMENTS:
4322 __ strh(value, mem_operand); 4322 __ strh(value, mem_operand);
4323 break; 4323 break;
4324 case EXTERNAL_INT_ELEMENTS: 4324 case EXTERNAL_INT32_ELEMENTS:
4325 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 4325 case EXTERNAL_UINT32_ELEMENTS:
4326 case INT32_ELEMENTS: 4326 case INT32_ELEMENTS:
4327 case UINT32_ELEMENTS: 4327 case UINT32_ELEMENTS:
4328 __ str(value, mem_operand); 4328 __ str(value, mem_operand);
4329 break; 4329 break;
4330 case FLOAT32_ELEMENTS: 4330 case FLOAT32_ELEMENTS:
4331 case FLOAT64_ELEMENTS: 4331 case FLOAT64_ELEMENTS:
4332 case EXTERNAL_FLOAT_ELEMENTS: 4332 case EXTERNAL_FLOAT32_ELEMENTS:
4333 case EXTERNAL_DOUBLE_ELEMENTS: 4333 case EXTERNAL_FLOAT64_ELEMENTS:
4334 case FAST_DOUBLE_ELEMENTS: 4334 case FAST_DOUBLE_ELEMENTS:
4335 case FAST_ELEMENTS: 4335 case FAST_ELEMENTS:
4336 case FAST_SMI_ELEMENTS: 4336 case FAST_SMI_ELEMENTS:
4337 case FAST_HOLEY_DOUBLE_ELEMENTS: 4337 case FAST_HOLEY_DOUBLE_ELEMENTS:
4338 case FAST_HOLEY_ELEMENTS: 4338 case FAST_HOLEY_ELEMENTS:
4339 case FAST_HOLEY_SMI_ELEMENTS: 4339 case FAST_HOLEY_SMI_ELEMENTS:
4340 case DICTIONARY_ELEMENTS: 4340 case DICTIONARY_ELEMENTS:
4341 case NON_STRICT_ARGUMENTS_ELEMENTS: 4341 case NON_STRICT_ARGUMENTS_ELEMENTS:
4342 UNREACHABLE(); 4342 UNREACHABLE();
4343 break; 4343 break;
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
5825 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5825 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5826 __ ldr(result, FieldMemOperand(scratch, 5826 __ ldr(result, FieldMemOperand(scratch,
5827 FixedArray::kHeaderSize - kPointerSize)); 5827 FixedArray::kHeaderSize - kPointerSize));
5828 __ bind(&done); 5828 __ bind(&done);
5829 } 5829 }
5830 5830
5831 5831
5832 #undef __ 5832 #undef __
5833 5833
5834 } } // namespace v8::internal 5834 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/arm/lithium-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698