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

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

Issue 1436243005: Collect closure functions in isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.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/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 735 }
736 } 736 }
737 } 737 }
738 738
739 functions = Array::New(retained_functions.Length(), Heap::kOld); 739 functions = Array::New(retained_functions.Length(), Heap::kOld);
740 for (intptr_t j = 0; j < retained_functions.Length(); j++) { 740 for (intptr_t j = 0; j < retained_functions.Length(); j++) {
741 function ^= retained_functions.At(j); 741 function ^= retained_functions.At(j);
742 functions.SetAt(j, function); 742 functions.SetAt(j, function);
743 } 743 }
744 cls.SetFunctions(functions); 744 cls.SetFunctions(functions);
745 }
746 }
745 747
746 closures = cls.closures(); 748 closures = isolate()->object_store()->closure_functions();
747 if (!closures.IsNull()) { 749 retained_functions = GrowableObjectArray::New();
748 retained_functions = GrowableObjectArray::New(); 750 for (intptr_t j = 0; j < closures.Length(); j++) {
749 for (intptr_t j = 0; j < closures.Length(); j++) { 751 function ^= closures.At(j);
750 function ^= closures.At(j); 752 if (function.HasCode()) {
751 if (function.HasCode()) { 753 retained_functions.Add(function);
752 retained_functions.Add(function); 754 } else {
753 } else { 755 dropped_function_count_++;
754 dropped_function_count_++; 756 if (FLAG_trace_precompiler) {
755 if (FLAG_trace_precompiler) { 757 THR_Print("Precompilation dropping %s\n",
756 THR_Print("Precompilation dropping %s\n", 758 function.ToLibNamePrefixedQualifiedCString());
757 function.ToLibNamePrefixedQualifiedCString());
758 }
759 }
760 }
761 cls.set_closures(retained_functions);
762 } 759 }
763 } 760 }
764 } 761 }
762 isolate()->object_store()->set_closure_functions(retained_functions);
765 } 763 }
766 764
767 765
768 void Precompiler::BindStaticCalls() { 766 void Precompiler::BindStaticCalls() {
769 class BindStaticCallsVisitor : public FunctionVisitor { 767 class BindStaticCallsVisitor : public FunctionVisitor {
770 public: 768 public:
771 explicit BindStaticCallsVisitor(Zone* zone) : 769 explicit BindStaticCallsVisitor(Zone* zone) :
772 code_(Code::Handle(zone)), 770 code_(Code::Handle(zone)),
773 table_(Array::Handle(zone)), 771 table_(Array::Handle(zone)),
774 pc_offset_(Smi::Handle(zone)), 772 pc_offset_(Smi::Handle(zone)),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 885
888 functions = cls.functions(); 886 functions = cls.functions();
889 for (intptr_t j = 0; j < functions.Length(); j++) { 887 for (intptr_t j = 0; j < functions.Length(); j++) {
890 function ^= functions.At(j); 888 function ^= functions.At(j);
891 visitor->VisitFunction(function); 889 visitor->VisitFunction(function);
892 if (function.HasImplicitClosureFunction()) { 890 if (function.HasImplicitClosureFunction()) {
893 function = function.ImplicitClosureFunction(); 891 function = function.ImplicitClosureFunction();
894 visitor->VisitFunction(function); 892 visitor->VisitFunction(function);
895 } 893 }
896 } 894 }
897
898 closures = cls.closures();
899 if (!closures.IsNull()) {
900 for (intptr_t j = 0; j < closures.Length(); j++) {
901 function ^= closures.At(j);
902 visitor->VisitFunction(function);
903 }
904 }
905 } 895 }
906 } 896 }
897 closures = isolate()->object_store()->closure_functions();
898 for (intptr_t j = 0; j < closures.Length(); j++) {
899 function ^= closures.At(j);
900 visitor->VisitFunction(function);
901 }
907 } 902 }
908 903
909 904
910 void Precompiler::FinalizeAllClasses() { 905 void Precompiler::FinalizeAllClasses() {
911 Library& lib = Library::Handle(Z); 906 Library& lib = Library::Handle(Z);
912 Class& cls = Class::Handle(Z); 907 Class& cls = Class::Handle(Z);
913 908
914 for (intptr_t i = 0; i < libraries_.Length(); i++) { 909 for (intptr_t i = 0; i < libraries_.Length(); i++) {
915 lib ^= libraries_.At(i); 910 lib ^= libraries_.At(i);
916 if (!lib.Loaded()) { 911 if (!lib.Loaded()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 cls = it.GetNextClass(); 949 cls = it.GetNextClass();
955 if (cls.IsDynamicClass()) { 950 if (cls.IsDynamicClass()) {
956 continue; // class 'dynamic' is in the read-only VM isolate. 951 continue; // class 'dynamic' is in the read-only VM isolate.
957 } 952 }
958 cls.set_is_allocated(false); 953 cls.set_is_allocated(false);
959 } 954 }
960 } 955 }
961 } 956 }
962 957
963 } // namespace dart 958 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698