OLD | NEW |
---|---|
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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 const AbstractType& type, | 345 const AbstractType& type, |
346 const AbstractTypeArguments& instantiator_type_arguments, | 346 const AbstractTypeArguments& instantiator_type_arguments, |
347 const Bool& result) { | 347 const Bool& result) { |
348 DartFrameIterator iterator; | 348 DartFrameIterator iterator; |
349 StackFrame* caller_frame = iterator.NextFrame(); | 349 StackFrame* caller_frame = iterator.NextFrame(); |
350 ASSERT(caller_frame != NULL); | 350 ASSERT(caller_frame != NULL); |
351 | 351 |
352 const Type& instance_type = Type::Handle(instance.GetType()); | 352 const Type& instance_type = Type::Handle(instance.GetType()); |
353 ASSERT(instance_type.IsInstantiated()); | 353 ASSERT(instance_type.IsInstantiated()); |
354 if (type.IsInstantiated()) { | 354 if (type.IsInstantiated()) { |
355 OS::PrintErr("%s: '%s' %"Pd" %s '%s' %"Pd" (pc: %#"Px").\n", | 355 OS::PrintErr("%s: '%s' %" Pd " %s '%s' %" Pd " (pc: %#" Px ").\n", |
356 message, | 356 message, |
357 String::Handle(instance_type.Name()).ToCString(), | 357 String::Handle(instance_type.Name()).ToCString(), |
358 Class::Handle(instance_type.type_class()).id(), | 358 Class::Handle(instance_type.type_class()).id(), |
359 (result.raw() == Bool::True().raw()) ? "is" : "is !", | 359 (result.raw() == Bool::True().raw()) ? "is" : "is !", |
360 String::Handle(type.Name()).ToCString(), | 360 String::Handle(type.Name()).ToCString(), |
361 Class::Handle(type.type_class()).id(), | 361 Class::Handle(type.type_class()).id(), |
362 caller_frame->pc()); | 362 caller_frame->pc()); |
363 } else { | 363 } else { |
364 // Instantiate type before printing. | 364 // Instantiate type before printing. |
365 Error& malformed_error = Error::Handle(); | 365 Error& malformed_error = Error::Handle(); |
366 const AbstractType& instantiated_type = AbstractType::Handle( | 366 const AbstractType& instantiated_type = AbstractType::Handle( |
367 type.InstantiateFrom(instantiator_type_arguments, &malformed_error)); | 367 type.InstantiateFrom(instantiator_type_arguments, &malformed_error)); |
368 OS::PrintErr("%s: '%s' %s '%s' instantiated from '%s' (pc: %#"Px").\n", | 368 OS::PrintErr("%s: '%s' %s '%s' instantiated from '%s' (pc: %#" Px ").\n", |
369 message, | 369 message, |
370 String::Handle(instance_type.Name()).ToCString(), | 370 String::Handle(instance_type.Name()).ToCString(), |
371 (result.raw() == Bool::True().raw()) ? "is" : "is !", | 371 (result.raw() == Bool::True().raw()) ? "is" : "is !", |
372 String::Handle(instantiated_type.Name()).ToCString(), | 372 String::Handle(instantiated_type.Name()).ToCString(), |
373 String::Handle(type.Name()).ToCString(), | 373 String::Handle(type.Name()).ToCString(), |
374 caller_frame->pc()); | 374 caller_frame->pc()); |
375 if (!malformed_error.IsNull()) { | 375 if (!malformed_error.IsNull()) { |
376 OS::Print(" malformed error: %s\n", malformed_error.ToErrorCString()); | 376 OS::Print(" malformed error: %s\n", malformed_error.ToErrorCString()); |
377 } | 377 } |
378 } | 378 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 i, | 481 i, |
482 &last_instance_class_id, | 482 &last_instance_class_id, |
483 &last_instance_type_arguments, | 483 &last_instance_type_arguments, |
484 &last_instantiator_type_arguments, | 484 &last_instantiator_type_arguments, |
485 &last_result); | 485 &last_result); |
486 if ((last_instance_class_id == instance_class.id()) && | 486 if ((last_instance_class_id == instance_class.id()) && |
487 (last_instance_type_arguments.raw() == instance_type_arguments.raw()) && | 487 (last_instance_type_arguments.raw() == instance_type_arguments.raw()) && |
488 (last_instantiator_type_arguments.raw() == | 488 (last_instantiator_type_arguments.raw() == |
489 instantiator_type_arguments.raw())) { | 489 instantiator_type_arguments.raw())) { |
490 if (FLAG_trace_type_checks) { | 490 if (FLAG_trace_type_checks) { |
491 OS::PrintErr("%"Pd" ", i); | 491 OS::PrintErr("%" Pd " ", i); |
492 if (type_arguments_replaced) { | 492 if (type_arguments_replaced) { |
493 PrintTypeCheck("Duplicate cache entry (canonical.)", instance, type, | 493 PrintTypeCheck("Duplicate cache entry (canonical.)", instance, type, |
494 instantiator_type_arguments, result); | 494 instantiator_type_arguments, result); |
495 } else { | 495 } else { |
496 PrintTypeCheck("WARNING Duplicate cache entry", instance, type, | 496 PrintTypeCheck("WARNING Duplicate cache entry", instance, type, |
497 instantiator_type_arguments, result); | 497 instantiator_type_arguments, result); |
498 } | 498 } |
499 } | 499 } |
500 // Can occur if we have canonicalized arguments. | 500 // Can occur if we have canonicalized arguments. |
501 // TODO(srdjan): Investigate why this assert can fail. | 501 // TODO(srdjan): Investigate why this assert can fail. |
502 // ASSERT(type_arguments_replaced); | 502 // ASSERT(type_arguments_replaced); |
503 return; | 503 return; |
504 } | 504 } |
505 } | 505 } |
506 if (!instantiator_type_arguments.IsInstantiatedTypeArguments()) { | 506 if (!instantiator_type_arguments.IsInstantiatedTypeArguments()) { |
507 new_cache.AddCheck(instance_class.id(), | 507 new_cache.AddCheck(instance_class.id(), |
508 instance_type_arguments, | 508 instance_type_arguments, |
509 instantiator_type_arguments, | 509 instantiator_type_arguments, |
510 result); | 510 result); |
511 } | 511 } |
512 if (FLAG_trace_type_checks) { | 512 if (FLAG_trace_type_checks) { |
513 AbstractType& test_type = AbstractType::Handle(type.raw()); | 513 AbstractType& test_type = AbstractType::Handle(type.raw()); |
514 if (!test_type.IsInstantiated()) { | 514 if (!test_type.IsInstantiated()) { |
515 Error& malformed_error = Error::Handle(); | 515 Error& malformed_error = Error::Handle(); |
516 test_type = type.InstantiateFrom(instantiator_type_arguments, | 516 test_type = type.InstantiateFrom(instantiator_type_arguments, |
517 &malformed_error); | 517 &malformed_error); |
518 ASSERT(malformed_error.IsNull()); // Malformed types are not optimized. | 518 ASSERT(malformed_error.IsNull()); // Malformed types are not optimized. |
519 } | 519 } |
520 OS::PrintErr(" Updated test cache %p ix: %"Pd" with " | 520 OS::PrintErr(" Updated test cache %p ix: %" Pd " with " |
521 "(cid: %"Pd", type-args: %p, instantiator: %p, result: %s)\n" | 521 "(cid: %" Pd ", type-args: %p, instantiator: %p, result: %s)\n" |
522 " instance [class: (%p '%s' cid: %"Pd"), type-args: %p %s]\n" | 522 " instance [class: (%p '%s' cid: %" Pd "), type-args: %p %s]\n" |
523 " test-type [class: (%p '%s' cid: %"Pd"), in-type-args: %p %s]\n", | 523 " test-type [class: (%p '%s' cid: %" Pd "), in-type-args: %p %s]\n", |
524 new_cache.raw(), | 524 new_cache.raw(), |
525 len, | 525 len, |
526 | 526 |
527 instance_class.id(), | 527 instance_class.id(), |
528 instance_type_arguments.raw(), | 528 instance_type_arguments.raw(), |
529 instantiator_type_arguments.raw(), | 529 instantiator_type_arguments.raw(), |
530 result.ToCString(), | 530 result.ToCString(), |
531 | 531 |
532 instance_class.raw(), | 532 instance_class.raw(), |
533 String::Handle(instance_class.Name()).ToCString(), | 533 String::Handle(instance_class.Name()).ToCString(), |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
732 } | 732 } |
733 const Code& target_code = Code::Handle(target_function.CurrentCode()); | 733 const Code& target_code = Code::Handle(target_function.CurrentCode()); |
734 // Before patching verify that we are not repeatedly patching to the same | 734 // Before patching verify that we are not repeatedly patching to the same |
735 // target. | 735 // target. |
736 ASSERT(target_code.EntryPoint() != | 736 ASSERT(target_code.EntryPoint() != |
737 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)); | 737 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)); |
738 CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code, | 738 CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code, |
739 target_code.EntryPoint()); | 739 target_code.EntryPoint()); |
740 caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code); | 740 caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code); |
741 if (FLAG_trace_patching) { | 741 if (FLAG_trace_patching) { |
742 OS::PrintErr("PatchStaticCall: patching from %#"Px" to '%s' %#"Px"\n", | 742 OS::PrintErr("PatchStaticCall: patching from %#" Px " to '%s' %#" Px "\n", |
743 caller_frame->pc(), | 743 caller_frame->pc(), |
744 target_function.ToFullyQualifiedCString(), | 744 target_function.ToFullyQualifiedCString(), |
745 target_code.EntryPoint()); | 745 target_code.EntryPoint()); |
746 } | 746 } |
747 arguments.SetReturn(target_code); | 747 arguments.SetReturn(target_code); |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 // Resolves and compiles the target function of an instance call, updates | 751 // Resolves and compiles the target function of an instance call, updates |
752 // function cache of the receiver's class and returns the compiled code or null. | 752 // function cache of the receiver's class and returns the compiled code or null. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 ASSERT(caller_frame != NULL); | 892 ASSERT(caller_frame != NULL); |
893 if (FLAG_trace_ic_miss_in_optimized) { | 893 if (FLAG_trace_ic_miss_in_optimized) { |
894 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); | 894 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); |
895 if (caller.is_optimized()) { | 895 if (caller.is_optimized()) { |
896 OS::PrintErr("IC miss in optimized code; call %s -> %s\n", | 896 OS::PrintErr("IC miss in optimized code; call %s -> %s\n", |
897 Function::Handle(caller.function()).ToCString(), | 897 Function::Handle(caller.function()).ToCString(), |
898 target_function.ToCString()); | 898 target_function.ToCString()); |
899 } | 899 } |
900 } | 900 } |
901 if (FLAG_trace_ic) { | 901 if (FLAG_trace_ic) { |
902 OS::PrintErr("InlineCacheMissHandler %d call at %#"Px"' " | 902 OS::PrintErr("InlineCacheMissHandler %d call at %#" Px "' " |
903 "adding <%s> id:%"Pd" -> <%s>\n", | 903 "adding <%s> id:%" Pd " -> <%s>\n", |
904 args.length(), | 904 args.length(), |
905 caller_frame->pc(), | 905 caller_frame->pc(), |
906 Class::Handle(receiver.clazz()).ToCString(), | 906 Class::Handle(receiver.clazz()).ToCString(), |
907 receiver.GetClassId(), | 907 receiver.GetClassId(), |
908 target_function.ToCString()); | 908 target_function.ToCString()); |
909 } | 909 } |
910 } | 910 } |
911 return target_function.raw(); | 911 return target_function.raw(); |
912 } | 912 } |
913 | 913 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1000 } | 1000 } |
1001 ASSERT(!target.IsNull() && target.HasCode()); | 1001 ASSERT(!target.IsNull() && target.HasCode()); |
1002 GrowableArray<intptr_t> cids(2); | 1002 GrowableArray<intptr_t> cids(2); |
1003 cids.Add(arg0.GetClassId()); | 1003 cids.Add(arg0.GetClassId()); |
1004 cids.Add(arg1.GetClassId()); | 1004 cids.Add(arg1.GetClassId()); |
1005 ic_data.AddCheck(cids, target); | 1005 ic_data.AddCheck(cids, target); |
1006 if (FLAG_trace_ic) { | 1006 if (FLAG_trace_ic) { |
1007 DartFrameIterator iterator; | 1007 DartFrameIterator iterator; |
1008 StackFrame* caller_frame = iterator.NextFrame(); | 1008 StackFrame* caller_frame = iterator.NextFrame(); |
1009 ASSERT(caller_frame != NULL); | 1009 ASSERT(caller_frame != NULL); |
1010 OS::PrintErr("StaticCallMissHandler at %#"Px" target %s (%"Pd", %"Pd")\n", | 1010 OS::PrintErr("StaticCallMissHandler at %#" Px " target %s (%" Pd ", %" Pd ") \n", |
siva
2013/08/20 19:54:51
maybe indent as:
OS::PrintErr("StaticCallMissHand
Jacob
2013/08/20 20:32:15
Done.
| |
1011 caller_frame->pc(), target.ToCString(), cids[0], cids[1]); | 1011 caller_frame->pc(), target.ToCString(), cids[0], cids[1]); |
1012 } | 1012 } |
1013 arguments.SetReturn(target); | 1013 arguments.SetReturn(target); |
1014 } | 1014 } |
1015 | 1015 |
1016 | 1016 |
1017 // Handle a miss of a megamorphic cache. | 1017 // Handle a miss of a megamorphic cache. |
1018 // Arg0: Receiver. | 1018 // Arg0: Receiver. |
1019 // Arg1: ICData object. | 1019 // Arg1: ICData object. |
1020 // Arg2: Arguments descriptor array. | 1020 // Arg2: Arguments descriptor array. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1171 | 1171 |
1172 const Function& target_function = | 1172 const Function& target_function = |
1173 Function::Handle(receiver_class.GetInvocationDispatcher( | 1173 Function::Handle(receiver_class.GetInvocationDispatcher( |
1174 target_name, | 1174 target_name, |
1175 arguments_descriptor, | 1175 arguments_descriptor, |
1176 RawFunction::kInvokeFieldDispatcher)); | 1176 RawFunction::kInvokeFieldDispatcher)); |
1177 // Update IC data. | 1177 // Update IC data. |
1178 ASSERT(!target_function.IsNull()); | 1178 ASSERT(!target_function.IsNull()); |
1179 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); | 1179 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); |
1180 if (FLAG_trace_ic) { | 1180 if (FLAG_trace_ic) { |
1181 OS::PrintErr("InvokeField IC miss: adding <%s> id:%"Pd" -> <%s>\n", | 1181 OS::PrintErr("InvokeField IC miss: adding <%s> id:%" Pd " -> <%s>\n", |
1182 Class::Handle(receiver.clazz()).ToCString(), | 1182 Class::Handle(receiver.clazz()).ToCString(), |
1183 receiver.GetClassId(), | 1183 receiver.GetClassId(), |
1184 target_function.ToCString()); | 1184 target_function.ToCString()); |
1185 } | 1185 } |
1186 *result = DartEntry::InvokeFunction(target_function, | 1186 *result = DartEntry::InvokeFunction(target_function, |
1187 arguments, | 1187 arguments, |
1188 arguments_descriptor); | 1188 arguments_descriptor); |
1189 CheckResultError(*result); | 1189 CheckResultError(*result); |
1190 return true; | 1190 return true; |
1191 } | 1191 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1248 // Operators calls have two or three arguments tested ([], []=, etc.) | 1248 // Operators calls have two or three arguments tested ([], []=, etc.) |
1249 ASSERT(ic_data.num_args_tested() > 1); | 1249 ASSERT(ic_data.num_args_tested() > 1); |
1250 GrowableArray<intptr_t> class_ids(ic_data.num_args_tested()); | 1250 GrowableArray<intptr_t> class_ids(ic_data.num_args_tested()); |
1251 class_ids.Add(receiver_cid); | 1251 class_ids.Add(receiver_cid); |
1252 for (intptr_t i = 1; i < ic_data.num_args_tested(); ++i) { | 1252 for (intptr_t i = 1; i < ic_data.num_args_tested(); ++i) { |
1253 class_ids.Add(Object::Handle(args.At(i)).GetClassId()); | 1253 class_ids.Add(Object::Handle(args.At(i)).GetClassId()); |
1254 } | 1254 } |
1255 ic_data.AddCheck(class_ids, target_function); | 1255 ic_data.AddCheck(class_ids, target_function); |
1256 } | 1256 } |
1257 if (FLAG_trace_ic) { | 1257 if (FLAG_trace_ic) { |
1258 OS::PrintErr("NoSuchMethod IC miss: adding <%s> id:%"Pd" -> <%s>\n", | 1258 OS::PrintErr("NoSuchMethod IC miss: adding <%s> id:%" Pd " -> <%s>\n", |
1259 Class::Handle(receiver.clazz()).ToCString(), | 1259 Class::Handle(receiver.clazz()).ToCString(), |
1260 receiver_cid, | 1260 receiver_cid, |
1261 target_function.ToCString()); | 1261 target_function.ToCString()); |
1262 } | 1262 } |
1263 result = DartEntry::InvokeFunction(target_function, args, args_descriptor); | 1263 result = DartEntry::InvokeFunction(target_function, args, args_descriptor); |
1264 } | 1264 } |
1265 CheckResultError(result); | 1265 CheckResultError(result); |
1266 arguments.SetReturn(result); | 1266 arguments.SetReturn(result); |
1267 } | 1267 } |
1268 | 1268 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1361 | 1361 |
1362 if (FLAG_use_osr && (interrupt_bits == 0)) { | 1362 if (FLAG_use_osr && (interrupt_bits == 0)) { |
1363 DartFrameIterator iterator; | 1363 DartFrameIterator iterator; |
1364 StackFrame* frame = iterator.NextFrame(); | 1364 StackFrame* frame = iterator.NextFrame(); |
1365 const Function& function = Function::Handle(frame->LookupDartFunction()); | 1365 const Function& function = Function::Handle(frame->LookupDartFunction()); |
1366 ASSERT(!function.IsNull()); | 1366 ASSERT(!function.IsNull()); |
1367 if (!CanOptimizeFunction(function, isolate)) return; | 1367 if (!CanOptimizeFunction(function, isolate)) return; |
1368 intptr_t osr_id = | 1368 intptr_t osr_id = |
1369 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); | 1369 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); |
1370 if (FLAG_trace_osr) { | 1370 if (FLAG_trace_osr) { |
1371 OS::Print("Attempting OSR for %s at id=%"Pd", count=%"Pd"\n", | 1371 OS::Print("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n", |
1372 function.ToFullyQualifiedCString(), | 1372 function.ToFullyQualifiedCString(), |
1373 osr_id, | 1373 osr_id, |
1374 function.usage_counter()); | 1374 function.usage_counter()); |
1375 } | 1375 } |
1376 | 1376 |
1377 const Code& original_code = Code::Handle(function.CurrentCode()); | 1377 const Code& original_code = Code::Handle(function.CurrentCode()); |
1378 const Error& error = | 1378 const Error& error = |
1379 Error::Handle(Compiler::CompileOptimizedFunction(function, osr_id)); | 1379 Error::Handle(Compiler::CompileOptimizedFunction(function, osr_id)); |
1380 if (!error.IsNull()) Exceptions::PropagateError(error); | 1380 if (!error.IsNull()) Exceptions::PropagateError(error); |
1381 | 1381 |
(...skipping 14 matching lines...) Expand all Loading... | |
1396 | 1396 |
1397 | 1397 |
1398 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { | 1398 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { |
1399 ASSERT(arguments.ArgCount() == | 1399 ASSERT(arguments.ArgCount() == |
1400 kTraceICCallRuntimeEntry.argument_count()); | 1400 kTraceICCallRuntimeEntry.argument_count()); |
1401 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); | 1401 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); |
1402 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); | 1402 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); |
1403 DartFrameIterator iterator; | 1403 DartFrameIterator iterator; |
1404 StackFrame* frame = iterator.NextFrame(); | 1404 StackFrame* frame = iterator.NextFrame(); |
1405 ASSERT(frame != NULL); | 1405 ASSERT(frame != NULL); |
1406 OS::PrintErr("IC call @%#"Px": ICData: %p cnt:%"Pd" nchecks: %"Pd" %s %s\n", | 1406 OS::PrintErr("IC call @%#" Px ": ICData: %p cnt:%" Pd " nchecks: %" Pd " %s %s \n", |
siva
2013/08/20 19:54:51
OS::PrintErr("IC call @%#" Px ": ICData: %p cnt:%"
Jacob
2013/08/20 20:32:15
Done.
| |
1407 frame->pc(), | 1407 frame->pc(), |
1408 ic_data.raw(), | 1408 ic_data.raw(), |
1409 function.usage_counter(), | 1409 function.usage_counter(), |
1410 ic_data.NumberOfChecks(), | 1410 ic_data.NumberOfChecks(), |
1411 ic_data.is_closure_call() ? "closure" : "", | 1411 ic_data.is_closure_call() ? "closure" : "", |
1412 function.ToFullyQualifiedCString()); | 1412 function.ToFullyQualifiedCString()); |
1413 } | 1413 } |
1414 | 1414 |
1415 | 1415 |
1416 // This is called from function that needs to be optimized. | 1416 // This is called from function that needs to be optimized. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1457 ASSERT(frame->IsDartFrame()); | 1457 ASSERT(frame->IsDartFrame()); |
1458 const Code& caller_code = Code::Handle(frame->LookupDartCode()); | 1458 const Code& caller_code = Code::Handle(frame->LookupDartCode()); |
1459 ASSERT(caller_code.is_optimized()); | 1459 ASSERT(caller_code.is_optimized()); |
1460 const Function& target_function = Function::Handle( | 1460 const Function& target_function = Function::Handle( |
1461 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); | 1461 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); |
1462 const Code& target_code = Code::Handle(target_function.CurrentCode()); | 1462 const Code& target_code = Code::Handle(target_function.CurrentCode()); |
1463 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, | 1463 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, |
1464 target_code.EntryPoint()); | 1464 target_code.EntryPoint()); |
1465 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); | 1465 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); |
1466 if (FLAG_trace_patching) { | 1466 if (FLAG_trace_patching) { |
1467 OS::PrintErr("FixCallersTarget: patching from %#"Px" to '%s' %#"Px"\n", | 1467 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", |
1468 frame->pc(), | 1468 frame->pc(), |
1469 Function::Handle(target_code.function()).ToFullyQualifiedCString(), | 1469 Function::Handle(target_code.function()).ToFullyQualifiedCString(), |
1470 target_code.EntryPoint()); | 1470 target_code.EntryPoint()); |
1471 } | 1471 } |
1472 arguments.SetReturn(target_code); | 1472 arguments.SetReturn(target_code); |
1473 } | 1473 } |
1474 | 1474 |
1475 | 1475 |
1476 const char* DeoptReasonToText(intptr_t deopt_id) { | 1476 const char* DeoptReasonToText(intptr_t deopt_id) { |
1477 switch (deopt_id) { | 1477 switch (deopt_id) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1632 | 1632 |
1633 intptr_t deopt_reason = kDeoptUnknown; | 1633 intptr_t deopt_reason = kDeoptUnknown; |
1634 const DeoptInfo& deopt_info = DeoptInfo::Handle( | 1634 const DeoptInfo& deopt_info = DeoptInfo::Handle( |
1635 optimized_code.GetDeoptInfoAtPc(caller_frame->pc(), &deopt_reason)); | 1635 optimized_code.GetDeoptInfoAtPc(caller_frame->pc(), &deopt_reason)); |
1636 ASSERT(!deopt_info.IsNull()); | 1636 ASSERT(!deopt_info.IsNull()); |
1637 | 1637 |
1638 CopyFrame(optimized_code, *caller_frame); | 1638 CopyFrame(optimized_code, *caller_frame); |
1639 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 1639 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
1640 Function& function = Function::Handle(optimized_code.function()); | 1640 Function& function = Function::Handle(optimized_code.function()); |
1641 OS::PrintErr( | 1641 OS::PrintErr( |
1642 "Deoptimizing (reason %"Pd" '%s') at pc %#"Px" '%s' (count %d)\n", | 1642 "Deoptimizing (reason %" Pd " '%s') at pc %#" Px " '%s' (count %d)\n", |
1643 deopt_reason, | 1643 deopt_reason, |
1644 DeoptReasonToText(deopt_reason), | 1644 DeoptReasonToText(deopt_reason), |
1645 caller_frame->pc(), | 1645 caller_frame->pc(), |
1646 function.ToFullyQualifiedCString(), | 1646 function.ToFullyQualifiedCString(), |
1647 function.deoptimization_counter()); | 1647 function.deoptimization_counter()); |
1648 } | 1648 } |
1649 | 1649 |
1650 // Compute the stack size of the unoptimized frame. For functions with | 1650 // Compute the stack size of the unoptimized frame. For functions with |
1651 // optional arguments the deoptimization info does not describe the | 1651 // optional arguments the deoptimization info does not describe the |
1652 // incoming arguments. | 1652 // incoming arguments. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1716 // Populate stack frames. | 1716 // Populate stack frames. |
1717 for (intptr_t to_index = frame_size - 1, from_index = len - 1; | 1717 for (intptr_t to_index = frame_size - 1, from_index = len - 1; |
1718 to_index >= 0; | 1718 to_index >= 0; |
1719 to_index--, from_index--) { | 1719 to_index--, from_index--) { |
1720 intptr_t* to_addr = deopt_context.GetToFrameAddressAt(to_index); | 1720 intptr_t* to_addr = deopt_context.GetToFrameAddressAt(to_index); |
1721 deopt_instructions[from_index]->Execute(&deopt_context, to_addr); | 1721 deopt_instructions[from_index]->Execute(&deopt_context, to_addr); |
1722 } | 1722 } |
1723 | 1723 |
1724 if (FLAG_trace_deoptimization_verbose) { | 1724 if (FLAG_trace_deoptimization_verbose) { |
1725 for (intptr_t i = 0; i < frame_size; i++) { | 1725 for (intptr_t i = 0; i < frame_size; i++) { |
1726 OS::PrintErr("*%"Pd". [%"Px"] %#014"Px" [%s]\n", | 1726 OS::PrintErr("*%" Pd ". [%" Px "] %#014" Px " [%s]\n", |
1727 i, | 1727 i, |
1728 reinterpret_cast<uword>(&start[i]), | 1728 reinterpret_cast<uword>(&start[i]), |
1729 start[i], | 1729 start[i], |
1730 deopt_instructions[i + (len - frame_size)]->ToCString()); | 1730 deopt_instructions[i + (len - frame_size)]->ToCString()); |
1731 } | 1731 } |
1732 } | 1732 } |
1733 } | 1733 } |
1734 | 1734 |
1735 | 1735 |
1736 // The stack has been adjusted to fit all values for unoptimized frame. | 1736 // The stack has been adjusted to fit all values for unoptimized frame. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1807 StackFrame* top_frame = iterator.NextFrame(); | 1807 StackFrame* top_frame = iterator.NextFrame(); |
1808 ASSERT(top_frame != NULL); | 1808 ASSERT(top_frame != NULL); |
1809 const Code& code = Code::Handle(top_frame->LookupDartCode()); | 1809 const Code& code = Code::Handle(top_frame->LookupDartCode()); |
1810 const Function& top_function = Function::Handle(code.function()); | 1810 const Function& top_function = Function::Handle(code.function()); |
1811 const Script& script = Script::Handle(top_function.script()); | 1811 const Script& script = Script::Handle(top_function.script()); |
1812 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); | 1812 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); |
1813 intptr_t line, column; | 1813 intptr_t line, column; |
1814 script.GetTokenLocation(token_pos, &line, &column); | 1814 script.GetTokenLocation(token_pos, &line, &column); |
1815 String& line_string = String::Handle(script.GetLine(line)); | 1815 String& line_string = String::Handle(script.GetLine(line)); |
1816 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); | 1816 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); |
1817 OS::PrintErr(" Line %"Pd": '%s'\n", line, line_string.ToCString()); | 1817 OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString()); |
1818 OS::PrintErr(" Deopt args: %"Pd"\n", deopt_arguments); | 1818 OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arguments); |
1819 } | 1819 } |
1820 } | 1820 } |
1821 | 1821 |
1822 | 1822 |
1823 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, | 1823 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, |
1824 BigintCompare, | 1824 BigintCompare, |
1825 2, | 1825 2, |
1826 RawBigint* left, | 1826 RawBigint* left, |
1827 RawBigint* right) { | 1827 RawBigint* right) { |
1828 Isolate* isolate = Isolate::Current(); | 1828 Isolate* isolate = Isolate::Current(); |
(...skipping 28 matching lines...) Expand all Loading... | |
1857 // Arg1: Value that is being stored. | 1857 // Arg1: Value that is being stored. |
1858 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1858 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
1859 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1859 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
1860 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1860 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1861 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1861 const Object& value = Object::Handle(arguments.ArgAt(1)); |
1862 | 1862 |
1863 field.UpdateCid(value.GetClassId()); | 1863 field.UpdateCid(value.GetClassId()); |
1864 } | 1864 } |
1865 | 1865 |
1866 } // namespace dart | 1866 } // namespace dart |
OLD | NEW |