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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 if (kind == kLazyDeoptFromReturn) { | 542 if (kind == kLazyDeoptFromReturn) { |
543 __ Pop(V0); // Restore result. | 543 __ Pop(V0); // Restore result. |
544 } else if (kind == kLazyDeoptFromThrow) { | 544 } else if (kind == kLazyDeoptFromThrow) { |
545 __ Pop(V1); // Restore stacktrace. | 545 __ Pop(V1); // Restore stacktrace. |
546 __ Pop(V0); // Restore exception. | 546 __ Pop(V0); // Restore exception. |
547 } | 547 } |
548 __ LeaveStubFrame(); | 548 __ LeaveStubFrame(); |
549 // Remove materialization arguments. | 549 // Remove materialization arguments. |
550 __ SmiUntag(T1); | 550 __ SmiUntag(T1); |
551 __ addu(SP, SP, T1); | 551 __ addu(SP, SP, T1); |
552 __ Ret(); | 552 // The caller is responsible for emitting the return instruction. |
553 } | 553 } |
554 | 554 |
555 // V0: result, must be preserved | 555 // V0: result, must be preserved |
556 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { | 556 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
557 // Push zap value instead of CODE_REG for lazy deopt. | 557 // Push zap value instead of CODE_REG for lazy deopt. |
558 __ LoadImmediate(TMP, 0xf1f1f1f1); | 558 __ LoadImmediate(TMP, kZapCodeReg); |
559 __ Push(TMP); | 559 __ Push(TMP); |
560 // Return address for "call" to deopt stub. | 560 // Return address for "call" to deopt stub. |
561 __ LoadImmediate(RA, 0xe1e1e1e1); | 561 __ LoadImmediate(RA, kZapReturnAddress); |
562 __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); | 562 __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); |
563 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); | 563 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
| 564 __ Ret(); |
564 } | 565 } |
565 | 566 |
566 | 567 |
567 // V0: exception, must be preserved | 568 // V0: exception, must be preserved |
568 // V1: stacktrace, must be preserved | 569 // V1: stacktrace, must be preserved |
569 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { | 570 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { |
570 // Push zap value instead of CODE_REG for lazy deopt. | 571 // Push zap value instead of CODE_REG for lazy deopt. |
571 __ LoadImmediate(TMP, 0xf1f1f1f1); | 572 __ LoadImmediate(TMP, kZapCodeReg); |
572 __ Push(TMP); | 573 __ Push(TMP); |
573 // Return address for "call" to deopt stub. | 574 // Return address for "call" to deopt stub. |
574 __ LoadImmediate(RA, 0xe1e1e1e1); | 575 __ LoadImmediate(RA, kZapReturnAddress); |
575 __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); | 576 __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); |
576 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); | 577 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
| 578 __ Ret(); |
577 } | 579 } |
578 | 580 |
579 | 581 |
580 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 582 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
581 GenerateDeoptimizationSequence(assembler, kEagerDeopt); | 583 GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
| 584 __ Ret(); |
582 } | 585 } |
583 | 586 |
584 | 587 |
585 static void GenerateDispatcherCode(Assembler* assembler, | 588 static void GenerateDispatcherCode(Assembler* assembler, |
586 Label* call_target_function) { | 589 Label* call_target_function) { |
587 __ Comment("NoSuchMethodDispatch"); | 590 __ Comment("NoSuchMethodDispatch"); |
588 // When lazily generated invocation dispatchers are disabled, the | 591 // When lazily generated invocation dispatchers are disabled, the |
589 // miss-handler may return null. | 592 // miss-handler may return null. |
590 __ BranchNotEqual(T0, Object::null_object(), call_target_function); | 593 __ BranchNotEqual(T0, Object::null_object(), call_target_function); |
591 __ EnterStubFrame(); | 594 __ EnterStubFrame(); |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2024 |
2022 // Load the stacktrace from the current thread. | 2025 // Load the stacktrace from the current thread. |
2023 Address stacktrace_addr(THR, Thread::active_stacktrace_offset()); | 2026 Address stacktrace_addr(THR, Thread::active_stacktrace_offset()); |
2024 __ lw(V1, stacktrace_addr); | 2027 __ lw(V1, stacktrace_addr); |
2025 | 2028 |
2026 __ jr(A0); // Jump to continuation point. | 2029 __ jr(A0); // Jump to continuation point. |
2027 __ delay_slot()->sw(A2, stacktrace_addr); | 2030 __ delay_slot()->sw(A2, stacktrace_addr); |
2028 } | 2031 } |
2029 | 2032 |
2030 | 2033 |
| 2034 // Deoptimize a frame on the call stack before rewinding. |
| 2035 // The arguments are stored in the Thread object. |
| 2036 // No result. |
| 2037 void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { |
| 2038 // Push zap value instead of CODE_REG. |
| 2039 __ LoadImmediate(TMP, kZapCodeReg); |
| 2040 __ Push(TMP); |
| 2041 |
| 2042 // Load the deopt pc into RA. |
| 2043 __ lw(RA, Address(THR, Thread::resume_pc_offset())); |
| 2044 GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
| 2045 |
| 2046 // After we have deoptimized, jump to the correct frame. |
| 2047 __ EnterStubFrame(); |
| 2048 __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0); |
| 2049 __ LeaveStubFrame(); |
| 2050 __ break_(0); |
| 2051 } |
| 2052 |
| 2053 |
2031 // Calls to the runtime to optimize the given function. | 2054 // Calls to the runtime to optimize the given function. |
2032 // T0: function to be reoptimized. | 2055 // T0: function to be reoptimized. |
2033 // S4: argument descriptor (preserved). | 2056 // S4: argument descriptor (preserved). |
2034 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 2057 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
2035 __ Comment("OptimizeFunctionStub"); | 2058 __ Comment("OptimizeFunctionStub"); |
2036 __ EnterStubFrame(); | 2059 __ EnterStubFrame(); |
2037 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 2060 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
2038 __ sw(S4, Address(SP, 2 * kWordSize)); | 2061 __ sw(S4, Address(SP, 2 * kWordSize)); |
2039 // Setup space on stack for return value. | 2062 // Setup space on stack for return value. |
2040 __ sw(ZR, Address(SP, 1 * kWordSize)); | 2063 __ sw(ZR, Address(SP, 1 * kWordSize)); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 } | 2421 } |
2399 | 2422 |
2400 | 2423 |
2401 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2424 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2402 __ break_(0); | 2425 __ break_(0); |
2403 } | 2426 } |
2404 | 2427 |
2405 } // namespace dart | 2428 } // namespace dart |
2406 | 2429 |
2407 #endif // defined TARGET_ARCH_MIPS | 2430 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |