OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 __ mov(A1, T5); // Pass the function entrypoint. | 200 __ mov(A1, T5); // Pass the function entrypoint. |
201 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1. | 201 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1. |
202 // Call native wrapper function or redirection via simulator. | 202 // Call native wrapper function or redirection via simulator. |
203 #if defined(USING_SIMULATOR) | 203 #if defined(USING_SIMULATOR) |
204 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | 204 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); |
205 entry = Simulator::RedirectExternalReference( | 205 entry = Simulator::RedirectExternalReference( |
206 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 206 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
207 __ LoadImmediate(T9, entry); | 207 __ LoadImmediate(T9, entry); |
208 __ jalr(T9); | 208 __ jalr(T9); |
209 #else | 209 #else |
210 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); | 210 __ BranchLink(&NativeEntry::NativeCallWrapperLabel(), kNotPatchable); |
211 #endif | 211 #endif |
212 __ Comment("CallNativeCFunctionStub return"); | 212 __ Comment("CallNativeCFunctionStub return"); |
213 | 213 |
214 // Mark that the isolate is executing Dart code. | 214 // Mark that the isolate is executing Dart code. |
215 __ LoadImmediate(A2, VMTag::kDartTagId); | 215 __ LoadImmediate(A2, VMTag::kDartTagId); |
216 __ sw(A2, Address(S6, Isolate::vm_tag_offset())); | 216 __ sw(A2, Address(S6, Isolate::vm_tag_offset())); |
217 | 217 |
218 // Reset exit frame information in Isolate structure. | 218 // Reset exit frame information in Isolate structure. |
219 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset())); | 219 __ sw(ZR, Address(THR, Thread::top_exit_frame_info_offset())); |
220 | 220 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 __ Comment("GenerateDeoptimizationSequence"); | 453 __ Comment("GenerateDeoptimizationSequence"); |
454 // DeoptimizeCopyFrame expects a Dart frame, i.e. EnterDartFrame(0), but there | 454 // DeoptimizeCopyFrame expects a Dart frame, i.e. EnterDartFrame(0), but there |
455 // is no need to set the correct PC marker or load PP, since they get patched. | 455 // is no need to set the correct PC marker or load PP, since they get patched. |
456 __ addiu(SP, SP, Immediate(-kPushedRegistersSize * kWordSize)); | 456 __ addiu(SP, SP, Immediate(-kPushedRegistersSize * kWordSize)); |
457 __ sw(ZR, Address(SP, kPushedRegistersSize - 1 * kWordSize)); | 457 __ sw(ZR, Address(SP, kPushedRegistersSize - 1 * kWordSize)); |
458 __ sw(RA, Address(SP, kPushedRegistersSize - 2 * kWordSize)); | 458 __ sw(RA, Address(SP, kPushedRegistersSize - 2 * kWordSize)); |
459 __ sw(FP, Address(SP, kPushedRegistersSize - 3 * kWordSize)); | 459 __ sw(FP, Address(SP, kPushedRegistersSize - 3 * kWordSize)); |
460 __ sw(PP, Address(SP, kPushedRegistersSize - 4 * kWordSize)); | 460 __ sw(PP, Address(SP, kPushedRegistersSize - 4 * kWordSize)); |
461 __ addiu(FP, SP, Immediate(kPushedRegistersSize - 3 * kWordSize)); | 461 __ addiu(FP, SP, Immediate(kPushedRegistersSize - 3 * kWordSize)); |
462 | 462 |
| 463 __ LoadPoolPointer(); |
| 464 |
463 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry | 465 // The code in this frame may not cause GC. kDeoptimizeCopyFrameRuntimeEntry |
464 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls. | 466 // and kDeoptimizeFillFrameRuntimeEntry are leaf runtime calls. |
465 const intptr_t saved_result_slot_from_fp = | 467 const intptr_t saved_result_slot_from_fp = |
466 kFirstLocalSlotFromFp + 1 - (kNumberOfCpuRegisters - V0); | 468 kFirstLocalSlotFromFp + 1 - (kNumberOfCpuRegisters - V0); |
467 // Result in V0 is preserved as part of pushing all registers below. | 469 // Result in V0 is preserved as part of pushing all registers below. |
468 | 470 |
469 // Push registers in their enumeration order: lowest register number at | 471 // Push registers in their enumeration order: lowest register number at |
470 // lowest address. | 472 // lowest address. |
471 for (int i = 0; i < kNumberOfCpuRegisters; i++) { | 473 for (int i = 0; i < kNumberOfCpuRegisters; i++) { |
472 const int slot = 4 + kNumberOfCpuRegisters - i; | 474 const int slot = 4 + kNumberOfCpuRegisters - i; |
(...skipping 10 matching lines...) Expand all Loading... |
483 __ mov(A0, SP); // Pass address of saved registers block. | 485 __ mov(A0, SP); // Pass address of saved registers block. |
484 __ ReserveAlignedFrameSpace(1 * kWordSize); | 486 __ ReserveAlignedFrameSpace(1 * kWordSize); |
485 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1); | 487 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1); |
486 // Result (V0) is stack-size (FP - SP) in bytes, incl. the return address. | 488 // Result (V0) is stack-size (FP - SP) in bytes, incl. the return address. |
487 | 489 |
488 if (preserve_result) { | 490 if (preserve_result) { |
489 // Restore result into T1 temporarily. | 491 // Restore result into T1 temporarily. |
490 __ lw(T1, Address(FP, saved_result_slot_from_fp * kWordSize)); | 492 __ lw(T1, Address(FP, saved_result_slot_from_fp * kWordSize)); |
491 } | 493 } |
492 | 494 |
493 __ addiu(SP, FP, Immediate(-kWordSize)); | 495 __ LeaveDartFrame(); |
494 __ lw(RA, Address(SP, 2 * kWordSize)); | |
495 __ lw(FP, Address(SP, 1 * kWordSize)); | |
496 __ lw(PP, Address(SP, 0 * kWordSize)); | |
497 __ subu(SP, FP, V0); | 496 __ subu(SP, FP, V0); |
498 | 497 |
499 // DeoptimizeFillFrame expects a Dart frame, i.e. EnterDartFrame(0), but there | 498 // DeoptimizeFillFrame expects a Dart frame, i.e. EnterDartFrame(0), but there |
500 // is no need to set the correct PC marker or load PP, since they get patched. | 499 // is no need to set the correct PC marker or load PP, since they get patched. |
501 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 500 __ EnterStubFrame(); |
502 __ sw(ZR, Address(SP, 3 * kWordSize)); | |
503 __ sw(RA, Address(SP, 2 * kWordSize)); | |
504 __ sw(FP, Address(SP, 1 * kWordSize)); | |
505 __ sw(PP, Address(SP, 0 * kWordSize)); | |
506 __ addiu(FP, SP, Immediate(kWordSize)); | |
507 | 501 |
508 __ mov(A0, FP); // Get last FP address. | 502 __ mov(A0, FP); // Get last FP address. |
509 if (preserve_result) { | 503 if (preserve_result) { |
510 __ Push(T1); // Preserve result as first local. | 504 __ Push(T1); // Preserve result as first local. |
511 } | 505 } |
512 __ ReserveAlignedFrameSpace(1 * kWordSize); | 506 __ ReserveAlignedFrameSpace(1 * kWordSize); |
513 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1); // Pass last FP in A0. | 507 __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1); // Pass last FP in A0. |
514 if (preserve_result) { | 508 if (preserve_result) { |
515 // Restore result into T1. | 509 // Restore result into T1. |
516 __ lw(T1, Address(FP, kFirstLocalSlotFromFp * kWordSize)); | 510 __ lw(T1, Address(FP, kFirstLocalSlotFromFp * kWordSize)); |
517 } | 511 } |
518 // Code above cannot cause GC. | 512 // Code above cannot cause GC. |
519 __ addiu(SP, FP, Immediate(-kWordSize)); | 513 __ LeaveStubFrame(); |
520 __ lw(RA, Address(SP, 2 * kWordSize)); | |
521 __ lw(FP, Address(SP, 1 * kWordSize)); | |
522 __ lw(PP, Address(SP, 0 * kWordSize)); | |
523 __ addiu(SP, SP, Immediate(4 * kWordSize)); | |
524 | 514 |
525 // Frame is fully rewritten at this point and it is safe to perform a GC. | 515 // Frame is fully rewritten at this point and it is safe to perform a GC. |
526 // Materialize any objects that were deferred by FillFrame because they | 516 // Materialize any objects that were deferred by FillFrame because they |
527 // require allocation. | 517 // require allocation. |
528 // Enter stub frame with loading PP. The caller's PP is not materialized yet. | 518 // Enter stub frame with loading PP. The caller's PP is not materialized yet. |
529 __ EnterStubFrame(); | 519 __ EnterStubFrame(); |
530 if (preserve_result) { | 520 if (preserve_result) { |
531 __ Push(T1); // Preserve result, it will be GC-d here. | 521 __ Push(T1); // Preserve result, it will be GC-d here. |
532 } | 522 } |
533 __ PushObject(Smi::ZoneHandle()); // Space for the result. | 523 __ PushObject(Smi::ZoneHandle()); // Space for the result. |
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 // Result: | 2248 // Result: |
2259 // T1: entry point. | 2249 // T1: entry point. |
2260 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2250 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2261 EmitMegamorphicLookup(assembler, T0, T1, T1); | 2251 EmitMegamorphicLookup(assembler, T0, T1, T1); |
2262 __ Ret(); | 2252 __ Ret(); |
2263 } | 2253 } |
2264 | 2254 |
2265 } // namespace dart | 2255 } // namespace dart |
2266 | 2256 |
2267 #endif // defined TARGET_ARCH_MIPS | 2257 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |