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

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

Issue 23600054: ARM: Tweak StoreKeyed. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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') | src/arm/macro-assembler-arm.h » ('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 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 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 } else { 4324 } else {
4325 key = ToRegister(instr->key()); 4325 key = ToRegister(instr->key());
4326 } 4326 }
4327 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4327 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4328 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4328 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4329 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4329 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4330 int additional_offset = instr->additional_index() << element_size_shift; 4330 int additional_offset = instr->additional_index() << element_size_shift;
4331 4331
4332 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4332 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
4333 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 4333 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
4334 Register address = scratch0();
4334 DwVfpRegister value(ToDoubleRegister(instr->value())); 4335 DwVfpRegister value(ToDoubleRegister(instr->value()));
4335 Operand operand(key_is_constant 4336 if (key_is_constant) {
4336 ? Operand(constant_key << element_size_shift) 4337 if (constant_key != 0) {
4337 : Operand(key, LSL, shift_size)); 4338 __ add(address, external_pointer,
4338 __ add(scratch0(), external_pointer, operand); 4339 Operand(constant_key << element_size_shift));
4340 } else {
4341 address = external_pointer;
4342 }
4343 } else {
4344 __ add(address, external_pointer, Operand(key, LSL, shift_size));
4345 }
4339 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { 4346 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
4340 __ vcvt_f32_f64(double_scratch0().low(), value); 4347 __ vcvt_f32_f64(double_scratch0().low(), value);
4341 __ vstr(double_scratch0().low(), scratch0(), additional_offset); 4348 __ vstr(double_scratch0().low(), address, additional_offset);
4342 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 4349 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
4343 __ vstr(value, scratch0(), additional_offset); 4350 __ vstr(value, address, additional_offset);
4344 } 4351 }
4345 } else { 4352 } else {
4346 Register value(ToRegister(instr->value())); 4353 Register value(ToRegister(instr->value()));
4347 MemOperand mem_operand = PrepareKeyedOperand( 4354 MemOperand mem_operand = PrepareKeyedOperand(
4348 key, external_pointer, key_is_constant, constant_key, 4355 key, external_pointer, key_is_constant, constant_key,
4349 element_size_shift, shift_size, 4356 element_size_shift, shift_size,
4350 instr->additional_index(), additional_offset); 4357 instr->additional_index(), additional_offset);
4351 switch (elements_kind) { 4358 switch (elements_kind) {
4352 case EXTERNAL_PIXEL_ELEMENTS: 4359 case EXTERNAL_PIXEL_ELEMENTS:
4353 case EXTERNAL_BYTE_ELEMENTS: 4360 case EXTERNAL_BYTE_ELEMENTS:
(...skipping 21 matching lines...) Expand all
4375 UNREACHABLE(); 4382 UNREACHABLE();
4376 break; 4383 break;
4377 } 4384 }
4378 } 4385 }
4379 } 4386 }
4380 4387
4381 4388
4382 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { 4389 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4383 DwVfpRegister value = ToDoubleRegister(instr->value()); 4390 DwVfpRegister value = ToDoubleRegister(instr->value());
4384 Register elements = ToRegister(instr->elements()); 4391 Register elements = ToRegister(instr->elements());
4385 Register key = no_reg;
4386 Register scratch = scratch0(); 4392 Register scratch = scratch0();
4393 DwVfpRegister double_scratch = double_scratch0();
4387 bool key_is_constant = instr->key()->IsConstantOperand(); 4394 bool key_is_constant = instr->key()->IsConstantOperand();
4388 int constant_key = 0;
4389 4395
4390 // Calculate the effective address of the slot in the array to store the 4396 // Calculate the effective address of the slot in the array to store the
4391 // double value. 4397 // double value.
4398 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
4392 if (key_is_constant) { 4399 if (key_is_constant) {
4393 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4400 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4394 if (constant_key & 0xF0000000) { 4401 if (constant_key & 0xF0000000) {
4395 Abort(kArrayIndexConstantValueTooBig); 4402 Abort(kArrayIndexConstantValueTooBig);
4396 } 4403 }
4404 __ add(scratch, elements,
4405 Operand((constant_key << element_size_shift) +
4406 FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4397 } else { 4407 } else {
4398 key = ToRegister(instr->key()); 4408 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4399 } 4409 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4400 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 4410 __ add(scratch, elements,
4401 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4411 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4402 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4403 Operand operand = key_is_constant
4404 ? Operand((constant_key << element_size_shift) +
4405 FixedDoubleArray::kHeaderSize - kHeapObjectTag)
4406 : Operand(key, LSL, shift_size);
4407 __ add(scratch, elements, operand);
4408 if (!key_is_constant) {
4409 __ add(scratch, scratch, 4412 __ add(scratch, scratch,
4410 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4413 Operand(ToRegister(instr->key()), LSL, shift_size));
4411 } 4414 }
4412 4415
4413 if (instr->NeedsCanonicalization()) { 4416 if (instr->NeedsCanonicalization()) {
4414 // Force a canonical NaN. 4417 // Force a canonical NaN.
4415 if (masm()->emit_debug_code()) { 4418 if (masm()->emit_debug_code()) {
4416 __ vmrs(ip); 4419 __ vmrs(ip);
4417 __ tst(ip, Operand(kVFPDefaultNaNModeControlBit)); 4420 __ tst(ip, Operand(kVFPDefaultNaNModeControlBit));
4418 __ Assert(ne, kDefaultNaNModeNotSet); 4421 __ Assert(ne, kDefaultNaNModeNotSet);
4419 } 4422 }
4420 __ VFPCanonicalizeNaN(value); 4423 __ VFPCanonicalizeNaN(double_scratch, value);
4424 __ vstr(double_scratch, scratch,
4425 instr->additional_index() << element_size_shift);
4426 } else {
4427 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4421 } 4428 }
4422 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4423 } 4429 }
4424 4430
4425 4431
4426 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { 4432 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4427 Register value = ToRegister(instr->value()); 4433 Register value = ToRegister(instr->value());
4428 Register elements = ToRegister(instr->elements()); 4434 Register elements = ToRegister(instr->elements());
4429 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) 4435 Register key = instr->key()->IsRegister() ? ToRegister(instr->key())
4430 : no_reg; 4436 : no_reg;
4431 Register scratch = scratch0(); 4437 Register scratch = scratch0();
4432 Register store_base = scratch; 4438 Register store_base = scratch;
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
5797 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5803 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5798 __ ldr(result, FieldMemOperand(scratch, 5804 __ ldr(result, FieldMemOperand(scratch,
5799 FixedArray::kHeaderSize - kPointerSize)); 5805 FixedArray::kHeaderSize - kPointerSize));
5800 __ bind(&done); 5806 __ bind(&done);
5801 } 5807 }
5802 5808
5803 5809
5804 #undef __ 5810 #undef __
5805 5811
5806 } } // namespace v8::internal 5812 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698