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

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

Issue 1609983002: Precompilation: drop Field objects unless they are an entry point or referenced from a constant poo… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/precompiler.cc » ('j') | runtime/vm/precompiler.cc » ('J')
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 #ifndef VM_PRECOMPILER_H_ 5 #ifndef VM_PRECOMPILER_H_
6 #define VM_PRECOMPILER_H_ 6 #define VM_PRECOMPILER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 static inline bool IsKeyEqual(Pair pair, Key key) { 82 static inline bool IsKeyEqual(Pair pair, Key key) {
83 return pair->raw() == key->raw(); 83 return pair->raw() == key->raw();
84 } 84 }
85 }; 85 };
86 86
87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet; 87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet;
88 88
89 89
90 class FieldKeyValueTrait {
91 public:
92 // Typedefs needed for the DirectChainedHashMap template.
93 typedef const Field* Key;
94 typedef const Field* Value;
95 typedef const Field* Pair;
96
97 static Key KeyOf(Pair kv) { return kv; }
98
99 static Value ValueOf(Pair kv) { return kv; }
100
101 static inline intptr_t Hashcode(Key key) {
102 return key->token_pos();
103 }
104
105 static inline bool IsKeyEqual(Pair pair, Key key) {
106 return pair->raw() == key->raw();
107 }
108 };
109
110 typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet;
111
112
90 class Precompiler : public ValueObject { 113 class Precompiler : public ValueObject {
91 public: 114 public:
92 static RawError* CompileAll( 115 static RawError* CompileAll(
93 Dart_QualifiedFunctionName embedder_entry_points[], 116 Dart_QualifiedFunctionName embedder_entry_points[],
94 bool reset_fields); 117 bool reset_fields);
95 118
96 // Returns named function that is a unique dynamic target, i.e., 119 // Returns named function that is a unique dynamic target, i.e.,
97 // - the target is identified by its name alone, since it occurs only once. 120 // - the target is identified by its name alone, since it occurs only once.
98 // - target's class has no subclasses, and neither is subclassed, i.e., 121 // - target's class has no subclasses, and neither is subclassed, i.e.,
99 // the receiver type can be only the function's class. 122 // the receiver type can be only the function's class.
(...skipping 18 matching lines...) Expand all
118 void AddField(const Field& field); 141 void AddField(const Field& field);
119 void AddFunction(const Function& function); 142 void AddFunction(const Function& function);
120 void AddInstantiatedClass(const Class& cls); 143 void AddInstantiatedClass(const Class& cls);
121 void AddSelector(const String& selector); 144 void AddSelector(const String& selector);
122 bool IsSent(const String& selector); 145 bool IsSent(const String& selector);
123 146
124 void ProcessFunction(const Function& function); 147 void ProcessFunction(const Function& function);
125 void CheckForNewDynamicFunctions(); 148 void CheckForNewDynamicFunctions();
126 149
127 void DropUncompiledFunctions(); 150 void DropUncompiledFunctions();
151 void DropFields();
128 void CollectDynamicFunctionNames(); 152 void CollectDynamicFunctionNames();
129 void BindStaticCalls(); 153 void BindStaticCalls();
130 void DedupStackmaps(); 154 void DedupStackmaps();
131 void ResetPrecompilerState(); 155 void ResetPrecompilerState();
132 156
133 class FunctionVisitor : public ValueObject { 157 class FunctionVisitor : public ValueObject {
134 public: 158 public:
135 virtual ~FunctionVisitor() {} 159 virtual ~FunctionVisitor() {}
136 virtual void VisitFunction(const Function& function) = 0; 160 virtual void VisitFunction(const Function& function) = 0;
137 }; 161 };
(...skipping 10 matching lines...) Expand all
148 Zone* zone_; 172 Zone* zone_;
149 Isolate* isolate_; 173 Isolate* isolate_;
150 174
151 const bool reset_fields_; 175 const bool reset_fields_;
152 176
153 bool changed_; 177 bool changed_;
154 intptr_t function_count_; 178 intptr_t function_count_;
155 intptr_t class_count_; 179 intptr_t class_count_;
156 intptr_t selector_count_; 180 intptr_t selector_count_;
157 intptr_t dropped_function_count_; 181 intptr_t dropped_function_count_;
182 intptr_t dropped_field_count_;
158 183
159 const GrowableObjectArray& libraries_; 184 const GrowableObjectArray& libraries_;
160 const GrowableObjectArray& pending_functions_; 185 const GrowableObjectArray& pending_functions_;
161 SymbolSet sent_selectors_; 186 SymbolSet sent_selectors_;
162 FunctionSet enqueued_functions_; 187 FunctionSet enqueued_functions_;
188 FieldSet fields_to_retain_;
163 Error& error_; 189 Error& error_;
164 }; 190 };
165 191
166 } // namespace dart 192 } // namespace dart
167 193
168 #endif // VM_PRECOMPILER_H_ 194 #endif // VM_PRECOMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/precompiler.cc » ('j') | runtime/vm/precompiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698