| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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/simulator.h" | 19 #include "vm/simulator.h" |
| 19 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 20 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 22 | 23 |
| 23 #define __ compiler->assembler()-> | 24 #define __ compiler->assembler()-> |
| 24 #define Z (compiler->zone()) | 25 #define Z (compiler->zone()) |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 ASSERT(locs()->in(0).reg() == T0); | 272 ASSERT(locs()->in(0).reg() == T0); |
| 272 __ LoadImmediate(S5, 0); | 273 __ LoadImmediate(S5, 0); |
| 273 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); | 274 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); |
| 274 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset())); | 275 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset())); |
| 275 __ jalr(T2); | 276 __ jalr(T2); |
| 276 compiler->RecordSafepoint(locs()); | 277 compiler->RecordSafepoint(locs()); |
| 277 // Marks either the continuation point in unoptimized code or the | 278 // Marks either the continuation point in unoptimized code or the |
| 278 // deoptimization point in optimized code, after call. | 279 // deoptimization point in optimized code, after call. |
| 279 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 280 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
| 280 if (compiler->is_optimizing()) { | 281 if (compiler->is_optimizing()) { |
| 281 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 282 compiler->AddDeoptIndexAtCall(deopt_id_after); |
| 282 } | 283 } |
| 283 // Add deoptimization continuation point after the call and before the | 284 // Add deoptimization continuation point after the call and before the |
| 284 // arguments are removed. | 285 // arguments are removed. |
| 285 // In optimized code this descriptor is needed for exception handling. | 286 // In optimized code this descriptor is needed for exception handling. |
| 286 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 287 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 287 deopt_id_after, | 288 deopt_id_after, |
| 288 token_pos()); | 289 token_pos()); |
| 289 __ Drop(argument_count); | 290 __ Drop(argument_count); |
| 290 } | 291 } |
| 291 | 292 |
| (...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2660 | 2661 |
| 2661 | 2662 |
| 2662 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, | 2663 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
| 2663 bool opt) const { | 2664 bool opt) const { |
| 2664 UNREACHABLE(); | 2665 UNREACHABLE(); |
| 2665 return NULL; | 2666 return NULL; |
| 2666 } | 2667 } |
| 2667 | 2668 |
| 2668 | 2669 |
| 2669 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2670 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2671 // Ensure space for patching return sites for lazy deopt. |
| 2672 if (!FLAG_precompiled_mode && compiler->is_optimizing()) { |
| 2673 for (intptr_t i = 0; |
| 2674 i < CallPattern::kDeoptCallLengthInInstructions; |
| 2675 ++i) { |
| 2676 __ nop(); |
| 2677 } |
| 2678 } |
| 2670 __ Bind(compiler->GetJumpLabel(this)); | 2679 __ Bind(compiler->GetJumpLabel(this)); |
| 2671 compiler->AddExceptionHandler(catch_try_index(), | 2680 compiler->AddExceptionHandler(catch_try_index(), |
| 2672 try_index(), | 2681 try_index(), |
| 2673 compiler->assembler()->CodeSize(), | 2682 compiler->assembler()->CodeSize(), |
| 2674 catch_handler_types_, | 2683 catch_handler_types_, |
| 2675 needs_stacktrace()); | 2684 needs_stacktrace()); |
| 2676 // Restore pool pointer. | 2685 // On lazy deoptimization we patch the optimized code here to enter the |
| 2677 __ RestoreCodePointer(); | 2686 // deoptimization stub. |
| 2678 __ LoadPoolPointer(); | 2687 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); |
| 2679 | 2688 if (compiler->is_optimizing()) { |
| 2689 compiler->AddDeoptIndexAtCall(deopt_id); |
| 2690 } else { |
| 2691 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2692 deopt_id, |
| 2693 TokenPosition::kNoSource); |
| 2694 } |
| 2680 if (HasParallelMove()) { | 2695 if (HasParallelMove()) { |
| 2681 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2696 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2682 } | 2697 } |
| 2683 | |
| 2684 // Restore SP from FP as we are coming from a throw and the code for | 2698 // Restore SP from FP as we are coming from a throw and the code for |
| 2685 // popping arguments has not been run. | 2699 // popping arguments has not been run. |
| 2686 const intptr_t fp_sp_dist = | 2700 const intptr_t fp_sp_dist = |
| 2687 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 2701 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 2688 ASSERT(fp_sp_dist <= 0); | 2702 ASSERT(fp_sp_dist <= 0); |
| 2689 __ AddImmediate(SP, FP, fp_sp_dist); | 2703 __ AddImmediate(SP, FP, fp_sp_dist); |
| 2690 | 2704 |
| 2691 // Restore stack and initialize the two exception variables: | 2705 // Restore stack and initialize the two exception variables: |
| 2692 // exception and stack trace variables. | 2706 // exception and stack trace variables. |
| 2693 __ StoreToOffset(kExceptionObjectReg, | 2707 __ StoreToOffset(kExceptionObjectReg, |
| (...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5780 1, | 5794 1, |
| 5781 locs()); | 5795 locs()); |
| 5782 __ lw(result, Address(SP, 1 * kWordSize)); | 5796 __ lw(result, Address(SP, 1 * kWordSize)); |
| 5783 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5797 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 5784 } | 5798 } |
| 5785 | 5799 |
| 5786 | 5800 |
| 5787 } // namespace dart | 5801 } // namespace dart |
| 5788 | 5802 |
| 5789 #endif // defined TARGET_ARCH_MIPS | 5803 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |