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

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

Issue 2357343003: Fix lazy deoptimization in the presence of exceptions (Closed)
Patch Set: Ensure space for patching on ARM/MIPS archs 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "vm/cpu.h" 11 #include "vm/cpu.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/flow_graph.h" 13 #include "vm/flow_graph.h"
14 #include "vm/flow_graph_compiler.h" 14 #include "vm/flow_graph_compiler.h"
15 #include "vm/flow_graph_range_analysis.h" 15 #include "vm/flow_graph_range_analysis.h"
16 #include "vm/instructions.h"
16 #include "vm/locations.h" 17 #include "vm/locations.h"
17 #include "vm/object_store.h" 18 #include "vm/object_store.h"
18 #include "vm/parser.h" 19 #include "vm/parser.h"
19 #include "vm/simulator.h" 20 #include "vm/simulator.h"
20 #include "vm/stack_frame.h" 21 #include "vm/stack_frame.h"
21 #include "vm/stub_code.h" 22 #include "vm/stub_code.h"
22 #include "vm/symbols.h" 23 #include "vm/symbols.h"
23 24
24 #define __ compiler->assembler()-> 25 #define __ compiler->assembler()->
25 #define Z (compiler->zone()) 26 #define Z (compiler->zone())
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 226
226 // R2: instructions entry point. 227 // R2: instructions entry point.
227 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 228 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
228 __ LoadImmediate(R9, 0); 229 __ LoadImmediate(R9, 0);
229 __ blx(R2); 230 __ blx(R2);
230 compiler->RecordSafepoint(locs()); 231 compiler->RecordSafepoint(locs());
231 // Marks either the continuation point in unoptimized code or the 232 // Marks either the continuation point in unoptimized code or the
232 // deoptimization point in optimized code, after call. 233 // deoptimization point in optimized code, after call.
233 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 234 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
234 if (compiler->is_optimizing()) { 235 if (compiler->is_optimizing()) {
235 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); 236 compiler->AddDeoptIndexAtCall(deopt_id_after);
236 } 237 }
237 // Add deoptimization continuation point after the call and before the 238 // Add deoptimization continuation point after the call and before the
238 // arguments are removed. 239 // arguments are removed.
239 // In optimized code this descriptor is needed for exception handling. 240 // In optimized code this descriptor is needed for exception handling.
240 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, 241 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
241 deopt_id_after, 242 deopt_id_after,
242 token_pos()); 243 token_pos());
243 __ Drop(argument_count); 244 __ Drop(argument_count);
244 } 245 }
245 246
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 2830
2830 2831
2831 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, 2832 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone,
2832 bool opt) const { 2833 bool opt) const {
2833 UNREACHABLE(); 2834 UNREACHABLE();
2834 return NULL; 2835 return NULL;
2835 } 2836 }
2836 2837
2837 2838
2838 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2839 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2840 // Ensure space for patching return sites for lazy deopt.
2841 if (!FLAG_precompiled_mode && compiler->is_optimizing()) {
2842 for (intptr_t i = 0;
2843 i < CallPattern::DeoptCallPatternLengthInInstructions();
2844 ++i) {
2845 __ nop();
2846 }
2847 }
2839 __ Bind(compiler->GetJumpLabel(this)); 2848 __ Bind(compiler->GetJumpLabel(this));
2840 compiler->AddExceptionHandler(catch_try_index(), 2849 compiler->AddExceptionHandler(catch_try_index(),
2841 try_index(), 2850 try_index(),
2842 compiler->assembler()->CodeSize(), 2851 compiler->assembler()->CodeSize(),
2843 catch_handler_types_, 2852 catch_handler_types_,
2844 needs_stacktrace()); 2853 needs_stacktrace());
2845 // Restore the pool pointer. 2854 // On lazy deoptimization we patch the optimized code here to enter the
2846 __ RestoreCodePointer(); 2855 // deoptimization stub.
2847 __ LoadPoolPointer(); 2856 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
2848 2857 if (compiler->is_optimizing()) {
2858 compiler->AddDeoptIndexAtCall(deopt_id);
2859 } else {
2860 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
2861 deopt_id,
2862 TokenPosition::kNoSource);
2863 }
2849 if (HasParallelMove()) { 2864 if (HasParallelMove()) {
2850 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 2865 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
2851 } 2866 }
2852 2867
2853 // Restore SP from FP as we are coming from a throw and the code for 2868 // Restore SP from FP as we are coming from a throw and the code for
2854 // popping arguments has not been run. 2869 // popping arguments has not been run.
2855 const intptr_t fp_sp_dist = 2870 const intptr_t fp_sp_dist =
2856 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 2871 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
2857 ASSERT(fp_sp_dist <= 0); 2872 ASSERT(fp_sp_dist <= 0);
2858 __ AddImmediate(SP, FP, fp_sp_dist); 2873 __ AddImmediate(SP, FP, fp_sp_dist);
(...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6985 1, 7000 1,
6986 locs()); 7001 locs());
6987 __ Drop(1); 7002 __ Drop(1);
6988 __ Pop(result); 7003 __ Pop(result);
6989 } 7004 }
6990 7005
6991 7006
6992 } // namespace dart 7007 } // namespace dart
6993 7008
6994 #endif // defined TARGET_ARCH_ARM 7009 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698