| 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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
| 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/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| 11 #include "vm/heap.h" | 11 #include "vm/heap.h" |
| 12 #include "vm/instructions.h" |
| 12 #include "vm/memory_region.h" | 13 #include "vm/memory_region.h" |
| 13 #include "vm/runtime_entry.h" | 14 #include "vm/runtime_entry.h" |
| 14 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
| 15 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
| 16 #include "vm/verified_memory.h" | 17 #include "vm/verified_memory.h" |
| 17 | 18 |
| 18 namespace dart { | 19 namespace dart { |
| 19 | 20 |
| 20 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 21 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
| 21 DECLARE_FLAG(bool, inline_alloc); | 22 DECLARE_FLAG(bool, inline_alloc); |
| (...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 uint64_t a; | 2483 uint64_t a; |
| 2483 uint64_t b; | 2484 uint64_t b; |
| 2484 } double_abs_constant = | 2485 } double_abs_constant = |
| 2485 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; | 2486 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; |
| 2486 andpd(reg, Address::Absolute(reinterpret_cast<uword>(&double_abs_constant))); | 2487 andpd(reg, Address::Absolute(reinterpret_cast<uword>(&double_abs_constant))); |
| 2487 } | 2488 } |
| 2488 | 2489 |
| 2489 | 2490 |
| 2490 void Assembler::EnterFrame(intptr_t frame_size) { | 2491 void Assembler::EnterFrame(intptr_t frame_size) { |
| 2491 if (prologue_offset_ == -1) { | 2492 if (prologue_offset_ == -1) { |
| 2493 Comment("PrologueOffset = %" Pd "", CodeSize()); |
| 2492 prologue_offset_ = CodeSize(); | 2494 prologue_offset_ = CodeSize(); |
| 2493 } | 2495 } |
| 2496 #ifdef DEBUG |
| 2497 intptr_t check_offset = CodeSize(); |
| 2498 #endif |
| 2494 pushl(EBP); | 2499 pushl(EBP); |
| 2495 movl(EBP, ESP); | 2500 movl(EBP, ESP); |
| 2501 #ifdef DEBUG |
| 2502 ProloguePattern pp(CodeAddress(check_offset)); |
| 2503 ASSERT(pp.IsValid()); |
| 2504 #endif |
| 2496 if (frame_size != 0) { | 2505 if (frame_size != 0) { |
| 2497 Immediate frame_space(frame_size); | 2506 Immediate frame_space(frame_size); |
| 2498 subl(ESP, frame_space); | 2507 subl(ESP, frame_space); |
| 2499 } | 2508 } |
| 2500 } | 2509 } |
| 2501 | 2510 |
| 2502 | 2511 |
| 2503 void Assembler::LeaveFrame() { | 2512 void Assembler::LeaveFrame() { |
| 2504 movl(ESP, EBP); | 2513 movl(ESP, EBP); |
| 2505 popl(EBP); | 2514 popl(EBP); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2785 } | 2794 } |
| 2786 | 2795 |
| 2787 | 2796 |
| 2788 // On entry to a function compiled for OSR, the caller's frame pointer, the | 2797 // On entry to a function compiled for OSR, the caller's frame pointer, the |
| 2789 // stack locals, and any copied parameters are already in place. The frame | 2798 // stack locals, and any copied parameters are already in place. The frame |
| 2790 // pointer is already set up. The PC marker is not correct for the | 2799 // pointer is already set up. The PC marker is not correct for the |
| 2791 // optimized function and there may be extra space for spill slots to | 2800 // optimized function and there may be extra space for spill slots to |
| 2792 // allocate. | 2801 // allocate. |
| 2793 void Assembler::EnterOsrFrame(intptr_t extra_size) { | 2802 void Assembler::EnterOsrFrame(intptr_t extra_size) { |
| 2794 Comment("EnterOsrFrame"); | 2803 Comment("EnterOsrFrame"); |
| 2804 if (prologue_offset_ == -1) { |
| 2805 Comment("PrologueOffset = %" Pd "", CodeSize()); |
| 2806 prologue_offset_ = CodeSize(); |
| 2807 } |
| 2795 Label dart_entry; | 2808 Label dart_entry; |
| 2796 call(&dart_entry); | 2809 call(&dart_entry); |
| 2797 Bind(&dart_entry); | 2810 Bind(&dart_entry); |
| 2798 // The runtime system assumes that the code marker address is | 2811 // The runtime system assumes that the code marker address is |
| 2799 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no | 2812 // kEntryPointToPcMarkerOffset bytes from the entry. Since there is no |
| 2800 // code to set up the frame pointer, the address needs to be adjusted. | 2813 // code to set up the frame pointer, the address needs to be adjusted. |
| 2801 const intptr_t offset = EntryPointToPcMarkerOffset() - CodeSize(); | 2814 const intptr_t offset = EntryPointToPcMarkerOffset() - CodeSize(); |
| 2802 if (offset != 0) { | 2815 if (offset != 0) { |
| 2803 addl(Address(ESP, 0), Immediate(offset)); | 2816 addl(Address(ESP, 0), Immediate(offset)); |
| 2804 } | 2817 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3105 | 3118 |
| 3106 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3119 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3107 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3120 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 3108 return xmm_reg_names[reg]; | 3121 return xmm_reg_names[reg]; |
| 3109 } | 3122 } |
| 3110 | 3123 |
| 3111 | 3124 |
| 3112 } // namespace dart | 3125 } // namespace dart |
| 3113 | 3126 |
| 3114 #endif // defined TARGET_ARCH_IA32 | 3127 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |