| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 // +------------------+ | 579 // +------------------+ |
| 580 // | 0 as PC marker | <- TOS | 580 // | 0 as PC marker | <- TOS |
| 581 // +------------------+ | 581 // +------------------+ |
| 582 // | Saved FP | | 582 // | Saved FP | |
| 583 // +------------------+ | 583 // +------------------+ |
| 584 // | return-address | (deoptimization point) | 584 // | return-address | (deoptimization point) |
| 585 // +------------------+ | 585 // +------------------+ |
| 586 // | optimized frame | | 586 // | optimized frame | |
| 587 // | ... | | 587 // | ... | |
| 588 // | 588 // |
| 589 // EAX: Deoptimization reason id. | |
| 590 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 589 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
| 591 __ EnterFrame(0); | 590 __ EnterFrame(0); |
| 592 // Push registers in their enumeration order: lowest register number at | 591 // Push registers in their enumeration order: lowest register number at |
| 593 // lowest address. | 592 // lowest address. |
| 594 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { | 593 for (intptr_t i = kNumberOfCpuRegisters - 1; i >= 0; i--) { |
| 595 __ pushl(static_cast<Register>(i)); | 594 __ pushl(static_cast<Register>(i)); |
| 596 } | 595 } |
| 597 __ movl(ECX, ESP); // Saved saved registers block. | 596 __ movl(ECX, ESP); // Saved saved registers block. |
| 598 __ ReserveAlignedFrameSpace(2 * kWordSize); | 597 __ ReserveAlignedFrameSpace(1 * kWordSize); |
| 599 __ SmiUntag(EAX); | 598 __ SmiUntag(EAX); |
| 600 __ movl(Address(ESP, 0), EAX); // Deopt reason (untagged). | 599 __ movl(Address(ESP, 0), ECX); // Start of register block. |
| 601 __ movl(Address(ESP, kWordSize), ECX); // Start of register block. | |
| 602 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); | 600 __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry); |
| 603 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address. | 601 // Result (EAX) is stack-size (FP - SP) in bytes, incl. the return address. |
| 604 __ LeaveFrame(); | 602 __ LeaveFrame(); |
| 605 __ popl(EDX); // Discard return address. | 603 __ popl(EDX); // Discard return address. |
| 606 __ movl(ESP, EBP); | 604 __ movl(ESP, EBP); |
| 607 __ subl(ESP, EAX); | 605 __ subl(ESP, EAX); |
| 608 | 606 |
| 609 __ EnterFrame(0); | 607 __ EnterFrame(0); |
| 610 __ movl(ECX, ESP); // Get last FP address. | 608 __ movl(ECX, ESP); // Get last FP address. |
| 611 __ ReserveAlignedFrameSpace(1 * kWordSize); | 609 __ ReserveAlignedFrameSpace(1 * kWordSize); |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. | 1972 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. |
| 1975 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. | 1973 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. |
| 1976 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. | 1974 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. |
| 1977 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. | 1975 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. |
| 1978 __ jmp(EBX); // Jump to the exception handler code. | 1976 __ jmp(EBX); // Jump to the exception handler code. |
| 1979 } | 1977 } |
| 1980 | 1978 |
| 1981 } // namespace dart | 1979 } // namespace dart |
| 1982 | 1980 |
| 1983 #endif // defined TARGET_ARCH_IA32 | 1981 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |