| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 // +------------------+ | 572 // +------------------+ |
| 573 // | 0 as PC marker | <- TOS | 573 // | 0 as PC marker | <- TOS |
| 574 // +------------------+ | 574 // +------------------+ |
| 575 // | Saved FP | | 575 // | Saved FP | |
| 576 // +------------------+ | 576 // +------------------+ |
| 577 // | return-address | (deoptimization point) | 577 // | return-address | (deoptimization point) |
| 578 // +------------------+ | 578 // +------------------+ |
| 579 // | optimized frame | | 579 // | optimized frame | |
| 580 // | ... | | 580 // | ... | |
| 581 // | 581 // |
| 582 // RAX: Deoptimization reason id. | |
| 583 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 582 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
| 584 __ EnterFrame(0); | 583 __ EnterFrame(0); |
| 585 // Push registers in their enumeration order: lowest register number at | 584 // Push registers in their enumeration order: lowest register number at |
| 586 // lowest address. | 585 // lowest address. |
| 587 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { | 586 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { |
| 588 __ pushq(static_cast<Register>(i)); | 587 __ pushq(static_cast<Register>(i)); |
| 589 } | 588 } |
| 590 __ movq(RCX, RSP); // Saved saved registers block. | 589 __ movq(RCX, RSP); // Saved saved registers block. |
| 591 __ ReserveAlignedFrameSpace(0); | 590 __ ReserveAlignedFrameSpace(0); |
| 592 __ SmiUntag(RAX); | 591 __ SmiUntag(RAX); |
| 593 __ movq(RDI, RAX); // Set up argument 1 deopt_reason. | 592 __ movq(RDI, RCX); // Set up argument 1 saved_registers_address. |
| 594 __ movq(RSI, RCX); // Set up argument 2 saved_registers_address. | |
| 595 | 593 |
| 596 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); | 594 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); |
| 597 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address. | 595 // Result (RAX) is stack-size (FP - SP) in bytes, incl. the return address. |
| 598 __ LeaveFrame(); | 596 __ LeaveFrame(); |
| 599 __ popq(RCX); // Discard return address. | 597 __ popq(RCX); // Discard return address. |
| 600 __ movq(RSP, RBP); | 598 __ movq(RSP, RBP); |
| 601 __ subq(RSP, RAX); | 599 __ subq(RSP, RAX); |
| 602 | 600 |
| 603 __ EnterFrame(0); | 601 __ EnterFrame(0); |
| 604 __ movq(RCX, RSP); // Get last FP address. | 602 __ movq(RCX, RSP); // Get last FP address. |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { | 1932 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { |
| 1935 __ movq(RAX, RCX); // error object. | 1933 __ movq(RAX, RCX); // error object. |
| 1936 __ movq(RBP, RDX); // target frame_pointer. | 1934 __ movq(RBP, RDX); // target frame_pointer. |
| 1937 __ movq(RSP, RSI); // target stack_pointer. | 1935 __ movq(RSP, RSI); // target stack_pointer. |
| 1938 __ jmp(RDI); // Jump to the exception handler code. | 1936 __ jmp(RDI); // Jump to the exception handler code. |
| 1939 } | 1937 } |
| 1940 | 1938 |
| 1941 } // namespace dart | 1939 } // namespace dart |
| 1942 | 1940 |
| 1943 #endif // defined TARGET_ARCH_X64 | 1941 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |