| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 | 2541 |
| 2541 | 2542 |
| 2542 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, | 2543 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
| 2543 bool opt) const { | 2544 bool opt) const { |
| 2544 UNREACHABLE(); | 2545 UNREACHABLE(); |
| 2545 return NULL; | 2546 return NULL; |
| 2546 } | 2547 } |
| 2547 | 2548 |
| 2548 | 2549 |
| 2549 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2550 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2551 // Ensure space for patching return sites for lazy deopt. |
| 2552 if (!FLAG_precompiled_mode && compiler->is_optimizing()) { |
| 2553 __ nop(CallPattern::pattern_length_in_bytes()); |
| 2554 } |
| 2550 __ Bind(compiler->GetJumpLabel(this)); | 2555 __ Bind(compiler->GetJumpLabel(this)); |
| 2551 compiler->AddExceptionHandler(catch_try_index(), | 2556 compiler->AddExceptionHandler(catch_try_index(), |
| 2552 try_index(), | 2557 try_index(), |
| 2553 compiler->assembler()->CodeSize(), | 2558 compiler->assembler()->CodeSize(), |
| 2554 catch_handler_types_, | 2559 catch_handler_types_, |
| 2555 needs_stacktrace()); | 2560 needs_stacktrace()); |
| 2561 // On lazy deoptimization we patch the optimized code here to enter the |
| 2562 // deoptimization stub. |
| 2563 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); |
| 2564 if (compiler->is_optimizing()) { |
| 2565 compiler->AddDeoptIndexAtCall(deopt_id); |
| 2566 } else { |
| 2567 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2568 deopt_id, |
| 2569 TokenPosition::kNoSource); |
| 2570 } |
| 2556 if (HasParallelMove()) { | 2571 if (HasParallelMove()) { |
| 2557 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2572 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2558 } | 2573 } |
| 2559 | 2574 |
| 2560 // Restore ESP from EBP as we are coming from a throw and the code for | 2575 // Restore ESP from EBP as we are coming from a throw and the code for |
| 2561 // popping arguments has not been run. | 2576 // popping arguments has not been run. |
| 2562 const intptr_t fp_sp_dist = | 2577 const intptr_t fp_sp_dist = |
| 2563 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2578 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 2564 ASSERT(fp_sp_dist <= 0); | 2579 ASSERT(fp_sp_dist <= 0); |
| 2565 __ leal(ESP, Address(EBP, fp_sp_dist)); | 2580 __ leal(ESP, Address(EBP, fp_sp_dist)); |
| (...skipping 4211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6777 // EAX: Function. | 6792 // EAX: Function. |
| 6778 // EDX: Arguments descriptor array. | 6793 // EDX: Arguments descriptor array. |
| 6779 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 6794 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
| 6780 __ xorl(ECX, ECX); | 6795 __ xorl(ECX, ECX); |
| 6781 __ call(EBX); | 6796 __ call(EBX); |
| 6782 compiler->RecordSafepoint(locs()); | 6797 compiler->RecordSafepoint(locs()); |
| 6783 // Marks either the continuation point in unoptimized code or the | 6798 // Marks either the continuation point in unoptimized code or the |
| 6784 // deoptimization point in optimized code, after call. | 6799 // deoptimization point in optimized code, after call. |
| 6785 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 6800 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
| 6786 if (compiler->is_optimizing()) { | 6801 if (compiler->is_optimizing()) { |
| 6787 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 6802 compiler->AddDeoptIndexAtCall(deopt_id_after); |
| 6788 } | 6803 } |
| 6789 // Add deoptimization continuation point after the call and before the | 6804 // Add deoptimization continuation point after the call and before the |
| 6790 // arguments are removed. | 6805 // arguments are removed. |
| 6791 // In optimized code this descriptor is needed for exception handling. | 6806 // In optimized code this descriptor is needed for exception handling. |
| 6792 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 6807 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 6793 deopt_id_after, | 6808 deopt_id_after, |
| 6794 token_pos()); | 6809 token_pos()); |
| 6795 __ Drop(argument_count); | 6810 __ Drop(argument_count); |
| 6796 } | 6811 } |
| 6797 | 6812 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6871 __ Drop(1); | 6886 __ Drop(1); |
| 6872 __ popl(result); | 6887 __ popl(result); |
| 6873 } | 6888 } |
| 6874 | 6889 |
| 6875 | 6890 |
| 6876 } // namespace dart | 6891 } // namespace dart |
| 6877 | 6892 |
| 6878 #undef __ | 6893 #undef __ |
| 6879 | 6894 |
| 6880 #endif // defined TARGET_ARCH_IA32 | 6895 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |