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