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

Side by Side Diff: vm/code_generator.cc

Issue 10223015: Add a stub_code_space in the heap alongside code_space so that stub code generation happens here an… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | vm/gc_marker.cc » ('j') | vm/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/code_patcher.h" 7 #include "vm/code_patcher.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 15 matching lines...) Expand all
26 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); 26 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code.");
27 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls."); 27 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls.");
28 DEFINE_FLAG(int, optimization_counter_threshold, 2000, 28 DEFINE_FLAG(int, optimization_counter_threshold, 2000,
29 "function's usage-counter value before it is optimized, -1 means never."); 29 "function's usage-counter value before it is optimized, -1 means never.");
30 DECLARE_FLAG(bool, enable_type_checks); 30 DECLARE_FLAG(bool, enable_type_checks);
31 DECLARE_FLAG(bool, trace_type_checks); 31 DECLARE_FLAG(bool, trace_type_checks);
32 DECLARE_FLAG(bool, report_usage_count); 32 DECLARE_FLAG(bool, report_usage_count);
33 DECLARE_FLAG(int, deoptimization_counter_threshold); 33 DECLARE_FLAG(int, deoptimization_counter_threshold);
34 34
35 35
36 static StackFrame* GetTopDartFrame(
37 StackFrameIterator* iterator, bool has_stub_frame) {
38 // When runtime calls are made from dart code we assume that we will
39 // always have an exit frame and an optional stub frame before we hit
40 // the first dart frame.
41 StackFrame* exit_frame = iterator->NextFrame();
42 ASSERT(exit_frame != NULL && exit_frame->IsExitFrame());
43 if (has_stub_frame) {
44 StackFrame* stub_frame = iterator->NextFrame();
45 ASSERT(stub_frame != NULL && stub_frame->IsStubFrame());
46 }
47 StackFrame* caller_frame = iterator->NextFrame();
48 ASSERT(caller_frame != NULL && caller_frame->IsDartFrame());
49 return caller_frame;
50 }
51
52
53 bool CodeGenerator::CanOptimize() { 36 bool CodeGenerator::CanOptimize() {
54 return 37 return
55 !FLAG_report_usage_count && 38 !FLAG_report_usage_count &&
56 (FLAG_optimization_counter_threshold >= 0) && 39 (FLAG_optimization_counter_threshold >= 0) &&
57 !Isolate::Current()->debugger()->IsActive(); 40 !Isolate::Current()->debugger()->IsActive();
58 } 41 }
59 42
60 43
61 const Array& CodeGenerator::ArgumentsDescriptor( 44 const Array& CodeGenerator::ArgumentsDescriptor(
62 int num_arguments, 45 int num_arguments,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } else { 336 } else {
354 // Instantiate type before printing. 337 // Instantiate type before printing.
355 const AbstractType& instantiated_type = 338 const AbstractType& instantiated_type =
356 AbstractType::Handle(type.InstantiateFrom(type_instantiator)); 339 AbstractType::Handle(type.InstantiateFrom(type_instantiator));
357 OS::Print("InstanceOf: '%s' %s '%s' instantiated from '%s'.\n", 340 OS::Print("InstanceOf: '%s' %s '%s' instantiated from '%s'.\n",
358 String::Handle(instance_type.Name()).ToCString(), 341 String::Handle(instance_type.Name()).ToCString(),
359 (result.raw() == Bool::True()) ? "is" : "is !", 342 (result.raw() == Bool::True()) ? "is" : "is !",
360 String::Handle(instantiated_type.Name()).ToCString(), 343 String::Handle(instantiated_type.Name()).ToCString(),
361 String::Handle(type.Name()).ToCString()); 344 String::Handle(type.Name()).ToCString());
362 } 345 }
363 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 346 DartFrameIterator iterator;
364 StackFrame* caller_frame = GetTopDartFrame(&iterator, false); 347 StackFrame* caller_frame = iterator.NextFrame();
365 const Function& function = Function::Handle( 348 const Function& function = Function::Handle(
366 caller_frame->LookupDartFunction()); 349 caller_frame->LookupDartFunction());
367 OS::Print(" -> Function %s\n", function.ToFullyQualifiedCString()); 350 OS::Print(" -> Function %s\n", function.ToFullyQualifiedCString());
368 } 351 }
369 if (!result.value() && !malformed_error.IsNull()) { 352 if (!result.value() && !malformed_error.IsNull()) {
370 // Throw a dynamic type error only if the instanceof test fails. 353 // Throw a dynamic type error only if the instanceof test fails.
371 String& malformed_error_message = String::Handle( 354 String& malformed_error_message = String::Handle(
372 String::New(malformed_error.ToErrorCString())); 355 String::New(malformed_error.ToErrorCString()));
373 const String& no_name = String::Handle(String::NewSymbol("")); 356 const String& no_name = String::Handle(String::NewSymbol(""));
374 Exceptions::CreateAndThrowTypeError( 357 Exceptions::CreateAndThrowTypeError(
375 location, no_name, no_name, no_name, malformed_error_message); 358 location, no_name, no_name, no_name, malformed_error_message);
376 UNREACHABLE(); 359 UNREACHABLE();
377 } 360 }
378 // Update cache: add class of instance and result. 361 // Update cache: add class of instance and result.
379 if (type.IsInstantiated() && 362 if (type.IsInstantiated() &&
380 !Class::Handle(type.type_class()).HasTypeArguments()) { 363 !Class::Handle(type.type_class()).HasTypeArguments()) {
381 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 364 DartFrameIterator iterator;
382 StackFrame* caller_frame = GetTopDartFrame(&iterator, false); 365 StackFrame* caller_frame = iterator.NextFrame();
383 const Code& code = Code::Handle(caller_frame->LookupDartCode()); 366 const Code& code = Code::Handle(caller_frame->LookupDartCode());
384 ASSERT(!code.IsNull()); 367 ASSERT(!code.IsNull());
385 uword loc = code.GetTypeTestAtNodeId(node_id); 368 uword loc = code.GetTypeTestAtNodeId(node_id);
386 // TODO(srdjan): Check when 'loc' can be 0, once implemented everywhere. 369 // TODO(srdjan): Check when 'loc' can be 0, once implemented everywhere.
387 if (loc != 0) { 370 if (loc != 0) {
388 // Found type test cache. 371 // Found type test cache.
389 Array& value = Array::Handle(CodePatcher::GetTypeTestArray(loc)); 372 Array& value = Array::Handle(CodePatcher::GetTypeTestArray(loc));
390 const Class& instance_class = Class::Handle(instance.clazz()); 373 const Class& instance_class = Class::Handle(instance.clazz());
391 374
392 #if defined(DEBUG) 375 #if defined(DEBUG)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 const AbstractType& instantiated_dst_type = AbstractType::Handle( 447 const AbstractType& instantiated_dst_type = AbstractType::Handle(
465 dst_type.InstantiateFrom(dst_type_instantiator)); 448 dst_type.InstantiateFrom(dst_type_instantiator));
466 OS::Print("TypeCheck: type '%s' %s a subtype of type '%s' of '%s' " 449 OS::Print("TypeCheck: type '%s' %s a subtype of type '%s' of '%s' "
467 "instantiated from '%s'.\n", 450 "instantiated from '%s'.\n",
468 String::Handle(src_type.Name()).ToCString(), 451 String::Handle(src_type.Name()).ToCString(),
469 is_instance_of ? "is" : "is not", 452 is_instance_of ? "is" : "is not",
470 String::Handle(instantiated_dst_type.Name()).ToCString(), 453 String::Handle(instantiated_dst_type.Name()).ToCString(),
471 dst_name.ToCString(), 454 dst_name.ToCString(),
472 String::Handle(dst_type.Name()).ToCString()); 455 String::Handle(dst_type.Name()).ToCString());
473 } 456 }
474 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 457 DartFrameIterator iterator;
475 StackFrame* caller_frame = GetTopDartFrame(&iterator, false); 458 StackFrame* caller_frame = iterator.NextFrame();
476 const Function& function = Function::Handle( 459 const Function& function = Function::Handle(
477 caller_frame->LookupDartFunction()); 460 caller_frame->LookupDartFunction());
478 OS::Print(" -> Function %s\n", function.ToFullyQualifiedCString()); 461 OS::Print(" -> Function %s\n", function.ToFullyQualifiedCString());
479 } 462 }
480 if (!is_instance_of) { 463 if (!is_instance_of) {
481 String& src_type_name = String::Handle(GetSimpleTypeName(src_instance)); 464 String& src_type_name = String::Handle(GetSimpleTypeName(src_instance));
482 String& dst_type_name = String::Handle(); 465 String& dst_type_name = String::Handle();
483 if (!dst_type.IsInstantiated()) { 466 if (!dst_type.IsInstantiated()) {
484 // Instantiate dst_type before reporting the error. 467 // Instantiate dst_type before reporting the error.
485 const AbstractType& instantiated_dst_type = AbstractType::Handle( 468 const AbstractType& instantiated_dst_type = AbstractType::Handle(
486 dst_type.InstantiateFrom(dst_type_instantiator)); 469 dst_type.InstantiateFrom(dst_type_instantiator));
487 dst_type_name = instantiated_dst_type.Name(); 470 dst_type_name = instantiated_dst_type.Name();
488 } else { 471 } else {
489 dst_type_name = dst_type.Name(); 472 dst_type_name = dst_type.Name();
490 } 473 }
491 String& malformed_error_message = String::Handle(); 474 String& malformed_error_message = String::Handle();
492 if (!malformed_error.IsNull()) { 475 if (!malformed_error.IsNull()) {
493 ASSERT(FLAG_enable_type_checks); 476 ASSERT(FLAG_enable_type_checks);
494 malformed_error_message = String::New(malformed_error.ToErrorCString()); 477 malformed_error_message = String::New(malformed_error.ToErrorCString());
495 } 478 }
496 Exceptions::CreateAndThrowTypeError(location, src_type_name, dst_type_name, 479 Exceptions::CreateAndThrowTypeError(location, src_type_name, dst_type_name,
497 dst_name, malformed_error_message); 480 dst_name, malformed_error_message);
498 UNREACHABLE(); 481 UNREACHABLE();
499 } 482 }
500 // Update cache: add class of instance and result. 483 // Update cache: add class of instance and result.
501 if (dst_type.IsInstantiated() && 484 if (dst_type.IsInstantiated() &&
502 !Class::Handle(dst_type.type_class()).HasTypeArguments()) { 485 !Class::Handle(dst_type.type_class()).HasTypeArguments()) {
503 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 486 DartFrameIterator iterator;
504 StackFrame* caller_frame = GetTopDartFrame(&iterator, false); 487 StackFrame* caller_frame = iterator.NextFrame();
505 const Code& code = Code::Handle(caller_frame->LookupDartCode()); 488 const Code& code = Code::Handle(caller_frame->LookupDartCode());
506 ASSERT(!code.IsNull()); 489 ASSERT(!code.IsNull());
507 uword loc = code.GetTypeTestAtNodeId(node_id); 490 uword loc = code.GetTypeTestAtNodeId(node_id);
508 if (loc != 0) { 491 if (loc != 0) {
509 // Found type test cache. 492 // Found type test cache.
510 Array& value = Array::Handle(CodePatcher::GetTypeTestArray(loc)); 493 Array& value = Array::Handle(CodePatcher::GetTypeTestArray(loc));
511 const Class& src_instance_class = Class::Handle(src_instance.clazz()); 494 const Class& src_instance_class = Class::Handle(src_instance.clazz());
512 495
513 #if defined(DEBUG) 496 #if defined(DEBUG)
514 // Check for duplicate entries. 497 // Check for duplicate entries.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 const Instance& exception = Instance::CheckedHandle(arguments.At(0)); 636 const Instance& exception = Instance::CheckedHandle(arguments.At(0));
654 const Instance& stacktrace = Instance::CheckedHandle(arguments.At(1)); 637 const Instance& stacktrace = Instance::CheckedHandle(arguments.At(1));
655 Exceptions::ReThrow(exception, stacktrace); 638 Exceptions::ReThrow(exception, stacktrace);
656 } 639 }
657 640
658 641
659 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) { 642 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
660 // This function is called after successful resolving and compilation of 643 // This function is called after successful resolving and compilation of
661 // the target method. 644 // the target method.
662 ASSERT(arguments.Count() == kPatchStaticCallRuntimeEntry.argument_count()); 645 ASSERT(arguments.Count() == kPatchStaticCallRuntimeEntry.argument_count());
663 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 646 DartFrameIterator iterator;
664 StackFrame* caller_frame = GetTopDartFrame(&iterator, true); 647 StackFrame* caller_frame = iterator.NextFrame();
665 uword target = 0; 648 uword target = 0;
666 Function& target_function = Function::Handle(); 649 Function& target_function = Function::Handle();
667 CodePatcher::GetStaticCallAt(caller_frame->pc(), &target_function, &target); 650 CodePatcher::GetStaticCallAt(caller_frame->pc(), &target_function, &target);
668 ASSERT(target_function.HasCode()); 651 ASSERT(target_function.HasCode());
669 uword new_target = Code::Handle(target_function.CurrentCode()).EntryPoint(); 652 uword new_target = Code::Handle(target_function.CurrentCode()).EntryPoint();
670 // Verify that we are not patching repeatedly. 653 // Verify that we are not patching repeatedly.
671 ASSERT(target != new_target); 654 ASSERT(target != new_target);
672 CodePatcher::PatchStaticCallAt(caller_frame->pc(), new_target); 655 CodePatcher::PatchStaticCallAt(caller_frame->pc(), new_target);
673 if (FLAG_trace_patching) { 656 if (FLAG_trace_patching) {
674 OS::Print("PatchStaticCall: patching from 0x%x to '%s' 0x%x\n", 657 OS::Print("PatchStaticCall: patching from 0x%x to '%s' 0x%x\n",
675 caller_frame->pc(), 658 caller_frame->pc(),
676 target_function.ToFullyQualifiedCString(), 659 target_function.ToFullyQualifiedCString(),
677 new_target); 660 new_target);
678 } 661 }
679 } 662 }
680 663
681 664
682 // Resolves and compiles the target function of an instance call, updates 665 // Resolves and compiles the target function of an instance call, updates
683 // function cache of the receiver's class and returns the compiled code or null. 666 // function cache of the receiver's class and returns the compiled code or null.
684 // Only the number of named arguments is checked, but not the actual names. 667 // Only the number of named arguments is checked, but not the actual names.
685 RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate, 668 RawCode* ResolveCompileInstanceCallTarget(Isolate* isolate,
686 const Instance& receiver) { 669 const Instance& receiver) {
687 int num_arguments = -1; 670 int num_arguments = -1;
688 int num_named_arguments = -1; 671 int num_named_arguments = -1;
689 uword target = 0; 672 uword target = 0;
690 String& function_name = String::Handle(); 673 String& function_name = String::Handle();
691 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 674 DartFrameIterator iterator;
692 StackFrame* caller_frame = GetTopDartFrame(&iterator, true); 675 StackFrame* caller_frame = iterator.NextFrame();
693 CodePatcher::GetInstanceCallAt(caller_frame->pc(), 676 CodePatcher::GetInstanceCallAt(caller_frame->pc(),
694 &function_name, 677 &function_name,
695 &num_arguments, 678 &num_arguments,
696 &num_named_arguments, 679 &num_named_arguments,
697 &target); 680 &target);
698 ASSERT(function_name.IsSymbol()); 681 ASSERT(function_name.IsSymbol());
699 Class& receiver_class = Class::Handle(); 682 Class& receiver_class = Class::Handle();
700 if (receiver.IsNull()) { 683 if (receiver.IsNull()) {
701 // TODO(srdjan): Clarify behavior of null objects. 684 // TODO(srdjan): Clarify behavior of null objects.
702 receiver_class = isolate->object_store()->object_class(); 685 receiver_class = isolate->object_store()->object_class();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 // Null dispatch is slow (e.g., (null).toCString()). The only 803 // Null dispatch is slow (e.g., (null).toCString()). The only
821 // fast execution with null receiver is the "==" operator. 804 // fast execution with null receiver is the "==" operator.
822 // Special handling so that we do not pollute the inline cache with null 805 // Special handling so that we do not pollute the inline cache with null
823 // classes. 806 // classes.
824 if (FLAG_trace_ic) { 807 if (FLAG_trace_ic) {
825 OS::Print("InlineCacheMissHandler Null receiver target %s\n", 808 OS::Print("InlineCacheMissHandler Null receiver target %s\n",
826 target_function.ToCString()); 809 target_function.ToCString());
827 } 810 }
828 return target_function.raw(); 811 return target_function.raw();
829 } 812 }
830 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 813 DartFrameIterator iterator;
831 StackFrame* caller_frame = GetTopDartFrame(&iterator, true); 814 StackFrame* caller_frame = iterator.NextFrame();
832 ICData& ic_data = ICData::Handle( 815 ICData& ic_data = ICData::Handle(
833 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc())); 816 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc()));
834 #if defined(DEBUG) 817 #if defined(DEBUG)
835 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { 818 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
836 GrowableArray<const Class*> classes; 819 GrowableArray<const Class*> classes;
837 Function& target = Function::Handle(); 820 Function& target = Function::Handle();
838 ic_data.GetCheckAt(i, &classes, &target); 821 ic_data.GetCheckAt(i, &classes, &target);
839 bool matches = true; 822 bool matches = true;
840 for (intptr_t k = 0; k < classes.length(); k++) { 823 for (intptr_t k = 0; k < classes.length(); k++) {
841 if (classes[k]->raw() != args[k]->clazz()) { 824 if (classes[k]->raw() != args[k]->clazz()) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 // The caller must be a static call in a Dart frame, or an entry frame. 1238 // The caller must be a static call in a Dart frame, or an entry frame.
1256 // Patch static call to point to 'new_entry_point'. 1239 // Patch static call to point to 'new_entry_point'.
1257 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 1) { 1240 DEFINE_RUNTIME_ENTRY(FixCallersTarget, 1) {
1258 ASSERT(arguments.Count() == kFixCallersTargetRuntimeEntry.argument_count()); 1241 ASSERT(arguments.Count() == kFixCallersTargetRuntimeEntry.argument_count());
1259 const Function& function = Function::CheckedHandle(arguments.At(0)); 1242 const Function& function = Function::CheckedHandle(arguments.At(0));
1260 ASSERT(!function.IsNull()); 1243 ASSERT(!function.IsNull());
1261 ASSERT(function.HasCode()); 1244 ASSERT(function.HasCode());
1262 1245
1263 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 1246 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
1264 StackFrame* frame = iterator.NextFrame(); 1247 StackFrame* frame = iterator.NextFrame();
1265 while (frame != NULL && !frame->IsDartFrame() && !frame->IsEntryFrame()) { 1248 while (frame != NULL && (frame->IsStubFrame() || frame->IsExitFrame())) {
1266 frame = iterator.NextFrame(); 1249 frame = iterator.NextFrame();
1267 } 1250 }
1268 ASSERT(frame != NULL); 1251 ASSERT(frame != NULL);
1269 if (frame->IsDartFrame()) { 1252 if (!frame->IsEntryFrame()) {
1253 ASSERT(frame->IsDartFrame());
1270 uword target = 0; 1254 uword target = 0;
1271 Function& target_function = Function::Handle(); 1255 Function& target_function = Function::Handle();
1272 CodePatcher::GetStaticCallAt(frame->pc(), &target_function, &target); 1256 CodePatcher::GetStaticCallAt(frame->pc(), &target_function, &target);
1273 ASSERT(target_function.HasCode()); 1257 ASSERT(target_function.HasCode());
1274 const uword new_entry_point = 1258 const uword new_entry_point =
1275 Code::Handle(function.CurrentCode()).EntryPoint(); 1259 Code::Handle(function.CurrentCode()).EntryPoint();
1276 ASSERT(target != new_entry_point); // Why patch otherwise. 1260 ASSERT(target != new_entry_point); // Why patch otherwise.
1277 CodePatcher::PatchStaticCallAt(frame->pc(), new_entry_point); 1261 CodePatcher::PatchStaticCallAt(frame->pc(), new_entry_point);
1278 if (FLAG_trace_patching) { 1262 if (FLAG_trace_patching) {
1279 OS::Print("FixCallersTarget: patching from 0x%x to '%s' 0x%x\n", 1263 OS::Print("FixCallersTarget: patching from 0x%x to '%s' 0x%x\n",
1280 frame->pc(), 1264 frame->pc(),
1281 target_function.ToFullyQualifiedCString(), 1265 target_function.ToFullyQualifiedCString(),
1282 new_entry_point); 1266 new_entry_point);
1283 } 1267 }
1284 } 1268 }
1285 } 1269 }
1286 1270
1287 1271
1288 // The top Dart frame belongs to the optimized method that needs to be 1272 // The top Dart frame belongs to the optimized method that needs to be
1289 // deoptimized. The pc of the Dart frame points to the deoptimization point. 1273 // deoptimized. The pc of the Dart frame points to the deoptimization point.
1290 // Find the node id of the deoptimization point and find the continuation 1274 // Find the node id of the deoptimization point and find the continuation
1291 // pc in the unoptimized code. 1275 // pc in the unoptimized code.
1292 // Since both unoptimized and optimized code have the same layout, we need only 1276 // Since both unoptimized and optimized code have the same layout, we need only
1293 // to patch the pc of the Dart frame and to disable/enable appropriate code. 1277 // to patch the pc of the Dart frame and to disable/enable appropriate code.
1294 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) { 1278 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) {
1295 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); 1279 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count());
1296 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0)); 1280 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0));
1297 StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames); 1281 DartFrameIterator iterator;
1298 StackFrame* caller_frame = GetTopDartFrame(&iterator, true); 1282 StackFrame* caller_frame = iterator.NextFrame();
1299 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); 1283 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode());
1300 const Function& function = Function::Handle(optimized_code.function()); 1284 const Function& function = Function::Handle(optimized_code.function());
1301 ASSERT(!function.IsNull()); 1285 ASSERT(!function.IsNull());
1302 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); 1286 const Code& unoptimized_code = Code::Handle(function.unoptimized_code());
1303 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); 1287 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized());
1304 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); 1288 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized());
1305 const PcDescriptors& descriptors = 1289 const PcDescriptors& descriptors =
1306 PcDescriptors::Handle(optimized_code.pc_descriptors()); 1290 PcDescriptors::Handle(optimized_code.pc_descriptors());
1307 ASSERT(!descriptors.IsNull()); 1291 ASSERT(!descriptors.IsNull());
1308 // Locate node id at deoptimization point inside optimized code. 1292 // Locate node id at deoptimization point inside optimized code.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 } 1423 }
1440 } 1424 }
1441 } 1425 }
1442 // The cache is null terminated, therefore the loop above should never 1426 // The cache is null terminated, therefore the loop above should never
1443 // terminate by itself. 1427 // terminate by itself.
1444 UNREACHABLE(); 1428 UNREACHABLE();
1445 return Code::null(); 1429 return Code::null();
1446 } 1430 }
1447 1431
1448 } // namespace dart 1432 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/gc_marker.cc » ('j') | vm/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698