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

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

Issue 25231005: ARM: Tweak LoadKeyed. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « src/arm/lithium-arm.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 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 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 3288
3289 3289
3290 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { 3290 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
3291 Register elements = ToRegister(instr->elements()); 3291 Register elements = ToRegister(instr->elements());
3292 bool key_is_constant = instr->key()->IsConstantOperand(); 3292 bool key_is_constant = instr->key()->IsConstantOperand();
3293 Register key = no_reg; 3293 Register key = no_reg;
3294 DwVfpRegister result = ToDoubleRegister(instr->result()); 3294 DwVfpRegister result = ToDoubleRegister(instr->result());
3295 Register scratch = scratch0(); 3295 Register scratch = scratch0();
3296 3296
3297 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 3297 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
3298 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3298
3299 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3299 int base_offset =
3300 int constant_key = 0; 3300 FixedDoubleArray::kHeaderSize - kHeapObjectTag +
3301 (instr->additional_index() << element_size_shift);
3301 if (key_is_constant) { 3302 if (key_is_constant) {
3302 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 3303 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
3303 if (constant_key & 0xF0000000) { 3304 if (constant_key & 0xF0000000) {
3304 Abort(kArrayIndexConstantValueTooBig); 3305 Abort(kArrayIndexConstantValueTooBig);
3305 } 3306 }
3306 } else { 3307 base_offset += constant_key << element_size_shift;
3308 }
3309 __ add(scratch, elements, Operand(base_offset));
3310
3311 if (!key_is_constant) {
3307 key = ToRegister(instr->key()); 3312 key = ToRegister(instr->key());
3313 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3314 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3315 __ add(scratch, scratch, Operand(key, LSL, shift_size));
3308 } 3316 }
3309 3317
3310 int base_offset = (FixedDoubleArray::kHeaderSize - kHeapObjectTag) + 3318 __ vldr(result, scratch, 0);
3311 ((constant_key + instr->additional_index()) << element_size_shift); 3319
3312 if (!key_is_constant) {
3313 __ add(elements, elements, Operand(key, LSL, shift_size));
3314 }
3315 __ add(elements, elements, Operand(base_offset));
3316 __ vldr(result, elements, 0);
3317 if (instr->hydrogen()->RequiresHoleCheck()) { 3320 if (instr->hydrogen()->RequiresHoleCheck()) {
3318 __ ldr(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); 3321 __ ldr(scratch, MemOperand(scratch, sizeof(kHoleNanLower32)));
3319 __ cmp(scratch, Operand(kHoleNanUpper32)); 3322 __ cmp(scratch, Operand(kHoleNanUpper32));
3320 DeoptimizeIf(eq, instr->environment()); 3323 DeoptimizeIf(eq, instr->environment());
3321 } 3324 }
3322 } 3325 }
3323 3326
3324 3327
3325 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { 3328 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
3326 Register elements = ToRegister(instr->elements()); 3329 Register elements = ToRegister(instr->elements());
3327 Register result = ToRegister(instr->result()); 3330 Register result = ToRegister(instr->result());
3328 Register scratch = scratch0(); 3331 Register scratch = scratch0();
3329 Register store_base = scratch; 3332 Register store_base = scratch;
3330 int offset = 0; 3333 int offset = 0;
3331 3334
3332 if (instr->key()->IsConstantOperand()) { 3335 if (instr->key()->IsConstantOperand()) {
3333 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); 3336 LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
3334 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + 3337 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
3335 instr->additional_index()); 3338 instr->additional_index());
3336 store_base = elements; 3339 store_base = elements;
3337 } else { 3340 } else {
3338 Register key = EmitLoadRegister(instr->key(), scratch0()); 3341 Register key = ToRegister(instr->key());
3339 // Even though the HLoadKeyed instruction forces the input 3342 // Even though the HLoadKeyed instruction forces the input
3340 // representation for the key to be an integer, the input gets replaced 3343 // representation for the key to be an integer, the input gets replaced
3341 // during bound check elimination with the index argument to the bounds 3344 // during bound check elimination with the index argument to the bounds
3342 // check, which can be tagged, so that case must be handled here, too. 3345 // check, which can be tagged, so that case must be handled here, too.
3343 if (instr->hydrogen()->key()->representation().IsSmi()) { 3346 if (instr->hydrogen()->key()->representation().IsSmi()) {
3344 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key)); 3347 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key));
3345 } else { 3348 } else {
3346 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); 3349 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
3347 } 3350 }
3348 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); 3351 offset = FixedArray::OffsetOfElementAt(instr->additional_index());
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5860 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5858 __ ldr(result, FieldMemOperand(scratch, 5861 __ ldr(result, FieldMemOperand(scratch,
5859 FixedArray::kHeaderSize - kPointerSize)); 5862 FixedArray::kHeaderSize - kPointerSize));
5860 __ bind(&done); 5863 __ bind(&done);
5861 } 5864 }
5862 5865
5863 5866
5864 #undef __ 5867 #undef __
5865 5868
5866 } } // namespace v8::internal 5869 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698