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

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

Issue 2587133002: VM: [DBC] Fix lazy deoptimization after calls that return no values. (Closed)
Patch Set: Add test 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (compiler->is_optimizing()) { 197 if (compiler->is_optimizing()) {
198 __ Push(locs()->in(0).reg()); // Value. 198 __ Push(locs()->in(0).reg()); // Value.
199 __ Push(locs()->in(1).reg()); // Instantiator type arguments. 199 __ Push(locs()->in(1).reg()); // Instantiator type arguments.
200 } 200 }
201 201
202 __ PushConstant(type()); 202 __ PushConstant(type());
203 __ PushConstant(test_cache); 203 __ PushConstant(test_cache);
204 __ InstanceOf(negate_result() ? 1 : 0); 204 __ InstanceOf(negate_result() ? 1 : 0);
205 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 205 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
206 token_pos()); 206 token_pos());
207 compiler->RecordAfterCall(this); 207 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
208 if (compiler->is_optimizing()) { 208 if (compiler->is_optimizing()) {
209 __ PopLocal(locs()->out(0).reg()); 209 __ PopLocal(locs()->out(0).reg());
210 } 210 }
211 } 211 }
212 212
213 213
214 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 214 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable,
215 2, 215 2,
216 Location::SameAsFirstInput(), 216 Location::SameAsFirstInput(),
217 LocationSummary::kCall); 217 LocationSummary::kCall);
218 218
219 219
220 EMIT_NATIVE_CODE(AssertBoolean, 220 EMIT_NATIVE_CODE(AssertBoolean,
221 1, 221 1,
222 Location::SameAsFirstInput(), 222 Location::SameAsFirstInput(),
223 LocationSummary::kCall) { 223 LocationSummary::kCall) {
224 if (compiler->is_optimizing()) { 224 if (compiler->is_optimizing()) {
225 __ Push(locs()->in(0).reg()); 225 __ Push(locs()->in(0).reg());
226 } 226 }
227 __ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0); 227 __ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0);
228 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 228 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
229 token_pos()); 229 token_pos());
230 compiler->RecordAfterCall(this); 230 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
231 if (compiler->is_optimizing()) { 231 if (compiler->is_optimizing()) {
232 __ Drop1(); 232 __ Drop1();
233 } 233 }
234 } 234 }
235 235
236 236
237 EMIT_NATIVE_CODE(PolymorphicInstanceCall, 237 EMIT_NATIVE_CODE(PolymorphicInstanceCall,
238 0, 238 0,
239 Location::RegisterLocation(0), 239 Location::RegisterLocation(0),
240 LocationSummary::kCall) { 240 LocationSummary::kCall) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } else { 273 } else {
274 ASSERT(ic_data().HasOneTarget()); 274 ASSERT(ic_data().HasOneTarget());
275 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); 275 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
276 __ PushConstant(target); 276 __ PushConstant(target);
277 } 277 }
278 278
279 // Call the function. 279 // Call the function.
280 __ StaticCall(instance_call()->ArgumentCount(), argdesc_kidx); 280 __ StaticCall(instance_call()->ArgumentCount(), argdesc_kidx);
281 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 281 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
282 instance_call()->token_pos()); 282 instance_call()->token_pos());
283 compiler->RecordAfterCall(this); 283 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
284 __ PopLocal(locs()->out(0).reg()); 284 __ PopLocal(locs()->out(0).reg());
285 } 285 }
286 286
287 287
288 EMIT_NATIVE_CODE(Stop, 0) { 288 EMIT_NATIVE_CODE(Stop, 0) {
289 __ Stop(message()); 289 __ Stop(message());
290 } 290 }
291 291
292 292
293 EMIT_NATIVE_CODE(CheckStackOverflow, 293 EMIT_NATIVE_CODE(CheckStackOverflow,
294 0, 294 0,
295 Location::NoLocation(), 295 Location::NoLocation(),
296 LocationSummary::kCall) { 296 LocationSummary::kCall) {
297 if (compiler->ForceSlowPathForStackOverflow()) { 297 if (compiler->ForceSlowPathForStackOverflow()) {
298 __ CheckStackAlwaysExit(); 298 __ CheckStackAlwaysExit();
299 } else { 299 } else {
300 __ CheckStack(); 300 __ CheckStack();
301 } 301 }
302 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 302 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
303 token_pos()); 303 token_pos());
304 compiler->RecordAfterCall(this); 304 compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
305 } 305 }
306 306
307 307
308 EMIT_NATIVE_CODE(PushArgument, 1) { 308 EMIT_NATIVE_CODE(PushArgument, 1) {
309 if (compiler->is_optimizing()) { 309 if (compiler->is_optimizing()) {
310 __ Push(locs()->in(0).reg()); 310 __ Push(locs()->in(0).reg());
311 } 311 }
312 } 312 }
313 313
314 314
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 EMIT_NATIVE_CODE(InitStaticField, 424 EMIT_NATIVE_CODE(InitStaticField,
425 1, 425 1,
426 Location::NoLocation(), 426 Location::NoLocation(),
427 LocationSummary::kCall) { 427 LocationSummary::kCall) {
428 if (compiler->is_optimizing()) { 428 if (compiler->is_optimizing()) {
429 __ Push(locs()->in(0).reg()); 429 __ Push(locs()->in(0).reg());
430 __ InitStaticTOS(); 430 __ InitStaticTOS();
431 } else { 431 } else {
432 __ InitStaticTOS(); 432 __ InitStaticTOS();
433 } 433 }
434 compiler->RecordAfterCall(this); 434 compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
435 } 435 }
436 436
437 437
438 EMIT_NATIVE_CODE(ClosureCall, 438 EMIT_NATIVE_CODE(ClosureCall,
439 1, 439 1,
440 Location::RegisterLocation(0), 440 Location::RegisterLocation(0),
441 LocationSummary::kCall) { 441 LocationSummary::kCall) {
442 if (compiler->is_optimizing()) { 442 if (compiler->is_optimizing()) {
443 __ Push(locs()->in(0).reg()); 443 __ Push(locs()->in(0).reg());
444 } 444 }
445 445
446 intptr_t argument_count = ArgumentCount(); 446 intptr_t argument_count = ArgumentCount();
447 const Array& arguments_descriptor = Array::ZoneHandle( 447 const Array& arguments_descriptor = Array::ZoneHandle(
448 ArgumentsDescriptor::New(argument_count, argument_names())); 448 ArgumentsDescriptor::New(argument_count, argument_names()));
449 const intptr_t argdesc_kidx = 449 const intptr_t argdesc_kidx =
450 compiler->assembler()->AddConstant(arguments_descriptor); 450 compiler->assembler()->AddConstant(arguments_descriptor);
451 __ StaticCall(argument_count, argdesc_kidx); 451 __ StaticCall(argument_count, argdesc_kidx);
452 compiler->RecordAfterCall(this); 452 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
453 if (compiler->is_optimizing()) { 453 if (compiler->is_optimizing()) {
454 __ PopLocal(locs()->out(0).reg()); 454 __ PopLocal(locs()->out(0).reg());
455 } 455 }
456 } 456 }
457 457
458 458
459 static void EmitBranchOnCondition(FlowGraphCompiler* compiler, 459 static void EmitBranchOnCondition(FlowGraphCompiler* compiler,
460 Condition true_condition, 460 Condition true_condition,
461 BranchLabels labels) { 461 BranchLabels labels) {
462 if (true_condition == NEXT_IS_TRUE) { 462 if (true_condition == NEXT_IS_TRUE) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 Location::RequiresRegister(), 692 Location::RequiresRegister(),
693 LocationSummary::kCall) { 693 LocationSummary::kCall) {
694 if (compiler->is_optimizing()) { 694 if (compiler->is_optimizing()) {
695 const Register length = locs()->in(kLengthPos).reg(); 695 const Register length = locs()->in(kLengthPos).reg();
696 const Register type_arguments = locs()->in(kElementTypePos).reg(); 696 const Register type_arguments = locs()->in(kElementTypePos).reg();
697 const Register out = locs()->out(0).reg(); 697 const Register out = locs()->out(0).reg();
698 __ CreateArrayOpt(out, length, type_arguments); 698 __ CreateArrayOpt(out, length, type_arguments);
699 __ Push(type_arguments); 699 __ Push(type_arguments);
700 __ Push(length); 700 __ Push(length);
701 __ CreateArrayTOS(); 701 __ CreateArrayTOS();
702 compiler->RecordAfterCall(this); 702 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
703 __ PopLocal(out); 703 __ PopLocal(out);
704 } else { 704 } else {
705 __ CreateArrayTOS(); 705 __ CreateArrayTOS();
706 compiler->RecordAfterCall(this); 706 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
707 } 707 }
708 } 708 }
709 709
710 710
711 EMIT_NATIVE_CODE(StoreIndexed, 711 EMIT_NATIVE_CODE(StoreIndexed,
712 3, 712 3,
713 Location::NoLocation(), 713 Location::NoLocation(),
714 LocationSummary::kNoCall, 714 LocationSummary::kNoCall,
715 1) { 715 1) {
716 if (!compiler->is_optimizing()) { 716 if (!compiler->is_optimizing()) {
(...skipping 193 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); 920 compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
921 if (compiler->is_optimizing()) { 921 if (compiler->is_optimizing()) {
922 __ PopLocal(locs()->out(0).reg()); 922 __ PopLocal(locs()->out(0).reg());
923 } 923 }
924 } 924 }
925 925
926 926
927 EMIT_NATIVE_CODE(NativeCall, 927 EMIT_NATIVE_CODE(NativeCall,
928 0, 928 0,
929 Location::NoLocation(), 929 Location::NoLocation(),
930 LocationSummary::kCall) { 930 LocationSummary::kCall) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 Simulator::kStackTraceSpecialIndex); 1169 Simulator::kStackTraceSpecialIndex);
1170 } 1170 }
1171 __ SetFrame(compiler->StackSize()); 1171 __ SetFrame(compiler->StackSize());
1172 } 1172 }
1173 1173
1174 1174
1175 EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) { 1175 EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) {
1176 __ Throw(0); 1176 __ Throw(0);
1177 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 1177 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
1178 token_pos()); 1178 token_pos());
1179 compiler->RecordAfterCall(this); 1179 compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
1180 __ Trap(); 1180 __ Trap();
1181 } 1181 }
1182 1182
1183 1183
1184 EMIT_NATIVE_CODE(ReThrow, 0, Location::NoLocation(), LocationSummary::kCall) { 1184 EMIT_NATIVE_CODE(ReThrow, 0, Location::NoLocation(), LocationSummary::kCall) {
1185 compiler->SetNeedsStackTrace(catch_try_index()); 1185 compiler->SetNeedsStackTrace(catch_try_index());
1186 __ Throw(1); 1186 __ Throw(1);
1187 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), 1187 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
1188 token_pos()); 1188 token_pos());
1189 compiler->RecordAfterCall(this); 1189 compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
1190 __ Trap(); 1190 __ Trap();
1191 } 1191 }
1192 1192
1193 EMIT_NATIVE_CODE(InstantiateType, 1193 EMIT_NATIVE_CODE(InstantiateType,
1194 1, 1194 1,
1195 Location::RequiresRegister(), 1195 Location::RequiresRegister(),
1196 LocationSummary::kCall) { 1196 LocationSummary::kCall) {
1197 if (compiler->is_optimizing()) { 1197 if (compiler->is_optimizing()) {
1198 __ Push(locs()->in(0).reg()); 1198 __ Push(locs()->in(0).reg());
1199 } 1199 }
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 } 1996 }
1997 __ IfULe(length, index); 1997 __ IfULe(length, index);
1998 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, 1998 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound,
1999 (generalized_ ? ICData::kGeneralized : 0) | 1999 (generalized_ ? ICData::kGeneralized : 0) |
2000 (licm_hoisted_ ? ICData::kHoisted : 0)); 2000 (licm_hoisted_ ? ICData::kHoisted : 0));
2001 } 2001 }
2002 2002
2003 } // namespace dart 2003 } // namespace dart
2004 2004
2005 #endif // defined TARGET_ARCH_DBC 2005 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698