Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: new test case Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 ASSERT(locs()->in(0).reg() == T0); 271 ASSERT(locs()->in(0).reg() == T0);
272 __ LoadImmediate(S5, 0); 272 __ LoadImmediate(S5, 0);
273 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); 273 __ lw(T2, FieldAddress(T0, Function::entry_point_offset()));
274 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset())); 274 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset()));
275 __ jalr(T2); 275 __ jalr(T2);
276 compiler->RecordSafepoint(locs()); 276 compiler->RecordSafepoint(locs());
277 // Marks either the continuation point in unoptimized code or the 277 // Marks either the continuation point in unoptimized code or the
278 // deoptimization point in optimized code, after call. 278 // deoptimization point in optimized code, after call.
279 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 279 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
280 if (compiler->is_optimizing()) { 280 if (compiler->is_optimizing()) {
281 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 281 compiler->AddDeoptIndexAtCall(deopt_id_after);
282 } 282 }
283 // Add deoptimization continuation point after the call and before the 283 // Add deoptimization continuation point after the call and before the
284 // arguments are removed. 284 // arguments are removed.
285 // In optimized code this descriptor is needed for exception handling. 285 // In optimized code this descriptor is needed for exception handling.
286 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 286 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
287 deopt_id_after, 287 deopt_id_after,
288 token_pos()); 288 token_pos());
289 __ Drop(argument_count); 289 __ Drop(argument_count);
290 } 290 }
291 291
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 } 2666 }
2667 2667
2668 2668
2669 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2669 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2670 __ Bind(compiler->GetJumpLabel(this)); 2670 __ Bind(compiler->GetJumpLabel(this));
2671 compiler->AddExceptionHandler(catch_try_index(), 2671 compiler->AddExceptionHandler(catch_try_index(),
2672 try_index(), 2672 try_index(),
2673 compiler->assembler()->CodeSize(), 2673 compiler->assembler()->CodeSize(),
2674 catch_handler_types_, 2674 catch_handler_types_,
2675 needs_stacktrace()); 2675 needs_stacktrace());
2676 // Restore pool pointer. 2676 // On lazy deoptimization we patch the optimized code here to enter the
2677 __ RestoreCodePointer(); 2677 // deoptimization stub.
2678 __ LoadPoolPointer(); 2678 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
2679 2679 if (compiler->is_optimizing()) {
2680 compiler->AddDeoptIndexAtCall(deopt_id);
2681 } else {
2682 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2683 deopt_id,
2684 TokenPosition::kNoSource);
2685 }
2680 if (HasParallelMove()) { 2686 if (HasParallelMove()) {
2681 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2687 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2682 } 2688 }
2683
2684 // Restore SP from FP as we are coming from a throw and the code for 2689 // Restore SP from FP as we are coming from a throw and the code for
2685 // popping arguments has not been run. 2690 // popping arguments has not been run.
2686 const intptr_t fp_sp_dist = 2691 const intptr_t fp_sp_dist =
2687 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2692 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2688 ASSERT(fp_sp_dist <= 0); 2693 ASSERT(fp_sp_dist <= 0);
2689 __ AddImmediate(SP, FP, fp_sp_dist); 2694 __ AddImmediate(SP, FP, fp_sp_dist);
2690 2695
2691 // Restore stack and initialize the two exception variables: 2696 // Restore stack and initialize the two exception variables:
2692 // exception and stack trace variables. 2697 // exception and stack trace variables.
2693 __ StoreToOffset(kExceptionObjectReg, 2698 __ StoreToOffset(kExceptionObjectReg,
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after
5780 1, 5785 1,
5781 locs()); 5786 locs());
5782 __ lw(result, Address(SP, 1 * kWordSize)); 5787 __ lw(result, Address(SP, 1 * kWordSize));
5783 __ addiu(SP, SP, Immediate(2 * kWordSize)); 5788 __ addiu(SP, SP, Immediate(2 * kWordSize));
5784 } 5789 }
5785 5790
5786 5791
5787 } // namespace dart 5792 } // namespace dart
5788 5793
5789 #endif // defined TARGET_ARCH_MIPS 5794 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698