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

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

Issue 23537053: MIPS: Tweak StoreKeyed. (Closed) Base URL: https://github.com/v8/v8.git@gbl
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
« no previous file with comments | « no previous file | src/mips/lithium-mips.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 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 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 } else { 4225 } else {
4226 key = ToRegister(instr->key()); 4226 key = ToRegister(instr->key());
4227 } 4227 }
4228 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4228 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4229 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4229 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4230 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4230 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4231 int additional_offset = instr->additional_index() << element_size_shift; 4231 int additional_offset = instr->additional_index() << element_size_shift;
4232 4232
4233 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4233 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
4234 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 4234 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
4235 Register address = scratch0();
4235 FPURegister value(ToDoubleRegister(instr->value())); 4236 FPURegister value(ToDoubleRegister(instr->value()));
4236 if (key_is_constant) { 4237 if (key_is_constant) {
4237 __ Addu(scratch0(), external_pointer, constant_key << 4238 if (constant_key != 0) {
4238 element_size_shift); 4239 __ Addu(address, external_pointer,
4240 Operand(constant_key << element_size_shift));
4241 } else {
4242 address = external_pointer;
4243 }
4239 } else { 4244 } else {
4240 __ sll(scratch0(), key, shift_size); 4245 __ sll(address, key, shift_size);
4241 __ Addu(scratch0(), scratch0(), external_pointer); 4246 __ Addu(address, external_pointer, address);
4242 } 4247 }
4243 4248
4244 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { 4249 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
4245 __ cvt_s_d(double_scratch0(), value); 4250 __ cvt_s_d(double_scratch0(), value);
4246 __ swc1(double_scratch0(), MemOperand(scratch0(), additional_offset)); 4251 __ swc1(double_scratch0(), MemOperand(address, additional_offset));
4247 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 4252 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
4248 __ sdc1(value, MemOperand(scratch0(), additional_offset)); 4253 __ sdc1(value, MemOperand(address, additional_offset));
4249 } 4254 }
4250 } else { 4255 } else {
4251 Register value(ToRegister(instr->value())); 4256 Register value(ToRegister(instr->value()));
4252 MemOperand mem_operand = PrepareKeyedOperand( 4257 MemOperand mem_operand = PrepareKeyedOperand(
4253 key, external_pointer, key_is_constant, constant_key, 4258 key, external_pointer, key_is_constant, constant_key,
4254 element_size_shift, shift_size, 4259 element_size_shift, shift_size,
4255 instr->additional_index(), additional_offset); 4260 instr->additional_index(), additional_offset);
4256 switch (elements_kind) { 4261 switch (elements_kind) {
4257 case EXTERNAL_PIXEL_ELEMENTS: 4262 case EXTERNAL_PIXEL_ELEMENTS:
4258 case EXTERNAL_BYTE_ELEMENTS: 4263 case EXTERNAL_BYTE_ELEMENTS:
(...skipping 21 matching lines...) Expand all
4280 UNREACHABLE(); 4285 UNREACHABLE();
4281 break; 4286 break;
4282 } 4287 }
4283 } 4288 }
4284 } 4289 }
4285 4290
4286 4291
4287 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { 4292 void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
4288 DoubleRegister value = ToDoubleRegister(instr->value()); 4293 DoubleRegister value = ToDoubleRegister(instr->value());
4289 Register elements = ToRegister(instr->elements()); 4294 Register elements = ToRegister(instr->elements());
4290 Register key = no_reg;
4291 Register scratch = scratch0(); 4295 Register scratch = scratch0();
4296 DoubleRegister double_scratch = double_scratch0();
4292 bool key_is_constant = instr->key()->IsConstantOperand(); 4297 bool key_is_constant = instr->key()->IsConstantOperand();
4293 int constant_key = 0; 4298 Label not_nan, done;
4294 Label not_nan;
4295 4299
4296 // Calculate the effective address of the slot in the array to store the 4300 // Calculate the effective address of the slot in the array to store the
4297 // double value. 4301 // double value.
4302 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS);
4298 if (key_is_constant) { 4303 if (key_is_constant) {
4299 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); 4304 int constant_key = ToInteger32(LConstantOperand::cast(instr->key()));
4300 if (constant_key & 0xF0000000) { 4305 if (constant_key & 0xF0000000) {
4301 Abort(kArrayIndexConstantValueTooBig); 4306 Abort(kArrayIndexConstantValueTooBig);
4302 } 4307 }
4308 __ Addu(scratch, elements,
4309 Operand((constant_key << element_size_shift) +
4310 FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4303 } else { 4311 } else {
4304 key = ToRegister(instr->key()); 4312 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4305 } 4313 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4306 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); 4314 __ Addu(scratch, elements,
4307 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4308 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4309 if (key_is_constant) {
4310 __ Addu(scratch, elements, Operand((constant_key << element_size_shift) +
4311 FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4312 } else {
4313 __ sll(scratch, key, shift_size);
4314 __ Addu(scratch, elements, Operand(scratch));
4315 __ Addu(scratch, scratch,
4316 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4315 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4316 __ sll(at, ToRegister(instr->key()), shift_size);
4317 __ Addu(scratch, scratch, at);
4317 } 4318 }
4318 4319
4319 if (instr->NeedsCanonicalization()) { 4320 if (instr->NeedsCanonicalization()) {
4320 Label is_nan; 4321 Label is_nan;
4321 // Check for NaN. All NaNs must be canonicalized. 4322 // Check for NaN. All NaNs must be canonicalized.
4322 __ BranchF(NULL, &is_nan, eq, value, value); 4323 __ BranchF(NULL, &is_nan, eq, value, value);
4323 __ Branch(&not_nan); 4324 __ Branch(&not_nan);
4324 4325
4325 // Only load canonical NaN if the comparison above set the overflow. 4326 // Only load canonical NaN if the comparison above set the overflow.
4326 __ bind(&is_nan); 4327 __ bind(&is_nan);
4327 __ Move(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double()); 4328 __ Move(double_scratch,
4329 FixedDoubleArray::canonical_not_the_hole_nan_as_double());
4330 __ sdc1(double_scratch, MemOperand(scratch, instr->additional_index() <<
4331 element_size_shift));
4332 __ Branch(&done);
4328 } 4333 }
4329 4334
4330 __ bind(&not_nan); 4335 __ bind(&not_nan);
4331 __ sdc1(value, MemOperand(scratch, instr->additional_index() << 4336 __ sdc1(value, MemOperand(scratch, instr->additional_index() <<
4332 element_size_shift)); 4337 element_size_shift));
4338 __ bind(&done);
4333 } 4339 }
4334 4340
4335 4341
4336 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { 4342 void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) {
4337 Register value = ToRegister(instr->value()); 4343 Register value = ToRegister(instr->value());
4338 Register elements = ToRegister(instr->elements()); 4344 Register elements = ToRegister(instr->elements());
4339 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) 4345 Register key = instr->key()->IsRegister() ? ToRegister(instr->key())
4340 : no_reg; 4346 : no_reg;
4341 Register scratch = scratch0(); 4347 Register scratch = scratch0();
4342 Register store_base = scratch; 4348 Register store_base = scratch;
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
5768 __ Subu(scratch, result, scratch); 5774 __ Subu(scratch, result, scratch);
5769 __ lw(result, FieldMemOperand(scratch, 5775 __ lw(result, FieldMemOperand(scratch,
5770 FixedArray::kHeaderSize - kPointerSize)); 5776 FixedArray::kHeaderSize - kPointerSize));
5771 __ bind(&done); 5777 __ bind(&done);
5772 } 5778 }
5773 5779
5774 5780
5775 #undef __ 5781 #undef __
5776 5782
5777 } } // namespace v8::internal 5783 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698