| OLD | NEW |
| 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/hash_table.h" | 10 #include "vm/hash_table.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 | 230 |
| 231 static inline bool IsKeyEqual(Pair pair, Key key) { | 231 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 232 return pair->raw() == key->raw(); | 232 return pair->raw() == key->raw(); |
| 233 } | 233 } |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet; | 236 typedef DirectChainedHashMap<TypeArgumentsKeyValueTrait> TypeArgumentsSet; |
| 237 | 237 |
| 238 | 238 |
| 239 class InstanceKeyValueTrait { |
| 240 public: |
| 241 // Typedefs needed for the DirectChainedHashMap template. |
| 242 typedef const Instance* Key; |
| 243 typedef const Instance* Value; |
| 244 typedef const Instance* Pair; |
| 245 |
| 246 static Key KeyOf(Pair kv) { return kv; } |
| 247 |
| 248 static Value ValueOf(Pair kv) { return kv; } |
| 249 |
| 250 static inline intptr_t Hashcode(Key key) { |
| 251 return key->GetClassId(); |
| 252 } |
| 253 |
| 254 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 255 return pair->raw() == key->raw(); |
| 256 } |
| 257 }; |
| 258 |
| 259 typedef DirectChainedHashMap<InstanceKeyValueTrait> InstanceSet; |
| 260 |
| 261 |
| 239 class Precompiler : public ValueObject { | 262 class Precompiler : public ValueObject { |
| 240 public: | 263 public: |
| 241 static RawError* CompileAll( | 264 static RawError* CompileAll( |
| 242 Dart_QualifiedFunctionName embedder_entry_points[], | 265 Dart_QualifiedFunctionName embedder_entry_points[], |
| 243 bool reset_fields); | 266 bool reset_fields); |
| 244 | 267 |
| 245 // Returns named function that is a unique dynamic target, i.e., | 268 // Returns named function that is a unique dynamic target, i.e., |
| 246 // - the target is identified by its name alone, since it occurs only once. | 269 // - the target is identified by its name alone, since it occurs only once. |
| 247 // - target's class has no subclasses, and neither is subclassed, i.e., | 270 // - target's class has no subclasses, and neither is subclassed, i.e., |
| 248 // the receiver type can be only the function's class. | 271 // the receiver type can be only the function's class. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 277 void AddConstObject(const Instance& instance); | 300 void AddConstObject(const Instance& instance); |
| 278 void AddClosureCall(const ICData& call_site); | 301 void AddClosureCall(const ICData& call_site); |
| 279 void AddField(const Field& field); | 302 void AddField(const Field& field); |
| 280 void AddFunction(const Function& function); | 303 void AddFunction(const Function& function); |
| 281 void AddInstantiatedClass(const Class& cls); | 304 void AddInstantiatedClass(const Class& cls); |
| 282 void AddSelector(const String& selector); | 305 void AddSelector(const String& selector); |
| 283 bool IsSent(const String& selector); | 306 bool IsSent(const String& selector); |
| 284 | 307 |
| 285 void ProcessFunction(const Function& function); | 308 void ProcessFunction(const Function& function); |
| 286 void CheckForNewDynamicFunctions(); | 309 void CheckForNewDynamicFunctions(); |
| 310 void TraceConstFunctions(); |
| 287 | 311 |
| 288 void DropFunctions(); | 312 void DropFunctions(); |
| 289 void DropFields(); | 313 void DropFields(); |
| 290 void TraceTypesFromRetainedClasses(); | 314 void TraceTypesFromRetainedClasses(); |
| 291 void DropTypes(); | 315 void DropTypes(); |
| 292 void DropTypeArguments(); | 316 void DropTypeArguments(); |
| 293 void DropClasses(); | 317 void DropClasses(); |
| 294 void DropLibraries(); | 318 void DropLibraries(); |
| 295 | 319 |
| 296 void BindStaticCalls(); | 320 void BindStaticCalls(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 intptr_t dropped_library_count_; | 357 intptr_t dropped_library_count_; |
| 334 | 358 |
| 335 GrowableObjectArray& libraries_; | 359 GrowableObjectArray& libraries_; |
| 336 const GrowableObjectArray& pending_functions_; | 360 const GrowableObjectArray& pending_functions_; |
| 337 SymbolSet sent_selectors_; | 361 SymbolSet sent_selectors_; |
| 338 FunctionSet enqueued_functions_; | 362 FunctionSet enqueued_functions_; |
| 339 FieldSet fields_to_retain_; | 363 FieldSet fields_to_retain_; |
| 340 ClassSet classes_to_retain_; | 364 ClassSet classes_to_retain_; |
| 341 TypeArgumentsSet typeargs_to_retain_; | 365 TypeArgumentsSet typeargs_to_retain_; |
| 342 AbstractTypeSet types_to_retain_; | 366 AbstractTypeSet types_to_retain_; |
| 367 InstanceSet consts_to_retain_; |
| 343 Error& error_; | 368 Error& error_; |
| 344 }; | 369 }; |
| 345 | 370 |
| 346 | 371 |
| 347 class FunctionsTraits { | 372 class FunctionsTraits { |
| 348 public: | 373 public: |
| 349 static bool IsMatch(const Object& a, const Object& b) { | 374 static bool IsMatch(const Object& a, const Object& b) { |
| 350 Zone* zone = Thread::Current()->zone(); | 375 Zone* zone = Thread::Current()->zone(); |
| 351 String& a_s = String::Handle(zone); | 376 String& a_s = String::Handle(zone); |
| 352 String& b_s = String::Handle(zone); | 377 String& b_s = String::Handle(zone); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 367 return function.raw(); | 392 return function.raw(); |
| 368 } | 393 } |
| 369 }; | 394 }; |
| 370 | 395 |
| 371 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 396 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
| 372 | 397 |
| 373 | 398 |
| 374 } // namespace dart | 399 } // namespace dart |
| 375 | 400 |
| 376 #endif // VM_PRECOMPILER_H_ | 401 #endif // VM_PRECOMPILER_H_ |
| OLD | NEW |