Chromium Code Reviews| Index: src/mips/regexp-macro-assembler-mips.cc |
| diff --git a/src/mips/regexp-macro-assembler-mips.cc b/src/mips/regexp-macro-assembler-mips.cc |
| index 1a04fd10292b2532256bcecc315ff4ecadf263b5..225b090b979b2bd108b73802de0ba382356cfb85 100644 |
| --- a/src/mips/regexp-macro-assembler-mips.cc |
| +++ b/src/mips/regexp-macro-assembler-mips.cc |
| @@ -1063,15 +1063,32 @@ bool RegExpMacroAssemblerMIPS::CanReadUnaligned() { |
| // Private methods: |
| void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) { |
| - static const int num_arguments = 3; |
| - __ PrepareCallCFunction(num_arguments, scratch); |
| + __ PrepareCallCFunction(3, scratch); |
| + |
| __ mov(a2, frame_pointer()); |
| // Code* of self. |
| __ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE); |
| - // a0 becomes return address pointer. |
| + |
| + // We need to make room for the return address on the stack. |
| + int stack_alignment = OS::ActivationFrameAlignment(); |
| + ASSERT(IsAligned(stack_alignment, kPointerSize)); |
| + __ Subu(sp, sp, Operand(stack_alignment)); |
| + |
| + // a0 will point to the return address, placed by DirectCEntry. |
| + __ mov(a0, sp); |
| + |
| ExternalReference stack_guard_check = |
| ExternalReference::re_check_stack_guard_state(masm_->isolate()); |
| - CallCFunctionUsingStub(stack_guard_check, num_arguments); |
| + __ li(t9, Operand(stack_guard_check)); |
| + DirectCEntryStub stub; |
| + stub.GenerateCall(masm_, t9); |
| + |
| + ASSERT(stack_alignment != 0); |
| + // Drop the return address, stack alignment, C arguments from the stack |
| + // with loading saved sp. |
| + __ lw(sp, MemOperand(sp, 16 + stack_alignment + kCArgsSlotsSize)); |
|
Paul Lind
2013/09/19 18:07:10
Where does the magic number 16 come from? You're c
kilvadyb
2013/09/19 18:37:26
The 16 comes from the allocation done by PrepareCa
|
| + |
| + __ li(code_pointer(), Operand(masm_->CodeObject())); |
| } |
| @@ -1276,21 +1293,6 @@ void RegExpMacroAssemblerMIPS::CheckStackLimit() { |
| } |
| -void RegExpMacroAssemblerMIPS::CallCFunctionUsingStub( |
| - ExternalReference function, |
| - int num_arguments) { |
| - // Must pass all arguments in registers. The stub pushes on the stack. |
| - ASSERT(num_arguments <= 4); |
| - __ li(code_pointer(), Operand(function)); |
| - RegExpCEntryStub stub; |
| - __ CallStub(&stub); |
| - if (OS::ActivationFrameAlignment() != 0) { |
| - __ lw(sp, MemOperand(sp, 16)); |
| - } |
| - __ li(code_pointer(), Operand(masm_->CodeObject()), CONSTANT_SIZE); |
| -} |
| - |
| - |
| void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, |
| int characters) { |
| Register offset = current_input_offset(); |
| @@ -1312,23 +1314,6 @@ void RegExpMacroAssemblerMIPS::LoadCurrentCharacterUnchecked(int cp_offset, |
| } |
| -void RegExpCEntryStub::Generate(MacroAssembler* masm_) { |
| - int stack_alignment = OS::ActivationFrameAlignment(); |
| - if (stack_alignment < kPointerSize) stack_alignment = kPointerSize; |
| - // Stack is already aligned for call, so decrement by alignment |
| - // to make room for storing the return address. |
| - __ Subu(sp, sp, Operand(stack_alignment + kCArgsSlotsSize)); |
| - const int return_address_offset = kCArgsSlotsSize; |
| - __ Addu(a0, sp, return_address_offset); |
| - __ sw(ra, MemOperand(a0, 0)); |
| - __ mov(t9, t1); |
| - __ Call(t9); |
| - __ lw(ra, MemOperand(sp, return_address_offset)); |
| - __ Addu(sp, sp, Operand(stack_alignment + kCArgsSlotsSize)); |
| - __ Jump(ra); |
| -} |
| - |
| - |
| #undef __ |
| #endif // V8_INTERPRETED_REGEXP |