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

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

Issue 2595553002: VM: [DBC] Fix more problems with lazy deopt. (Closed)
Patch Set: Created 4 years 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 LocationSummary::kCall) { 910 LocationSummary::kCall) {
911 if (compiler->is_optimizing()) { 911 if (compiler->is_optimizing()) {
912 __ Push(locs()->in(0).reg()); 912 __ Push(locs()->in(0).reg());
913 } 913 }
914 const intptr_t kArgumentCount = 1; 914 const intptr_t kArgumentCount = 1;
915 const Array& arguments_descriptor = Array::Handle( 915 const Array& arguments_descriptor = Array::Handle(
916 ArgumentsDescriptor::New(kArgumentCount, Object::null_array())); 916 ArgumentsDescriptor::New(kArgumentCount, Object::null_array()));
917 __ PushConstant(CallFunction()); 917 __ PushConstant(CallFunction());
918 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor); 918 const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor);
919 __ StaticCall(kArgumentCount, argdesc_kidx); 919 __ StaticCall(kArgumentCount, argdesc_kidx);
920 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult); 920 // Note: can't use RecordAfterCall here because
921 // StringInterpolateInstr::ArgumentCount() is 0. However
922 // internally it does a call with 1 argument which needs to
923 // be reflected in the lazy deoptimization environment.
924 compiler->RecordAfterCallHelper(token_pos(), deopt_id(), kArgumentCount,
925 FlowGraphCompiler::kHasResult, locs());
921 if (compiler->is_optimizing()) { 926 if (compiler->is_optimizing()) {
922 __ PopLocal(locs()->out(0).reg()); 927 __ PopLocal(locs()->out(0).reg());
923 } 928 }
924 } 929 }
925 930
926 931
927 EMIT_NATIVE_CODE(NativeCall, 932 EMIT_NATIVE_CODE(NativeCall,
928 0, 933 0,
929 Location::NoLocation(), 934 Location::NoLocation(),
930 LocationSummary::kCall) { 935 LocationSummary::kCall) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 __ PopLocal(locs()->out(0).reg()); 1143 __ PopLocal(locs()->out(0).reg());
1139 } 1144 }
1140 } 1145 }
1141 1146
1142 1147
1143 EMIT_NATIVE_CODE(CatchBlockEntry, 0) { 1148 EMIT_NATIVE_CODE(CatchBlockEntry, 0) {
1144 __ Bind(compiler->GetJumpLabel(this)); 1149 __ Bind(compiler->GetJumpLabel(this));
1145 compiler->AddExceptionHandler(catch_try_index(), try_index(), 1150 compiler->AddExceptionHandler(catch_try_index(), try_index(),
1146 compiler->assembler()->CodeSize(), 1151 compiler->assembler()->CodeSize(),
1147 catch_handler_types_, needs_stacktrace()); 1152 catch_handler_types_, needs_stacktrace());
1148 1153 // On lazy deoptimization we patch the optimized code here to enter the
1154 // deoptimization stub.
1155 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
1156 if (compiler->is_optimizing()) {
1157 compiler->AddDeoptIndexAtCall(deopt_id);
1158 } else {
1159 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id,
1160 TokenPosition::kNoSource);
1161 }
1149 if (HasParallelMove()) { 1162 if (HasParallelMove()) {
1150 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 1163 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
1151 } 1164 }
1152 if (compiler->is_optimizing()) { 1165 if (compiler->is_optimizing()) {
1153 // In optimized code, variables at the catch block entry reside at the top 1166 // In optimized code, variables at the catch block entry reside at the top
1154 // of the allocatable register range. 1167 // of the allocatable register range.
1155 const intptr_t num_non_copied_params = 1168 const intptr_t num_non_copied_params =
1156 compiler->flow_graph().num_non_copied_params(); 1169 compiler->flow_graph().num_non_copied_params();
1157 const intptr_t exception_reg = 1170 const intptr_t exception_reg =
1158 kNumberOfCpuRegisters - 1171 kNumberOfCpuRegisters -
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 } 2009 }
1997 __ IfULe(length, index); 2010 __ IfULe(length, index);
1998 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, 2011 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound,
1999 (generalized_ ? ICData::kGeneralized : 0) | 2012 (generalized_ ? ICData::kGeneralized : 0) |
2000 (licm_hoisted_ ? ICData::kHoisted : 0)); 2013 (licm_hoisted_ ? ICData::kHoisted : 0));
2001 } 2014 }
2002 2015
2003 } // namespace dart 2016 } // namespace dart
2004 2017
2005 #endif // defined TARGET_ARCH_DBC 2018 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « no previous file | tests/language/vm/lazy_deopt_vm_test.dart » ('j') | tests/language/vm/lazy_deopt_vm_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698