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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 | 2548 |
2549 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2549 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2550 __ Bind(compiler->GetJumpLabel(this)); | 2550 __ Bind(compiler->GetJumpLabel(this)); |
2551 compiler->AddExceptionHandler(catch_try_index(), | 2551 compiler->AddExceptionHandler(catch_try_index(), |
2552 try_index(), | 2552 try_index(), |
2553 compiler->assembler()->CodeSize(), | 2553 compiler->assembler()->CodeSize(), |
2554 catch_handler_types_, | 2554 catch_handler_types_, |
2555 needs_stacktrace()); | 2555 needs_stacktrace()); |
2556 | 2556 |
2557 // Restore the pool pointer. | 2557 // Restore the pool pointer. |
2558 __ RestoreCodePointer(); | 2558 __ LoadPoolPointer(); |
2559 __ LoadPoolPointer(PP); | |
2560 | 2559 |
2561 if (HasParallelMove()) { | 2560 if (HasParallelMove()) { |
2562 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2561 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2563 } | 2562 } |
2564 | 2563 |
2565 // Restore RSP from RBP as we are coming from a throw and the code for | 2564 // Restore RSP from RBP as we are coming from a throw and the code for |
2566 // popping arguments has not been run. | 2565 // popping arguments has not been run. |
2567 const intptr_t fp_sp_dist = | 2566 const intptr_t fp_sp_dist = |
2568 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2567 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
2569 ASSERT(fp_sp_dist <= 0); | 2568 ASSERT(fp_sp_dist <= 0); |
(...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6215 | 6214 |
6216 summary->set_in(0, Location::RequiresRegister()); | 6215 summary->set_in(0, Location::RequiresRegister()); |
6217 summary->set_temp(0, Location::RequiresRegister()); | 6216 summary->set_temp(0, Location::RequiresRegister()); |
6218 | 6217 |
6219 return summary; | 6218 return summary; |
6220 } | 6219 } |
6221 | 6220 |
6222 | 6221 |
6223 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6222 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6224 Register offset_reg = locs()->in(0).reg(); | 6223 Register offset_reg = locs()->in(0).reg(); |
6225 Register target_address_reg = locs()->temp(0).reg(); | 6224 Register target_address_reg = locs()->temp_slot(0)->reg(); |
6226 | |
6227 { | |
6228 const intptr_t kRIPRelativeLeaqSize = 7; | |
6229 const intptr_t entry_to_rip_offset = | |
6230 __ CodeSize() + kRIPRelativeLeaqSize; | |
6231 __ leaq(target_address_reg, | |
6232 Address::AddressRIPRelative(-entry_to_rip_offset)); | |
6233 ASSERT(__ CodeSize() == entry_to_rip_offset); | |
6234 } | |
6235 | 6225 |
6236 // Load from [current frame pointer] + kPcMarkerSlotFromFp. | 6226 // Load from [current frame pointer] + kPcMarkerSlotFromFp. |
| 6227 __ movq(target_address_reg, Address(RBP, kPcMarkerSlotFromFp * kWordSize)); |
6237 | 6228 |
6238 // Calculate the final absolute address. | 6229 // Calculate the final absolute address. |
6239 if (offset()->definition()->representation() == kTagged) { | 6230 if (offset()->definition()->representation() == kTagged) { |
6240 __ SmiUntag(offset_reg); | 6231 __ SmiUntag(offset_reg); |
6241 } | 6232 } |
6242 __ addq(target_address_reg, offset_reg); | 6233 __ addq(target_address_reg, offset_reg); |
6243 | 6234 |
6244 // Jump to the absolute address. | 6235 // Jump to the absolute address. |
6245 __ jmp(target_address_reg); | 6236 __ jmp(target_address_reg); |
6246 } | 6237 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6345 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6336 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6346 // Arguments descriptor is expected in R10. | 6337 // Arguments descriptor is expected in R10. |
6347 intptr_t argument_count = ArgumentCount(); | 6338 intptr_t argument_count = ArgumentCount(); |
6348 const Array& arguments_descriptor = | 6339 const Array& arguments_descriptor = |
6349 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 6340 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
6350 argument_names())); | 6341 argument_names())); |
6351 __ LoadObject(R10, arguments_descriptor); | 6342 __ LoadObject(R10, arguments_descriptor); |
6352 | 6343 |
6353 // Function in RAX. | 6344 // Function in RAX. |
6354 ASSERT(locs()->in(0).reg() == RAX); | 6345 ASSERT(locs()->in(0).reg() == RAX); |
6355 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | |
6356 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); | 6346 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); |
6357 | 6347 |
6358 // RAX: Function. | 6348 // RAX: Function. |
6359 // R10: Arguments descriptor array. | 6349 // R10: Arguments descriptor array. |
6360 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 6350 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
6361 __ xorq(RBX, RBX); | 6351 __ xorq(RBX, RBX); |
6362 __ call(RCX); | 6352 __ call(RCX); |
6363 compiler->RecordSafepoint(locs()); | 6353 compiler->RecordSafepoint(locs()); |
6364 // Marks either the continuation point in unoptimized code or the | 6354 // Marks either the continuation point in unoptimized code or the |
6365 // deoptimization point in optimized code, after call. | 6355 // deoptimization point in optimized code, after call. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6451 __ Drop(1); | 6441 __ Drop(1); |
6452 __ popq(result); | 6442 __ popq(result); |
6453 } | 6443 } |
6454 | 6444 |
6455 | 6445 |
6456 } // namespace dart | 6446 } // namespace dart |
6457 | 6447 |
6458 #undef __ | 6448 #undef __ |
6459 | 6449 |
6460 #endif // defined TARGET_ARCH_X64 | 6450 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |