OLD | NEW |
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/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 code.set_deopt_info_array(deopt_info_array); | 751 code.set_deopt_info_array(deopt_info_array); |
752 | 752 |
753 graph_compiler.FinalizeStackmaps(code); | 753 graph_compiler.FinalizeStackmaps(code); |
754 graph_compiler.FinalizeVarDescriptors(code); | 754 graph_compiler.FinalizeVarDescriptors(code); |
755 graph_compiler.FinalizeExceptionHandlers(code); | 755 graph_compiler.FinalizeExceptionHandlers(code); |
756 graph_compiler.FinalizeStaticCallTargetsTable(code); | 756 graph_compiler.FinalizeStaticCallTargetsTable(code); |
757 | 757 |
758 if (optimized) { | 758 if (optimized) { |
759 // We may not have previous code if 'always_optimize' is set. | 759 // We may not have previous code if 'always_optimize' is set. |
760 if ((osr_id == Isolate::kNoDeoptId) && function.HasCode()) { | 760 if ((osr_id == Isolate::kNoDeoptId) && function.HasCode()) { |
761 CodePatcher::PatchEntry( | 761 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); |
762 Code::Handle(function.CurrentCode()), | |
763 Code::Handle(StubCode::FixCallersTarget_entry()->code())); | |
764 if (FLAG_trace_compiler || FLAG_trace_patching) { | 762 if (FLAG_trace_compiler || FLAG_trace_patching) { |
765 if (FLAG_trace_compiler) { | 763 if (FLAG_trace_compiler) { |
766 THR_Print(" "); | 764 THR_Print(" "); |
767 } | 765 } |
768 THR_Print("Patch unoptimized '%s' entry point %#" Px "\n", | 766 THR_Print("Patch unoptimized '%s' entry point %#" Px "\n", |
769 function.ToFullyQualifiedCString(), | 767 function.ToFullyQualifiedCString(), |
770 Code::Handle(function.unoptimized_code()).EntryPoint()); | 768 Code::Handle(function.unoptimized_code()).EntryPoint()); |
771 } | 769 } |
772 } | 770 } |
773 function.AttachCode(code); | 771 function.AttachCode(code); |
(...skipping 11 matching lines...) Expand all Loading... |
785 const Field* field = (*flow_graph->guarded_fields())[i]; | 783 const Field* field = (*flow_graph->guarded_fields())[i]; |
786 field->RegisterDependentCode(code); | 784 field->RegisterDependentCode(code); |
787 } | 785 } |
788 } else { // not optimized. | 786 } else { // not optimized. |
789 if (!Compiler::always_optimize() && | 787 if (!Compiler::always_optimize() && |
790 (function.ic_data_array() == Array::null())) { | 788 (function.ic_data_array() == Array::null())) { |
791 function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data()); | 789 function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data()); |
792 } | 790 } |
793 function.set_unoptimized_code(code); | 791 function.set_unoptimized_code(code); |
794 function.AttachCode(code); | 792 function.AttachCode(code); |
| 793 ASSERT(CodePatcher::CodeIsPatchable(code)); |
795 } | 794 } |
796 if (parsed_function->HasDeferredPrefixes()) { | 795 if (parsed_function->HasDeferredPrefixes()) { |
797 ASSERT(!FLAG_load_deferred_eagerly); | 796 ASSERT(!FLAG_load_deferred_eagerly); |
798 ZoneGrowableArray<const LibraryPrefix*>* prefixes = | 797 ZoneGrowableArray<const LibraryPrefix*>* prefixes = |
799 parsed_function->deferred_prefixes(); | 798 parsed_function->deferred_prefixes(); |
800 for (intptr_t i = 0; i < prefixes->length(); i++) { | 799 for (intptr_t i = 0; i < prefixes->length(); i++) { |
801 (*prefixes)[i]->RegisterDependentCode(code); | 800 (*prefixes)[i]->RegisterDependentCode(code); |
802 } | 801 } |
803 } | 802 } |
804 } | 803 } |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 const Object& result = | 1419 const Object& result = |
1421 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1420 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
1422 isolate->object_store()->clear_sticky_error(); | 1421 isolate->object_store()->clear_sticky_error(); |
1423 return result.raw(); | 1422 return result.raw(); |
1424 } | 1423 } |
1425 UNREACHABLE(); | 1424 UNREACHABLE(); |
1426 return Object::null(); | 1425 return Object::null(); |
1427 } | 1426 } |
1428 | 1427 |
1429 } // namespace dart | 1428 } // namespace dart |
OLD | NEW |