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/compiler.h" | 10 #include "vm/compiler.h" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph.h" | 12 #include "vm/flow_graph.h" |
13 #include "vm/flow_graph_compiler.h" | 13 #include "vm/flow_graph_compiler.h" |
14 #include "vm/flow_graph_range_analysis.h" | 14 #include "vm/flow_graph_range_analysis.h" |
15 #include "vm/instructions.h" | |
15 #include "vm/locations.h" | 16 #include "vm/locations.h" |
16 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
17 #include "vm/parser.h" | 18 #include "vm/parser.h" |
18 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
19 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
21 | 22 |
22 #define __ compiler->assembler()-> | 23 #define __ compiler->assembler()-> |
23 #define Z (compiler->zone()) | 24 #define Z (compiler->zone()) |
24 | 25 |
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2556 | 2557 |
2557 | 2558 |
2558 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, | 2559 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
2559 bool opt) const { | 2560 bool opt) const { |
2560 UNREACHABLE(); | 2561 UNREACHABLE(); |
2561 return NULL; | 2562 return NULL; |
2562 } | 2563 } |
2563 | 2564 |
2564 | 2565 |
2565 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2566 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2567 // Ensure space for patching return sites for lazy deopt. | |
2568 __ nop(ShortCallPattern::pattern_length_in_bytes()); | |
2569 | |
2566 __ Bind(compiler->GetJumpLabel(this)); | 2570 __ Bind(compiler->GetJumpLabel(this)); |
2567 compiler->AddExceptionHandler(catch_try_index(), | 2571 compiler->AddExceptionHandler(catch_try_index(), |
2568 try_index(), | 2572 try_index(), |
2569 compiler->assembler()->CodeSize(), | 2573 compiler->assembler()->CodeSize(), |
2570 catch_handler_types_, | 2574 catch_handler_types_, |
2571 needs_stacktrace()); | 2575 needs_stacktrace()); |
2572 | 2576 // On lazy deoptimization we patch the optimized code here to enter the |
2573 // Restore the pool pointer. | 2577 // deoptimization stub. |
2574 __ RestoreCodePointer(); | 2578 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); |
2575 __ LoadPoolPointer(PP); | 2579 if (compiler->is_optimizing()) { |
Florian Schneider
2016/09/23 19:53:34
This now happens in the JumpToExceptionHandler stu
| |
2576 | 2580 compiler->AddDeoptIndexAtCall(deopt_id); |
2581 } else { | |
2582 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | |
2583 deopt_id, | |
2584 TokenPosition::kNoSource); | |
2585 } | |
2577 if (HasParallelMove()) { | 2586 if (HasParallelMove()) { |
2578 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2587 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
2579 } | 2588 } |
2580 | 2589 |
2581 // Restore RSP from RBP as we are coming from a throw and the code for | 2590 // Restore RSP from RBP as we are coming from a throw and the code for |
2582 // popping arguments has not been run. | 2591 // popping arguments has not been run. |
2583 const intptr_t fp_sp_dist = | 2592 const intptr_t fp_sp_dist = |
2584 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2593 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
2585 ASSERT(fp_sp_dist <= 0); | 2594 ASSERT(fp_sp_dist <= 0); |
2586 __ leaq(RSP, Address(RBP, fp_sp_dist)); | 2595 __ leaq(RSP, Address(RBP, fp_sp_dist)); |
(...skipping 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6500 // RAX: Function. | 6509 // RAX: Function. |
6501 // R10: Arguments descriptor array. | 6510 // R10: Arguments descriptor array. |
6502 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 6511 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
6503 __ xorq(RBX, RBX); | 6512 __ xorq(RBX, RBX); |
6504 __ call(RCX); | 6513 __ call(RCX); |
6505 compiler->RecordSafepoint(locs()); | 6514 compiler->RecordSafepoint(locs()); |
6506 // Marks either the continuation point in unoptimized code or the | 6515 // Marks either the continuation point in unoptimized code or the |
6507 // deoptimization point in optimized code, after call. | 6516 // deoptimization point in optimized code, after call. |
6508 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 6517 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
6509 if (compiler->is_optimizing()) { | 6518 if (compiler->is_optimizing()) { |
6510 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 6519 compiler->AddDeoptIndexAtCall(deopt_id_after); |
6511 } | 6520 } |
6512 // Add deoptimization continuation point after the call and before the | 6521 // Add deoptimization continuation point after the call and before the |
6513 // arguments are removed. | 6522 // arguments are removed. |
6514 // In optimized code this descriptor is needed for exception handling. | 6523 // In optimized code this descriptor is needed for exception handling. |
6515 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 6524 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
6516 deopt_id_after, | 6525 deopt_id_after, |
6517 token_pos()); | 6526 token_pos()); |
6518 __ Drop(argument_count); | 6527 __ Drop(argument_count); |
6519 } | 6528 } |
6520 | 6529 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6593 __ Drop(1); | 6602 __ Drop(1); |
6594 __ popq(result); | 6603 __ popq(result); |
6595 } | 6604 } |
6596 | 6605 |
6597 | 6606 |
6598 } // namespace dart | 6607 } // namespace dart |
6599 | 6608 |
6600 #undef __ | 6609 #undef __ |
6601 | 6610 |
6602 #endif // defined TARGET_ARCH_X64 | 6611 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |