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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 3406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3417 const intptr_t entry_to_rip_offset = CodeSize() + kRIPRelativeMovqSize; | 3417 const intptr_t entry_to_rip_offset = CodeSize() + kRIPRelativeMovqSize; |
3418 const intptr_t object_pool_pc_dist = | 3418 const intptr_t object_pool_pc_dist = |
3419 Instructions::HeaderSize() - Instructions::object_pool_offset(); | 3419 Instructions::HeaderSize() - Instructions::object_pool_offset(); |
3420 movq(pp, Address::AddressRIPRelative( | 3420 movq(pp, Address::AddressRIPRelative( |
3421 -entry_to_rip_offset - object_pool_pc_dist)); | 3421 -entry_to_rip_offset - object_pool_pc_dist)); |
3422 ASSERT(CodeSize() == entry_to_rip_offset); | 3422 ASSERT(CodeSize() == entry_to_rip_offset); |
3423 set_constant_pool_allowed(pp == PP); | 3423 set_constant_pool_allowed(pp == PP); |
3424 } | 3424 } |
3425 | 3425 |
3426 | 3426 |
3427 void Assembler::EnterDartFrameWithInfo(intptr_t frame_size, | 3427 void Assembler::EnterDartFrame(intptr_t frame_size, |
3428 Register new_pp, | 3428 Register new_pp, |
3429 Register pc_marker_override) { | 3429 Register pc_marker_override) { |
3430 ASSERT(!constant_pool_allowed()); | 3430 ASSERT(!constant_pool_allowed()); |
3431 EnterFrame(0); | 3431 EnterFrame(0); |
3432 pushq(pc_marker_override); | 3432 pushq(pc_marker_override); |
3433 pushq(PP); | 3433 pushq(PP); |
3434 movq(PP, new_pp); | 3434 movq(PP, new_pp); |
3435 set_constant_pool_allowed(true); | 3435 set_constant_pool_allowed(true); |
3436 if (frame_size != 0) { | 3436 if (frame_size != 0) { |
3437 subq(RSP, Immediate(frame_size)); | 3437 subq(RSP, Immediate(frame_size)); |
3438 } | 3438 } |
3439 } | 3439 } |
3440 | 3440 |
3441 | 3441 |
3442 void Assembler::LeaveDartFrame() { | 3442 void Assembler::LeaveDartFrame() { |
3443 // LeaveDartFrame is called from stubs (pp disallowed) and from Dart code (pp | |
3444 // allowed), so there is no point in checking the current value of | |
3445 // constant_pool_allowed(). | |
3446 set_constant_pool_allowed(false); | 3443 set_constant_pool_allowed(false); |
3447 // Restore caller's PP register that was pushed in EnterDartFrame. | 3444 // Restore caller's PP register that was pushed in EnterDartFrame. |
3448 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); | 3445 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); |
3449 LeaveFrame(); | 3446 LeaveFrame(); |
3450 } | 3447 } |
3451 | 3448 |
3452 | 3449 |
3453 // On entry to a function compiled for OSR, the caller's frame pointer, the | 3450 // On entry to a function compiled for OSR, the caller's frame pointer, the |
3454 // stack locals, and any copied parameters are already in place. The frame | 3451 // stack locals, and any copied parameters are already in place. The frame |
3455 // pointer is already set up. The PC marker is not correct for the | 3452 // pointer is already set up. The PC marker is not correct for the |
(...skipping 19 matching lines...) Expand all Loading... |
3475 void Assembler::EnterStubFrame() { | 3472 void Assembler::EnterStubFrame() { |
3476 set_constant_pool_allowed(false); | 3473 set_constant_pool_allowed(false); |
3477 EnterFrame(0); | 3474 EnterFrame(0); |
3478 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 3475 pushq(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
3479 pushq(PP); // Save caller's pool pointer | 3476 pushq(PP); // Save caller's pool pointer |
3480 LoadPoolPointer(); | 3477 LoadPoolPointer(); |
3481 } | 3478 } |
3482 | 3479 |
3483 | 3480 |
3484 void Assembler::LeaveStubFrame() { | 3481 void Assembler::LeaveStubFrame() { |
3485 set_constant_pool_allowed(false); | 3482 LeaveDartFrame(); |
3486 // Restore caller's PP register that was pushed in EnterStubFrame. | |
3487 movq(PP, Address(RBP, (kSavedCallerPpSlotFromFp * kWordSize))); | |
3488 LeaveFrame(); | |
3489 } | 3483 } |
3490 | 3484 |
3491 | 3485 |
3492 void Assembler::MaybeTraceAllocation(intptr_t cid, | 3486 void Assembler::MaybeTraceAllocation(intptr_t cid, |
3493 Label* trace, | 3487 Label* trace, |
3494 bool near_jump, | 3488 bool near_jump, |
3495 bool inline_isolate) { | 3489 bool inline_isolate) { |
3496 ASSERT(cid > 0); | 3490 ASSERT(cid > 0); |
3497 intptr_t state_offset = ClassTable::StateOffsetFor(cid); | 3491 intptr_t state_offset = ClassTable::StateOffsetFor(cid); |
3498 Register temp_reg = TMP; | 3492 Register temp_reg = TMP; |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3980 | 3974 |
3981 | 3975 |
3982 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3976 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3983 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3977 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3984 return xmm_reg_names[reg]; | 3978 return xmm_reg_names[reg]; |
3985 } | 3979 } |
3986 | 3980 |
3987 } // namespace dart | 3981 } // namespace dart |
3988 | 3982 |
3989 #endif // defined TARGET_ARCH_X64 | 3983 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |