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