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

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 11412120: MIPS: Support all fast elements kinds in the major array operations. Currently missing support for … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 3373 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
3374 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 3374 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
3375 lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset)); 3375 lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset));
3376 Branch(fail, hi, scratch, 3376 Branch(fail, hi, scratch,
3377 Operand(Map::kMaximumBitField2FastHoleySmiElementValue)); 3377 Operand(Map::kMaximumBitField2FastHoleySmiElementValue));
3378 } 3378 }
3379 3379
3380 3380
3381 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, 3381 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg,
3382 Register key_reg, 3382 Register key_reg,
3383 Register receiver_reg,
3384 Register elements_reg, 3383 Register elements_reg,
3385 Register scratch1, 3384 Register scratch1,
3386 Register scratch2, 3385 Register scratch2,
3387 Register scratch3, 3386 Register scratch3,
3388 Register scratch4, 3387 Register scratch4,
3389 Label* fail) { 3388 Label* fail,
3389 int elements_offset) {
3390 Label smi_value, maybe_nan, have_double_value, is_nan, done; 3390 Label smi_value, maybe_nan, have_double_value, is_nan, done;
3391 Register mantissa_reg = scratch2; 3391 Register mantissa_reg = scratch2;
3392 Register exponent_reg = scratch3; 3392 Register exponent_reg = scratch3;
3393 3393
3394 // Handle smi values specially. 3394 // Handle smi values specially.
3395 JumpIfSmi(value_reg, &smi_value); 3395 JumpIfSmi(value_reg, &smi_value);
3396 3396
3397 // Ensure that the object is a heap number 3397 // Ensure that the object is a heap number
3398 CheckMap(value_reg, 3398 CheckMap(value_reg,
3399 scratch1, 3399 scratch1,
3400 Heap::kHeapNumberMapRootIndex, 3400 Heap::kHeapNumberMapRootIndex,
3401 fail, 3401 fail,
3402 DONT_DO_SMI_CHECK); 3402 DONT_DO_SMI_CHECK);
3403 3403
3404 // Check for nan: all NaN values have a value greater (signed) than 0x7ff00000 3404 // Check for nan: all NaN values have a value greater (signed) than 0x7ff00000
3405 // in the exponent. 3405 // in the exponent.
3406 li(scratch1, Operand(kNaNOrInfinityLowerBoundUpper32)); 3406 li(scratch1, Operand(kNaNOrInfinityLowerBoundUpper32));
3407 lw(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset)); 3407 lw(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset));
3408 Branch(&maybe_nan, ge, exponent_reg, Operand(scratch1)); 3408 Branch(&maybe_nan, ge, exponent_reg, Operand(scratch1));
3409 3409
3410 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); 3410 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset));
3411 3411
3412 bind(&have_double_value); 3412 bind(&have_double_value);
3413 sll(scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize); 3413 sll(scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize);
3414 Addu(scratch1, scratch1, elements_reg); 3414 Addu(scratch1, scratch1, elements_reg);
3415 sw(mantissa_reg, FieldMemOperand(scratch1, FixedDoubleArray::kHeaderSize)); 3415 sw(mantissa_reg, FieldMemOperand(
3416 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); 3416 scratch1, FixedDoubleArray::kHeaderSize - elements_offset));
3417 uint32_t offset = FixedDoubleArray::kHeaderSize - elements_offset +
3418 sizeof(kHoleNanLower32);
3417 sw(exponent_reg, FieldMemOperand(scratch1, offset)); 3419 sw(exponent_reg, FieldMemOperand(scratch1, offset));
3418 jmp(&done); 3420 jmp(&done);
3419 3421
3420 bind(&maybe_nan); 3422 bind(&maybe_nan);
3421 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise 3423 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
3422 // it's an Infinity, and the non-NaN code path applies. 3424 // it's an Infinity, and the non-NaN code path applies.
3423 Branch(&is_nan, gt, exponent_reg, Operand(scratch1)); 3425 Branch(&is_nan, gt, exponent_reg, Operand(scratch1));
3424 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); 3426 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset));
3425 Branch(&have_double_value, eq, mantissa_reg, Operand(zero_reg)); 3427 Branch(&have_double_value, eq, mantissa_reg, Operand(zero_reg));
3426 bind(&is_nan); 3428 bind(&is_nan);
3427 // Load canonical NaN for storing into the double array. 3429 // Load canonical NaN for storing into the double array.
3428 uint64_t nan_int64 = BitCast<uint64_t>( 3430 uint64_t nan_int64 = BitCast<uint64_t>(
3429 FixedDoubleArray::canonical_not_the_hole_nan_as_double()); 3431 FixedDoubleArray::canonical_not_the_hole_nan_as_double());
3430 li(mantissa_reg, Operand(static_cast<uint32_t>(nan_int64))); 3432 li(mantissa_reg, Operand(static_cast<uint32_t>(nan_int64)));
3431 li(exponent_reg, Operand(static_cast<uint32_t>(nan_int64 >> 32))); 3433 li(exponent_reg, Operand(static_cast<uint32_t>(nan_int64 >> 32)));
3432 jmp(&have_double_value); 3434 jmp(&have_double_value);
3433 3435
3434 bind(&smi_value); 3436 bind(&smi_value);
3435 Addu(scratch1, elements_reg, 3437 Addu(scratch1, elements_reg,
3436 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 3438 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag -
3439 elements_offset));
3437 sll(scratch2, key_reg, kDoubleSizeLog2 - kSmiTagSize); 3440 sll(scratch2, key_reg, kDoubleSizeLog2 - kSmiTagSize);
3438 Addu(scratch1, scratch1, scratch2); 3441 Addu(scratch1, scratch1, scratch2);
3439 // scratch1 is now effective address of the double element 3442 // scratch1 is now effective address of the double element
3440 3443
3441 FloatingPointHelper::Destination destination; 3444 FloatingPointHelper::Destination destination;
3442 if (CpuFeatures::IsSupported(FPU)) { 3445 if (CpuFeatures::IsSupported(FPU)) {
3443 destination = FloatingPointHelper::kFPURegisters; 3446 destination = FloatingPointHelper::kFPURegisters;
3444 } else { 3447 } else {
3445 destination = FloatingPointHelper::kCoreRegisters; 3448 destination = FloatingPointHelper::kCoreRegisters;
3446 } 3449 }
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
5458 opcode == BGTZL); 5461 opcode == BGTZL);
5459 opcode = (cond == eq) ? BEQ : BNE; 5462 opcode = (cond == eq) ? BEQ : BNE;
5460 instr = (instr & ~kOpcodeMask) | opcode; 5463 instr = (instr & ~kOpcodeMask) | opcode;
5461 masm_.emit(instr); 5464 masm_.emit(instr);
5462 } 5465 }
5463 5466
5464 5467
5465 } } // namespace v8::internal 5468 } } // namespace v8::internal
5466 5469
5467 #endif // V8_TARGET_ARCH_MIPS 5470 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698