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

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

Issue 228943009: MIPS: Add big-endian support for MIPS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 6 years, 8 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/mips/lithium-codegen-mips.cc ('k') | src/objects.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 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 And(scratch, src, kPointerSize - 1); 3306 And(scratch, src, kPointerSize - 1);
3307 Assert(eq, kExpectingAlignmentForCopyBytes, 3307 Assert(eq, kExpectingAlignmentForCopyBytes,
3308 scratch, Operand(zero_reg)); 3308 scratch, Operand(zero_reg));
3309 } 3309 }
3310 Branch(&byte_loop, lt, length, Operand(kPointerSize)); 3310 Branch(&byte_loop, lt, length, Operand(kPointerSize));
3311 lw(scratch, MemOperand(src)); 3311 lw(scratch, MemOperand(src));
3312 Addu(src, src, kPointerSize); 3312 Addu(src, src, kPointerSize);
3313 3313
3314 // TODO(kalmard) check if this can be optimized to use sw in most cases. 3314 // TODO(kalmard) check if this can be optimized to use sw in most cases.
3315 // Can't use unaligned access - copy byte by byte. 3315 // Can't use unaligned access - copy byte by byte.
3316 sb(scratch, MemOperand(dst, 0)); 3316 if (kArchEndian == kLittle) {
3317 srl(scratch, scratch, 8); 3317 sb(scratch, MemOperand(dst, 0));
3318 sb(scratch, MemOperand(dst, 1)); 3318 srl(scratch, scratch, 8);
3319 srl(scratch, scratch, 8); 3319 sb(scratch, MemOperand(dst, 1));
3320 sb(scratch, MemOperand(dst, 2)); 3320 srl(scratch, scratch, 8);
3321 srl(scratch, scratch, 8); 3321 sb(scratch, MemOperand(dst, 2));
3322 sb(scratch, MemOperand(dst, 3)); 3322 srl(scratch, scratch, 8);
3323 sb(scratch, MemOperand(dst, 3));
3324 } else {
3325 sb(scratch, MemOperand(dst, 3));
3326 srl(scratch, scratch, 8);
3327 sb(scratch, MemOperand(dst, 2));
3328 srl(scratch, scratch, 8);
3329 sb(scratch, MemOperand(dst, 1));
3330 srl(scratch, scratch, 8);
3331 sb(scratch, MemOperand(dst, 0));
3332 }
3333
3323 Addu(dst, dst, 4); 3334 Addu(dst, dst, 4);
3324 3335
3325 Subu(length, length, Operand(kPointerSize)); 3336 Subu(length, length, Operand(kPointerSize));
3326 Branch(&word_loop); 3337 Branch(&word_loop);
3327 3338
3328 // Copy the last bytes if any left. 3339 // Copy the last bytes if any left.
3329 bind(&byte_loop); 3340 bind(&byte_loop);
3330 Branch(&done, eq, length, Operand(zero_reg)); 3341 Branch(&done, eq, length, Operand(zero_reg));
3331 bind(&byte_loop_1); 3342 bind(&byte_loop_1);
3332 lbu(scratch, MemOperand(src)); 3343 lbu(scratch, MemOperand(src));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 // in the exponent. 3428 // in the exponent.
3418 li(scratch1, Operand(kNaNOrInfinityLowerBoundUpper32)); 3429 li(scratch1, Operand(kNaNOrInfinityLowerBoundUpper32));
3419 lw(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset)); 3430 lw(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset));
3420 Branch(&maybe_nan, ge, exponent_reg, Operand(scratch1)); 3431 Branch(&maybe_nan, ge, exponent_reg, Operand(scratch1));
3421 3432
3422 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); 3433 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset));
3423 3434
3424 bind(&have_double_value); 3435 bind(&have_double_value);
3425 sll(scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize); 3436 sll(scratch1, key_reg, kDoubleSizeLog2 - kSmiTagSize);
3426 Addu(scratch1, scratch1, elements_reg); 3437 Addu(scratch1, scratch1, elements_reg);
3427 sw(mantissa_reg, FieldMemOperand( 3438 sw(mantissa_reg,
3428 scratch1, FixedDoubleArray::kHeaderSize - elements_offset)); 3439 FieldMemOperand(scratch1, FixedDoubleArray::kHeaderSize - elements_offset
3429 uint32_t offset = FixedDoubleArray::kHeaderSize - elements_offset + 3440 + kHoleNanLower32Offset));
3430 sizeof(kHoleNanLower32); 3441 sw(exponent_reg,
3431 sw(exponent_reg, FieldMemOperand(scratch1, offset)); 3442 FieldMemOperand(scratch1, FixedDoubleArray::kHeaderSize - elements_offset
3443 + kHoleNanUpper32Offset));
3432 jmp(&done); 3444 jmp(&done);
3433 3445
3434 bind(&maybe_nan); 3446 bind(&maybe_nan);
3435 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise 3447 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
3436 // it's an Infinity, and the non-NaN code path applies. 3448 // it's an Infinity, and the non-NaN code path applies.
3437 Branch(&is_nan, gt, exponent_reg, Operand(scratch1)); 3449 Branch(&is_nan, gt, exponent_reg, Operand(scratch1));
3438 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); 3450 lw(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset));
3439 Branch(&have_double_value, eq, mantissa_reg, Operand(zero_reg)); 3451 Branch(&have_double_value, eq, mantissa_reg, Operand(zero_reg));
3440 bind(&is_nan); 3452 bind(&is_nan);
3441 // Load canonical NaN for storing into the double array. 3453 // Load canonical NaN for storing into the double array.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 JumpIfSmi(obj, fail); 3531 JumpIfSmi(obj, fail);
3520 } 3532 }
3521 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 3533 lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
3522 LoadRoot(at, index); 3534 LoadRoot(at, index);
3523 Branch(fail, ne, scratch, Operand(at)); 3535 Branch(fail, ne, scratch, Operand(at));
3524 } 3536 }
3525 3537
3526 3538
3527 void MacroAssembler::MovFromFloatResult(DoubleRegister dst) { 3539 void MacroAssembler::MovFromFloatResult(DoubleRegister dst) {
3528 if (IsMipsSoftFloatABI) { 3540 if (IsMipsSoftFloatABI) {
3529 Move(dst, v0, v1); 3541 if (kArchEndian == kLittle) {
3542 Move(dst, v0, v1);
3543 } else {
3544 Move(dst, v1, v0);
3545 }
3530 } else { 3546 } else {
3531 Move(dst, f0); // Reg f0 is o32 ABI FP return value. 3547 Move(dst, f0); // Reg f0 is o32 ABI FP return value.
3532 } 3548 }
3533 } 3549 }
3534 3550
3535 3551
3536 void MacroAssembler::MovFromFloatParameter(DoubleRegister dst) { 3552 void MacroAssembler::MovFromFloatParameter(DoubleRegister dst) {
3537 if (IsMipsSoftFloatABI) { 3553 if (IsMipsSoftFloatABI) {
3538 Move(dst, a0, a1); 3554 if (kArchEndian == kLittle) {
3555 Move(dst, a0, a1);
3556 } else {
3557 Move(dst, a1, a0);
3558 }
3539 } else { 3559 } else {
3540 Move(dst, f12); // Reg f12 is o32 ABI FP first argument value. 3560 Move(dst, f12); // Reg f12 is o32 ABI FP first argument value.
3541 } 3561 }
3542 } 3562 }
3543 3563
3544 3564
3545 void MacroAssembler::MovToFloatParameter(DoubleRegister src) { 3565 void MacroAssembler::MovToFloatParameter(DoubleRegister src) {
3546 if (!IsMipsSoftFloatABI) { 3566 if (!IsMipsSoftFloatABI) {
3547 Move(f12, src); 3567 Move(f12, src);
3548 } else { 3568 } else {
3549 Move(a0, a1, src); 3569 if (kArchEndian == kLittle) {
3570 Move(a0, a1, src);
3571 } else {
3572 Move(a1, a0, src);
3573 }
3550 } 3574 }
3551 } 3575 }
3552 3576
3553 3577
3554 void MacroAssembler::MovToFloatResult(DoubleRegister src) { 3578 void MacroAssembler::MovToFloatResult(DoubleRegister src) {
3555 if (!IsMipsSoftFloatABI) { 3579 if (!IsMipsSoftFloatABI) {
3556 Move(f0, src); 3580 Move(f0, src);
3557 } else { 3581 } else {
3558 Move(v0, v1, src); 3582 if (kArchEndian == kLittle) {
3583 Move(v0, v1, src);
3584 } else {
3585 Move(v1, v0, src);
3586 }
3559 } 3587 }
3560 } 3588 }
3561 3589
3562 3590
3563 void MacroAssembler::MovToFloatParameters(DoubleRegister src1, 3591 void MacroAssembler::MovToFloatParameters(DoubleRegister src1,
3564 DoubleRegister src2) { 3592 DoubleRegister src2) {
3565 if (!IsMipsSoftFloatABI) { 3593 if (!IsMipsSoftFloatABI) {
3566 if (src2.is(f12)) { 3594 if (src2.is(f12)) {
3567 ASSERT(!src1.is(f14)); 3595 ASSERT(!src1.is(f14));
3568 Move(f14, src2); 3596 Move(f14, src2);
3569 Move(f12, src1); 3597 Move(f12, src1);
3570 } else { 3598 } else {
3571 Move(f12, src1); 3599 Move(f12, src1);
3572 Move(f14, src2); 3600 Move(f14, src2);
3573 } 3601 }
3574 } else { 3602 } else {
3575 Move(a0, a1, src1); 3603 if (kArchEndian == kLittle) {
3576 Move(a2, a3, src2); 3604 Move(a0, a1, src1);
3605 Move(a2, a3, src2);
3606 } else {
3607 Move(a1, a0, src1);
3608 Move(a3, a2, src2);
3609 }
3577 } 3610 }
3578 } 3611 }
3579 3612
3580 3613
3581 // ----------------------------------------------------------------------------- 3614 // -----------------------------------------------------------------------------
3582 // JavaScript invokes. 3615 // JavaScript invokes.
3583 3616
3584 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 3617 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
3585 const ParameterCount& actual, 3618 const ParameterCount& actual,
3586 Handle<Code> code_constant, 3619 Handle<Code> code_constant,
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
5741 } 5774 }
5742 if (ms.shift() > 0) sra(result, result, ms.shift()); 5775 if (ms.shift() > 0) sra(result, result, ms.shift());
5743 srl(at, dividend, 31); 5776 srl(at, dividend, 31);
5744 Addu(result, result, Operand(at)); 5777 Addu(result, result, Operand(at));
5745 } 5778 }
5746 5779
5747 5780
5748 } } // namespace v8::internal 5781 } } // namespace v8::internal
5749 5782
5750 #endif // V8_TARGET_ARCH_MIPS 5783 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698