| 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 6113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6124 // Compute the entry point of the rewritten stub. | 6124 // Compute the entry point of the rewritten stub. |
| 6125 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 6125 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 6126 // Restore registers. | 6126 // Restore registers. |
| 6127 __ Pop(a1, a0, ra); | 6127 __ Pop(a1, a0, ra); |
| 6128 } | 6128 } |
| 6129 __ Jump(a2); | 6129 __ Jump(a2); |
| 6130 } | 6130 } |
| 6131 | 6131 |
| 6132 | 6132 |
| 6133 void DirectCEntryStub::Generate(MacroAssembler* masm) { | 6133 void DirectCEntryStub::Generate(MacroAssembler* masm) { |
| 6134 // No need to pop or drop anything, LeaveExitFrame will restore the old | 6134 // Make place for arguments to fit C calling convention. Most of the callers |
| 6135 // stack, thus dropping the allocated space for the return value. | 6135 // of DirectCEntryStub::GenerateCall are using EnterExitFrame/LeaveExitFrame |
| 6136 // The saved ra is after the reserved stack space for the 4 args. | 6136 // so they handle stack restoring and we don't have to do that here. |
| 6137 // Any caller of DirectCEntryStub::GenerateCall must take care of dropping |
| 6138 // kCArgsSlotsSize stack space after the call. |
| 6139 __ Subu(sp, sp, Operand(kCArgsSlotsSize)); |
| 6140 // Place the return address on the stack, making the call |
| 6141 // GC safe. The RegExp backend also relies on this. |
| 6142 __ sw(ra, MemOperand(sp, kCArgsSlotsSize)); |
| 6143 __ Call(t9); // Call the C++ function. |
| 6137 __ lw(t9, MemOperand(sp, kCArgsSlotsSize)); | 6144 __ lw(t9, MemOperand(sp, kCArgsSlotsSize)); |
| 6138 | 6145 |
| 6139 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 6146 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
| 6140 // In case of an error the return address may point to a memory area | 6147 // In case of an error the return address may point to a memory area |
| 6141 // filled with kZapValue by the GC. | 6148 // filled with kZapValue by the GC. |
| 6142 // Dereference the address and check for this. | 6149 // Dereference the address and check for this. |
| 6143 __ lw(t0, MemOperand(t9)); | 6150 __ lw(t0, MemOperand(t9)); |
| 6144 __ Assert(ne, kReceivedInvalidReturnAddress, t0, | 6151 __ Assert(ne, kReceivedInvalidReturnAddress, t0, |
| 6145 Operand(reinterpret_cast<uint32_t>(kZapValue))); | 6152 Operand(reinterpret_cast<uint32_t>(kZapValue))); |
| 6146 } | 6153 } |
| 6147 __ Jump(t9); | 6154 __ Jump(t9); |
| 6148 } | 6155 } |
| 6149 | 6156 |
| 6150 | 6157 |
| 6151 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, | 6158 void DirectCEntryStub::GenerateCall(MacroAssembler* masm, |
| 6152 Register target) { | 6159 Register target) { |
| 6153 __ Move(t9, target); | |
| 6154 __ AssertStackIsAligned(); | |
| 6155 // Allocate space for arg slots. | |
| 6156 __ Subu(sp, sp, kCArgsSlotsSize); | |
| 6157 | |
| 6158 // Block the trampoline pool through the whole function to make sure the | |
| 6159 // number of generated instructions is constant. | |
| 6160 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); | |
| 6161 | |
| 6162 // We need to get the current 'pc' value, which is not available on MIPS. | |
| 6163 Label find_ra; | |
| 6164 masm->bal(&find_ra); // ra = pc + 8. | |
| 6165 masm->nop(); // Branch delay slot nop. | |
| 6166 masm->bind(&find_ra); | |
| 6167 | |
| 6168 const int kNumInstructionsToJump = 6; | |
| 6169 masm->addiu(ra, ra, kNumInstructionsToJump * kPointerSize); | |
| 6170 // Push return address (accessible to GC through exit frame pc). | |
| 6171 // This spot for ra was reserved in EnterExitFrame. | |
| 6172 masm->sw(ra, MemOperand(sp, kCArgsSlotsSize)); | |
| 6173 intptr_t loc = | 6160 intptr_t loc = |
| 6174 reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); | 6161 reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); |
| 6175 masm->li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); | 6162 __ Move(t9, target); |
| 6176 // Call the function. | 6163 __ li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); |
| 6177 masm->Jump(t9); | 6164 __ Call(ra); |
| 6178 // Make sure the stored 'ra' points to this position. | |
| 6179 ASSERT_EQ(kNumInstructionsToJump, masm->InstructionsGeneratedSince(&find_ra)); | |
| 6180 } | 6165 } |
| 6181 | 6166 |
| 6182 | 6167 |
| 6183 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, | 6168 void NameDictionaryLookupStub::GenerateNegativeLookup(MacroAssembler* masm, |
| 6184 Label* miss, | 6169 Label* miss, |
| 6185 Label* done, | 6170 Label* done, |
| 6186 Register receiver, | 6171 Register receiver, |
| 6187 Register properties, | 6172 Register properties, |
| 6188 Handle<Name> name, | 6173 Handle<Name> name, |
| 6189 Register scratch0) { | 6174 Register scratch0) { |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7190 __ bind(&fast_elements_case); | 7175 __ bind(&fast_elements_case); |
| 7191 GenerateCase(masm, FAST_ELEMENTS); | 7176 GenerateCase(masm, FAST_ELEMENTS); |
| 7192 } | 7177 } |
| 7193 | 7178 |
| 7194 | 7179 |
| 7195 #undef __ | 7180 #undef __ |
| 7196 | 7181 |
| 7197 } } // namespace v8::internal | 7182 } } // namespace v8::internal |
| 7198 | 7183 |
| 7199 #endif // V8_TARGET_ARCH_MIPS | 7184 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |