OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 5553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5564 | 5564 |
5565 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 5565 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
5566 const Runtime::Function* function = Runtime::FunctionForId(fid); | 5566 const Runtime::Function* function = Runtime::FunctionForId(fid); |
5567 DCHECK_EQ(1, function->result_size); | 5567 DCHECK_EQ(1, function->result_size); |
5568 if (function->nargs >= 0) { | 5568 if (function->nargs >= 0) { |
5569 PrepareCEntryArgs(function->nargs); | 5569 PrepareCEntryArgs(function->nargs); |
5570 } | 5570 } |
5571 JumpToExternalReference(ExternalReference(fid, isolate())); | 5571 JumpToExternalReference(ExternalReference(fid, isolate())); |
5572 } | 5572 } |
5573 | 5573 |
5574 | |
5575 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, | 5574 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, |
5576 BranchDelaySlot bd) { | 5575 BranchDelaySlot bd, |
| 5576 bool builtin_exit_frame) { |
5577 PrepareCEntryFunction(builtin); | 5577 PrepareCEntryFunction(builtin); |
5578 CEntryStub stub(isolate(), 1); | 5578 CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack, |
| 5579 builtin_exit_frame); |
5579 Jump(stub.GetCode(), | 5580 Jump(stub.GetCode(), |
5580 RelocInfo::CODE_TARGET, | 5581 RelocInfo::CODE_TARGET, |
5581 al, | 5582 al, |
5582 zero_reg, | 5583 zero_reg, |
5583 Operand(zero_reg), | 5584 Operand(zero_reg), |
5584 bd); | 5585 bd); |
5585 } | 5586 } |
5586 | 5587 |
5587 | |
5588 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 5588 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
5589 Register scratch1, Register scratch2) { | 5589 Register scratch1, Register scratch2) { |
5590 if (FLAG_native_code_counters && counter->Enabled()) { | 5590 if (FLAG_native_code_counters && counter->Enabled()) { |
5591 li(scratch1, Operand(value)); | 5591 li(scratch1, Operand(value)); |
5592 li(scratch2, Operand(ExternalReference(counter))); | 5592 li(scratch2, Operand(ExternalReference(counter))); |
5593 sw(scratch1, MemOperand(scratch2)); | 5593 sw(scratch1, MemOperand(scratch2)); |
5594 } | 5594 } |
5595 } | 5595 } |
5596 | 5596 |
5597 | 5597 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5832 Addu(fp, sp, Operand(fp_offset)); | 5832 Addu(fp, sp, Operand(fp_offset)); |
5833 } | 5833 } |
5834 | 5834 |
5835 | 5835 |
5836 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 5836 void MacroAssembler::LeaveFrame(StackFrame::Type type) { |
5837 addiu(sp, fp, 2 * kPointerSize); | 5837 addiu(sp, fp, 2 * kPointerSize); |
5838 lw(ra, MemOperand(fp, 1 * kPointerSize)); | 5838 lw(ra, MemOperand(fp, 1 * kPointerSize)); |
5839 lw(fp, MemOperand(fp, 0 * kPointerSize)); | 5839 lw(fp, MemOperand(fp, 0 * kPointerSize)); |
5840 } | 5840 } |
5841 | 5841 |
5842 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 5842 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, |
| 5843 StackFrame::Type frame_type) { |
| 5844 DCHECK(frame_type == StackFrame::EXIT || |
| 5845 frame_type == StackFrame::BUILTIN_EXIT); |
| 5846 |
5843 // Set up the frame structure on the stack. | 5847 // Set up the frame structure on the stack. |
5844 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); | 5848 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); |
5845 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); | 5849 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); |
5846 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); | 5850 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); |
5847 | 5851 |
5848 // This is how the stack will look: | 5852 // This is how the stack will look: |
5849 // fp + 2 (==kCallerSPDisplacement) - old stack's end | 5853 // fp + 2 (==kCallerSPDisplacement) - old stack's end |
5850 // [fp + 1 (==kCallerPCOffset)] - saved old ra | 5854 // [fp + 1 (==kCallerPCOffset)] - saved old ra |
5851 // [fp + 0 (==kCallerFPOffset)] - saved old fp | 5855 // [fp + 0 (==kCallerFPOffset)] - saved old fp |
5852 // [fp - 1 StackFrame::EXIT Smi | 5856 // [fp - 1 StackFrame::EXIT Smi |
5853 // [fp - 2 (==kSPOffset)] - sp of the called function | 5857 // [fp - 2 (==kSPOffset)] - sp of the called function |
5854 // [fp - 3 (==kCodeOffset)] - CodeObject | 5858 // [fp - 3 (==kCodeOffset)] - CodeObject |
5855 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the | 5859 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the |
5856 // new stack (will contain saved ra) | 5860 // new stack (will contain saved ra) |
5857 | 5861 |
5858 // Save registers and reserve room for saved entry sp and code object. | 5862 // Save registers and reserve room for saved entry sp and code object. |
5859 addiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); | 5863 addiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); |
5860 sw(ra, MemOperand(sp, 4 * kPointerSize)); | 5864 sw(ra, MemOperand(sp, 4 * kPointerSize)); |
5861 sw(fp, MemOperand(sp, 3 * kPointerSize)); | 5865 sw(fp, MemOperand(sp, 3 * kPointerSize)); |
5862 li(at, Operand(Smi::FromInt(StackFrame::EXIT))); | 5866 li(at, Operand(Smi::FromInt(frame_type))); |
5863 sw(at, MemOperand(sp, 2 * kPointerSize)); | 5867 sw(at, MemOperand(sp, 2 * kPointerSize)); |
5864 // Set up new frame pointer. | 5868 // Set up new frame pointer. |
5865 addiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); | 5869 addiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); |
5866 | 5870 |
5867 if (emit_debug_code()) { | 5871 if (emit_debug_code()) { |
5868 sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 5872 sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
5869 } | 5873 } |
5870 | 5874 |
5871 // Accessed from ExitFrame::code_slot. | 5875 // Accessed from ExitFrame::code_slot. |
5872 li(t8, Operand(CodeObject()), CONSTANT_SIZE); | 5876 li(t8, Operand(CodeObject()), CONSTANT_SIZE); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6840 if (mag.shift > 0) sra(result, result, mag.shift); | 6844 if (mag.shift > 0) sra(result, result, mag.shift); |
6841 srl(at, dividend, 31); | 6845 srl(at, dividend, 31); |
6842 Addu(result, result, Operand(at)); | 6846 Addu(result, result, Operand(at)); |
6843 } | 6847 } |
6844 | 6848 |
6845 | 6849 |
6846 } // namespace internal | 6850 } // namespace internal |
6847 } // namespace v8 | 6851 } // namespace v8 |
6848 | 6852 |
6849 #endif // V8_TARGET_ARCH_MIPS | 6853 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |