OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 __ SmiUntag(R2); | 551 __ SmiUntag(R2); |
552 if (kind == kLazyDeoptFromReturn) { | 552 if (kind == kLazyDeoptFromReturn) { |
553 __ Pop(R0); // Restore result. | 553 __ Pop(R0); // Restore result. |
554 } else if (kind == kLazyDeoptFromThrow) { | 554 } else if (kind == kLazyDeoptFromThrow) { |
555 __ Pop(R1); // Restore stacktrace. | 555 __ Pop(R1); // Restore stacktrace. |
556 __ Pop(R0); // Restore exception. | 556 __ Pop(R0); // Restore exception. |
557 } | 557 } |
558 __ LeaveStubFrame(); | 558 __ LeaveStubFrame(); |
559 // Remove materialization arguments. | 559 // Remove materialization arguments. |
560 __ add(SP, SP, Operand(R2)); | 560 __ add(SP, SP, Operand(R2)); |
561 // The caller is responsible for emitting the return instruction. | 561 __ ret(); |
562 } | 562 } |
563 | 563 |
564 | 564 |
565 // R0: result, must be preserved | 565 // R0: result, must be preserved |
566 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { | 566 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
567 // Push zap value instead of CODE_REG for lazy deopt. | 567 // Push zap value instead of CODE_REG for lazy deopt. |
568 __ LoadImmediate(TMP, kZapCodeReg); | 568 __ LoadImmediate(TMP, 0xf1f1f1f1); |
569 __ Push(TMP); | 569 __ Push(TMP); |
570 // Return address for "call" to deopt stub. | 570 // Return address for "call" to deopt stub. |
571 __ LoadImmediate(LR, kZapReturnAddress); | 571 __ LoadImmediate(LR, 0xe1e1e1e1); |
572 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); | 572 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); |
573 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); | 573 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
574 __ ret(); | |
575 } | 574 } |
576 | 575 |
577 | 576 |
578 // R0: exception, must be preserved | 577 // R0: exception, must be preserved |
579 // R1: stacktrace, must be preserved | 578 // R1: stacktrace, must be preserved |
580 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { | 579 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { |
581 // Push zap value instead of CODE_REG for lazy deopt. | 580 // Push zap value instead of CODE_REG for lazy deopt. |
582 __ LoadImmediate(TMP, kZapCodeReg); | 581 __ LoadImmediate(TMP, 0xf1f1f1f1); |
583 __ Push(TMP); | 582 __ Push(TMP); |
584 // Return address for "call" to deopt stub. | 583 // Return address for "call" to deopt stub. |
585 __ LoadImmediate(LR, kZapReturnAddress); | 584 __ LoadImmediate(LR, 0xe1e1e1e1); |
586 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); | 585 __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); |
587 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); | 586 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
588 __ ret(); | |
589 } | 587 } |
590 | 588 |
591 | 589 |
592 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 590 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
593 GenerateDeoptimizationSequence(assembler, kEagerDeopt); | 591 GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
594 __ ret(); | |
595 } | 592 } |
596 | 593 |
597 | 594 |
598 static void GenerateDispatcherCode(Assembler* assembler, | 595 static void GenerateDispatcherCode(Assembler* assembler, |
599 Label* call_target_function) { | 596 Label* call_target_function) { |
600 __ Comment("NoSuchMethodDispatch"); | 597 __ Comment("NoSuchMethodDispatch"); |
601 // When lazily generated invocation dispatchers are disabled, the | 598 // When lazily generated invocation dispatchers are disabled, the |
602 // miss-handler may return null. | 599 // miss-handler may return null. |
603 __ CompareObject(R0, Object::null_object()); | 600 __ CompareObject(R0, Object::null_object()); |
604 __ b(call_target_function, NE); | 601 __ b(call_target_function, NE); |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 __ StoreToOffset(R2, THR, Thread::active_exception_offset()); | 1942 __ StoreToOffset(R2, THR, Thread::active_exception_offset()); |
1946 | 1943 |
1947 // Stacktrace object. | 1944 // Stacktrace object. |
1948 __ LoadFromOffset(R1, THR, Thread::active_stacktrace_offset()); | 1945 __ LoadFromOffset(R1, THR, Thread::active_stacktrace_offset()); |
1949 __ StoreToOffset(R2, THR, Thread::active_stacktrace_offset()); | 1946 __ StoreToOffset(R2, THR, Thread::active_stacktrace_offset()); |
1950 | 1947 |
1951 __ ret(); // Jump to the exception handler code. | 1948 __ ret(); // Jump to the exception handler code. |
1952 } | 1949 } |
1953 | 1950 |
1954 | 1951 |
1955 // Deoptimize a frame on the call stack before rewinding. | |
1956 // The arguments are stored in the Thread object. | |
1957 // No result. | |
1958 void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { | |
1959 // Push zap value instead of CODE_REG. | |
1960 __ LoadImmediate(TMP, kZapCodeReg); | |
1961 __ Push(TMP); | |
1962 | |
1963 // Load the deopt pc into LR. | |
1964 __ LoadFromOffset(LR, THR, Thread::resume_pc_offset()); | |
1965 GenerateDeoptimizationSequence(assembler, kEagerDeopt); | |
1966 | |
1967 // After we have deoptimized, jump to the correct frame. | |
1968 __ EnterStubFrame(); | |
1969 __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0); | |
1970 __ LeaveStubFrame(); | |
1971 __ brk(0); | |
1972 } | |
1973 | |
1974 | |
1975 // Calls to the runtime to optimize the given function. | 1952 // Calls to the runtime to optimize the given function. |
1976 // R6: function to be re-optimized. | 1953 // R6: function to be re-optimized. |
1977 // R4: argument descriptor (preserved). | 1954 // R4: argument descriptor (preserved). |
1978 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1955 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
1979 __ EnterStubFrame(); | 1956 __ EnterStubFrame(); |
1980 __ Push(R4); | 1957 __ Push(R4); |
1981 // Setup space on stack for the return value. | 1958 // Setup space on stack for the return value. |
1982 __ Push(ZR); | 1959 __ Push(ZR); |
1983 __ Push(R6); | 1960 __ Push(R6); |
1984 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); | 1961 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 } | 2314 } |
2338 | 2315 |
2339 | 2316 |
2340 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2317 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2341 __ brk(0); | 2318 __ brk(0); |
2342 } | 2319 } |
2343 | 2320 |
2344 } // namespace dart | 2321 } // namespace dart |
2345 | 2322 |
2346 #endif // defined TARGET_ARCH_ARM64 | 2323 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |