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

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

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: new test case Created 4 years, 3 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 // R2: instructions entry point. 226 // R2: instructions entry point.
227 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 227 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
228 __ LoadImmediate(R9, 0); 228 __ LoadImmediate(R9, 0);
229 __ blx(R2); 229 __ blx(R2);
230 compiler->RecordSafepoint(locs()); 230 compiler->RecordSafepoint(locs());
231 // Marks either the continuation point in unoptimized code or the 231 // Marks either the continuation point in unoptimized code or the
232 // deoptimization point in optimized code, after call. 232 // deoptimization point in optimized code, after call.
233 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 233 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
234 if (compiler->is_optimizing()) { 234 if (compiler->is_optimizing()) {
235 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 235 compiler->AddDeoptIndexAtCall(deopt_id_after);
236 } 236 }
237 // Add deoptimization continuation point after the call and before the 237 // Add deoptimization continuation point after the call and before the
238 // arguments are removed. 238 // arguments are removed.
239 // In optimized code this descriptor is needed for exception handling. 239 // In optimized code this descriptor is needed for exception handling.
240 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 240 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
241 deopt_id_after, 241 deopt_id_after,
242 token_pos()); 242 token_pos());
243 __ Drop(argument_count); 243 __ Drop(argument_count);
244 } 244 }
245 245
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 } 2835 }
2836 2836
2837 2837
2838 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2838 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2839 __ Bind(compiler->GetJumpLabel(this)); 2839 __ Bind(compiler->GetJumpLabel(this));
2840 compiler->AddExceptionHandler(catch_try_index(), 2840 compiler->AddExceptionHandler(catch_try_index(),
2841 try_index(), 2841 try_index(),
2842 compiler->assembler()->CodeSize(), 2842 compiler->assembler()->CodeSize(),
2843 catch_handler_types_, 2843 catch_handler_types_,
2844 needs_stacktrace()); 2844 needs_stacktrace());
2845 // Restore the pool pointer. 2845 // On lazy deoptimization we patch the optimized code here to enter the
2846 __ RestoreCodePointer(); 2846 // deoptimization stub.
2847 __ LoadPoolPointer(); 2847 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
2848 2848 if (compiler->is_optimizing()) {
2849 compiler->AddDeoptIndexAtCall(deopt_id);
2850 } else {
2851 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2852 deopt_id,
2853 TokenPosition::kNoSource);
2854 }
2849 if (HasParallelMove()) { 2855 if (HasParallelMove()) {
2850 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2856 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2851 } 2857 }
2852 2858
2853 // Restore SP from FP as we are coming from a throw and the code for 2859 // Restore SP from FP as we are coming from a throw and the code for
2854 // popping arguments has not been run. 2860 // popping arguments has not been run.
2855 const intptr_t fp_sp_dist = 2861 const intptr_t fp_sp_dist =
2856 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2862 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2857 ASSERT(fp_sp_dist <= 0); 2863 ASSERT(fp_sp_dist <= 0);
2858 __ AddImmediate(SP, FP, fp_sp_dist); 2864 __ AddImmediate(SP, FP, fp_sp_dist);
(...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6985 1, 6991 1,
6986 locs()); 6992 locs());
6987 __ Drop(1); 6993 __ Drop(1);
6988 __ Pop(result); 6994 __ Pop(result);
6989 } 6995 }
6990 6996
6991 6997
6992 } // namespace dart 6998 } // namespace dart
6993 6999
6994 #endif // defined TARGET_ARCH_ARM 7000 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698