OLD | NEW |
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 4614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4625 sw(t8, MemOperand(fp, ExitFrameConstants::kCodeOffset)); | 4625 sw(t8, MemOperand(fp, ExitFrameConstants::kCodeOffset)); |
4626 | 4626 |
4627 // Save the frame pointer and the context in top. | 4627 // Save the frame pointer and the context in top. |
4628 li(t8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 4628 li(t8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
4629 sw(fp, MemOperand(t8)); | 4629 sw(fp, MemOperand(t8)); |
4630 li(t8, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 4630 li(t8, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
4631 sw(cp, MemOperand(t8)); | 4631 sw(cp, MemOperand(t8)); |
4632 | 4632 |
4633 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); | 4633 const int frame_alignment = MacroAssembler::ActivationFrameAlignment(); |
4634 if (save_doubles) { | 4634 if (save_doubles) { |
| 4635 CpuFeatures::Scope scope(FPU); |
4635 // The stack must be allign to 0 modulo 8 for stores with sdc1. | 4636 // The stack must be allign to 0 modulo 8 for stores with sdc1. |
4636 ASSERT(kDoubleSize == frame_alignment); | 4637 ASSERT(kDoubleSize == frame_alignment); |
4637 if (frame_alignment > 0) { | 4638 if (frame_alignment > 0) { |
4638 ASSERT(IsPowerOf2(frame_alignment)); | 4639 ASSERT(IsPowerOf2(frame_alignment)); |
4639 And(sp, sp, Operand(-frame_alignment)); // Align stack. | 4640 And(sp, sp, Operand(-frame_alignment)); // Align stack. |
4640 } | 4641 } |
4641 int space = FPURegister::kNumRegisters * kDoubleSize; | 4642 int space = FPURegister::kMaxNumRegisters * kDoubleSize; |
4642 Subu(sp, sp, Operand(space)); | 4643 Subu(sp, sp, Operand(space)); |
4643 // Remember: we only need to save every 2nd double FPU value. | 4644 // Remember: we only need to save every 2nd double FPU value. |
4644 for (int i = 0; i < FPURegister::kNumRegisters; i+=2) { | 4645 for (int i = 0; i < FPURegister::kMaxNumRegisters; i+=2) { |
4645 FPURegister reg = FPURegister::from_code(i); | 4646 FPURegister reg = FPURegister::from_code(i); |
4646 sdc1(reg, MemOperand(sp, i * kDoubleSize)); | 4647 sdc1(reg, MemOperand(sp, i * kDoubleSize)); |
4647 } | 4648 } |
4648 } | 4649 } |
4649 | 4650 |
4650 // Reserve place for the return address, stack space and an optional slot | 4651 // Reserve place for the return address, stack space and an optional slot |
4651 // (used by the DirectCEntryStub to hold the return value if a struct is | 4652 // (used by the DirectCEntryStub to hold the return value if a struct is |
4652 // returned) and align the frame preparing for calling the runtime function. | 4653 // returned) and align the frame preparing for calling the runtime function. |
4653 ASSERT(stack_space >= 0); | 4654 ASSERT(stack_space >= 0); |
4654 Subu(sp, sp, Operand((stack_space + 2) * kPointerSize)); | 4655 Subu(sp, sp, Operand((stack_space + 2) * kPointerSize)); |
4655 if (frame_alignment > 0) { | 4656 if (frame_alignment > 0) { |
4656 ASSERT(IsPowerOf2(frame_alignment)); | 4657 ASSERT(IsPowerOf2(frame_alignment)); |
4657 And(sp, sp, Operand(-frame_alignment)); // Align stack. | 4658 And(sp, sp, Operand(-frame_alignment)); // Align stack. |
4658 } | 4659 } |
4659 | 4660 |
4660 // Set the exit frame sp value to point just before the return address | 4661 // Set the exit frame sp value to point just before the return address |
4661 // location. | 4662 // location. |
4662 addiu(at, sp, kPointerSize); | 4663 addiu(at, sp, kPointerSize); |
4663 sw(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 4664 sw(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
4664 } | 4665 } |
4665 | 4666 |
4666 | 4667 |
4667 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 4668 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
4668 Register argument_count, | 4669 Register argument_count, |
4669 bool do_return) { | 4670 bool do_return) { |
4670 // Optionally restore all double registers. | 4671 // Optionally restore all double registers. |
4671 if (save_doubles) { | 4672 if (save_doubles) { |
| 4673 CpuFeatures::Scope scope(FPU); |
4672 // Remember: we only need to restore every 2nd double FPU value. | 4674 // Remember: we only need to restore every 2nd double FPU value. |
4673 lw(t8, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 4675 lw(t8, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
4674 for (int i = 0; i < FPURegister::kNumRegisters; i+=2) { | 4676 for (int i = 0; i < FPURegister::kMaxNumRegisters; i+=2) { |
4675 FPURegister reg = FPURegister::from_code(i); | 4677 FPURegister reg = FPURegister::from_code(i); |
4676 ldc1(reg, MemOperand(t8, i * kDoubleSize + kPointerSize)); | 4678 ldc1(reg, MemOperand(t8, i * kDoubleSize + kPointerSize)); |
4677 } | 4679 } |
4678 } | 4680 } |
4679 | 4681 |
4680 // Clear top frame. | 4682 // Clear top frame. |
4681 li(t8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 4683 li(t8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
4682 sw(zero_reg, MemOperand(t8)); | 4684 sw(zero_reg, MemOperand(t8)); |
4683 | 4685 |
4684 // Restore current context from top and clear it in debug mode. | 4686 // Restore current context from top and clear it in debug mode. |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5441 bind(&in_bounds); | 5443 bind(&in_bounds); |
5442 cvt_w_d(temp_double_reg, input_reg); | 5444 cvt_w_d(temp_double_reg, input_reg); |
5443 mfc1(result_reg, temp_double_reg); | 5445 mfc1(result_reg, temp_double_reg); |
5444 bind(&done); | 5446 bind(&done); |
5445 } | 5447 } |
5446 | 5448 |
5447 | 5449 |
5448 void MacroAssembler::TestJSArrayForAllocationSiteInfo( | 5450 void MacroAssembler::TestJSArrayForAllocationSiteInfo( |
5449 Register receiver_reg, | 5451 Register receiver_reg, |
5450 Register scratch_reg, | 5452 Register scratch_reg, |
| 5453 Condition cond, |
5451 Label* allocation_info_present) { | 5454 Label* allocation_info_present) { |
5452 Label no_info_available; | 5455 Label no_info_available; |
5453 ExternalReference new_space_start = | 5456 ExternalReference new_space_start = |
5454 ExternalReference::new_space_start(isolate()); | 5457 ExternalReference::new_space_start(isolate()); |
5455 ExternalReference new_space_allocation_top = | 5458 ExternalReference new_space_allocation_top = |
5456 ExternalReference::new_space_allocation_top_address(isolate()); | 5459 ExternalReference::new_space_allocation_top_address(isolate()); |
5457 Addu(scratch_reg, receiver_reg, | 5460 Addu(scratch_reg, receiver_reg, |
5458 Operand(JSArray::kSize + AllocationSiteInfo::kSize - kHeapObjectTag)); | 5461 Operand(JSArray::kSize + AllocationSiteInfo::kSize - kHeapObjectTag)); |
5459 Branch(&no_info_available, lt, scratch_reg, Operand(new_space_start)); | 5462 Branch(&no_info_available, lt, scratch_reg, Operand(new_space_start)); |
5460 li(at, Operand(new_space_allocation_top)); | 5463 li(at, Operand(new_space_allocation_top)); |
5461 lw(at, MemOperand(at)); | 5464 lw(at, MemOperand(at)); |
5462 Branch(&no_info_available, gt, scratch_reg, Operand(at)); | 5465 Branch(&no_info_available, gt, scratch_reg, Operand(at)); |
5463 lw(scratch_reg, MemOperand(scratch_reg, -AllocationSiteInfo::kSize)); | 5466 lw(scratch_reg, MemOperand(scratch_reg, -AllocationSiteInfo::kSize)); |
5464 Branch(allocation_info_present, eq, scratch_reg, | 5467 Branch(allocation_info_present, cond, scratch_reg, |
5465 Operand(Handle<Map>(isolate()->heap()->allocation_site_info_map()))); | 5468 Operand(Handle<Map>(isolate()->heap()->allocation_site_info_map()))); |
5466 bind(&no_info_available); | 5469 bind(&no_info_available); |
5467 } | 5470 } |
5468 | 5471 |
5469 | 5472 |
5470 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { | 5473 bool AreAliased(Register r1, Register r2, Register r3, Register r4) { |
5471 if (r1.is(r2)) return true; | 5474 if (r1.is(r2)) return true; |
5472 if (r1.is(r3)) return true; | 5475 if (r1.is(r3)) return true; |
5473 if (r1.is(r4)) return true; | 5476 if (r1.is(r4)) return true; |
5474 if (r2.is(r3)) return true; | 5477 if (r2.is(r3)) return true; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5528 opcode == BGTZL); | 5531 opcode == BGTZL); |
5529 opcode = (cond == eq) ? BEQ : BNE; | 5532 opcode = (cond == eq) ? BEQ : BNE; |
5530 instr = (instr & ~kOpcodeMask) | opcode; | 5533 instr = (instr & ~kOpcodeMask) | opcode; |
5531 masm_.emit(instr); | 5534 masm_.emit(instr); |
5532 } | 5535 } |
5533 | 5536 |
5534 | 5537 |
5535 } } // namespace v8::internal | 5538 } } // namespace v8::internal |
5536 | 5539 |
5537 #endif // V8_TARGET_ARCH_MIPS | 5540 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |