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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap; | 350 typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap; |
351 | 351 |
352 | 352 |
353 class Precompiler : public ValueObject { | 353 class Precompiler : public ValueObject { |
354 public: | 354 public: |
355 static RawError* CompileAll( | 355 static RawError* CompileAll( |
356 Dart_QualifiedFunctionName embedder_entry_points[], | 356 Dart_QualifiedFunctionName embedder_entry_points[], |
357 bool reset_fields); | 357 bool reset_fields); |
358 | 358 |
359 static RawError* CompileFunction(Precompiler* precompiler, | 359 static RawError* CompileFunction(Thread* thread, |
360 Thread* thread, | |
361 Zone* zone, | 360 Zone* zone, |
362 const Function& function); | 361 const Function& function, |
| 362 FieldTypeMap* field_type_map = NULL); |
363 | 363 |
364 static RawObject* EvaluateStaticInitializer(const Field& field); | 364 static RawObject* EvaluateStaticInitializer(const Field& field); |
365 static RawObject* ExecuteOnce(SequenceNode* fragment); | 365 static RawObject* ExecuteOnce(SequenceNode* fragment); |
366 | 366 |
367 static RawFunction* CompileStaticInitializer(const Field& field, | 367 static RawFunction* CompileStaticInitializer(const Field& field, |
368 bool compute_type); | 368 bool compute_type); |
369 | 369 |
370 // Returns true if get:runtimeType is not overloaded by any class. | |
371 bool get_runtime_type_is_unique() const { | |
372 return get_runtime_type_is_unique_; | |
373 } | |
374 | |
375 FieldTypeMap* field_type_map() { | |
376 return &field_type_map_; | |
377 } | |
378 | |
379 private: | 370 private: |
380 Precompiler(Thread* thread, bool reset_fields); | 371 Precompiler(Thread* thread, bool reset_fields); |
381 | 372 |
382 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 373 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
383 void ClearAllCode(); | 374 void ClearAllCode(); |
384 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 375 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
385 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 376 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
386 void Iterate(); | 377 void Iterate(); |
387 | 378 |
388 void AddType(const AbstractType& type); | 379 void AddType(const AbstractType& type); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 SymbolSet sent_selectors_; | 459 SymbolSet sent_selectors_; |
469 FunctionSet enqueued_functions_; | 460 FunctionSet enqueued_functions_; |
470 FieldSet fields_to_retain_; | 461 FieldSet fields_to_retain_; |
471 FunctionSet functions_to_retain_; | 462 FunctionSet functions_to_retain_; |
472 ClassSet classes_to_retain_; | 463 ClassSet classes_to_retain_; |
473 TypeArgumentsSet typeargs_to_retain_; | 464 TypeArgumentsSet typeargs_to_retain_; |
474 AbstractTypeSet types_to_retain_; | 465 AbstractTypeSet types_to_retain_; |
475 InstanceSet consts_to_retain_; | 466 InstanceSet consts_to_retain_; |
476 FieldTypeMap field_type_map_; | 467 FieldTypeMap field_type_map_; |
477 Error& error_; | 468 Error& error_; |
478 | |
479 bool get_runtime_type_is_unique_; | |
480 }; | 469 }; |
481 | 470 |
482 | 471 |
483 class FunctionsTraits { | 472 class FunctionsTraits { |
484 public: | 473 public: |
485 static const char* Name() { return "FunctionsTraits"; } | 474 static const char* Name() { return "FunctionsTraits"; } |
486 static bool ReportStats() { return false; } | 475 static bool ReportStats() { return false; } |
487 | 476 |
488 static bool IsMatch(const Object& a, const Object& b) { | 477 static bool IsMatch(const Object& a, const Object& b) { |
489 Zone* zone = Thread::Current()->zone(); | 478 Zone* zone = Thread::Current()->zone(); |
(...skipping 16 matching lines...) Expand all Loading... |
506 return function.raw(); | 495 return function.raw(); |
507 } | 496 } |
508 }; | 497 }; |
509 | 498 |
510 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 499 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
511 | 500 |
512 | 501 |
513 } // namespace dart | 502 } // namespace dart |
514 | 503 |
515 #endif // VM_PRECOMPILER_H_ | 504 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |