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

Side by Side Diff: runtime/vm/intermediate_language_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // R2: instructions. 222 // R2: instructions.
223 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 223 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
224 __ LoadImmediate(R5, 0); 224 __ LoadImmediate(R5, 0);
225 //?? 225 //??
226 __ blr(R2); 226 __ blr(R2);
227 compiler->RecordSafepoint(locs()); 227 compiler->RecordSafepoint(locs());
228 // Marks either the continuation point in unoptimized code or the 228 // Marks either the continuation point in unoptimized code or the
229 // deoptimization point in optimized code, after call. 229 // deoptimization point in optimized code, after call.
230 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 230 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
231 if (compiler->is_optimizing()) { 231 if (compiler->is_optimizing()) {
232 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 232 compiler->AddDeoptIndexAtCall(deopt_id_after);
233 } 233 }
234 // Add deoptimization continuation point after the call and before the 234 // Add deoptimization continuation point after the call and before the
235 // arguments are removed. 235 // arguments are removed.
236 // In optimized code this descriptor is needed for exception handling. 236 // In optimized code this descriptor is needed for exception handling.
237 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 237 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
238 deopt_id_after, 238 deopt_id_after,
239 token_pos()); 239 token_pos());
240 __ Drop(argument_count); 240 __ Drop(argument_count);
241 } 241 }
242 242
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 } 2552 }
2553 2553
2554 2554
2555 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2555 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2556 __ Bind(compiler->GetJumpLabel(this)); 2556 __ Bind(compiler->GetJumpLabel(this));
2557 compiler->AddExceptionHandler(catch_try_index(), 2557 compiler->AddExceptionHandler(catch_try_index(),
2558 try_index(), 2558 try_index(),
2559 compiler->assembler()->CodeSize(), 2559 compiler->assembler()->CodeSize(),
2560 catch_handler_types_, 2560 catch_handler_types_,
2561 needs_stacktrace()); 2561 needs_stacktrace());
2562 2562 // On lazy deoptimization we patch the optimized code here to enter the
2563 // Restore the pool pointer. 2563 // deoptimization stub.
2564 __ RestoreCodePointer(); 2564 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
2565 __ LoadPoolPointer(); 2565 if (compiler->is_optimizing()) {
2566 2566 compiler->AddDeoptIndexAtCall(deopt_id);
2567 } else {
2568 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2569 deopt_id,
2570 TokenPosition::kNoSource);
2571 }
2567 if (HasParallelMove()) { 2572 if (HasParallelMove()) {
2568 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2573 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2569 } 2574 }
2570 2575
2571 // Restore SP from FP as we are coming from a throw and the code for 2576 // Restore SP from FP as we are coming from a throw and the code for
2572 // popping arguments has not been run. 2577 // popping arguments has not been run.
2573 const intptr_t fp_sp_dist = 2578 const intptr_t fp_sp_dist =
2574 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2579 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2575 ASSERT(fp_sp_dist <= 0); 2580 ASSERT(fp_sp_dist <= 0);
2576 __ AddImmediate(SP, FP, fp_sp_dist); 2581 __ AddImmediate(SP, FP, fp_sp_dist);
(...skipping 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after
5773 1, 5778 1,
5774 locs()); 5779 locs());
5775 __ Drop(1); 5780 __ Drop(1);
5776 __ Pop(result); 5781 __ Pop(result);
5777 } 5782 }
5778 5783
5779 5784
5780 } // namespace dart 5785 } // namespace dart
5781 5786
5782 #endif // defined TARGET_ARCH_ARM64 5787 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698