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(Thread* thread, | 359 static RawError* CompileFunction(Precompiler* precompiler, |
| 360 Thread* thread, |
360 Zone* zone, | 361 Zone* zone, |
361 const Function& function, | 362 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 |
370 private: | 379 private: |
371 Precompiler(Thread* thread, bool reset_fields); | 380 Precompiler(Thread* thread, bool reset_fields); |
372 | 381 |
373 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 382 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
374 void ClearAllCode(); | 383 void ClearAllCode(); |
375 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 384 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
376 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 385 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
377 void Iterate(); | 386 void Iterate(); |
378 | 387 |
379 void AddType(const AbstractType& type); | 388 void AddType(const AbstractType& type); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 SymbolSet sent_selectors_; | 468 SymbolSet sent_selectors_; |
460 FunctionSet enqueued_functions_; | 469 FunctionSet enqueued_functions_; |
461 FieldSet fields_to_retain_; | 470 FieldSet fields_to_retain_; |
462 FunctionSet functions_to_retain_; | 471 FunctionSet functions_to_retain_; |
463 ClassSet classes_to_retain_; | 472 ClassSet classes_to_retain_; |
464 TypeArgumentsSet typeargs_to_retain_; | 473 TypeArgumentsSet typeargs_to_retain_; |
465 AbstractTypeSet types_to_retain_; | 474 AbstractTypeSet types_to_retain_; |
466 InstanceSet consts_to_retain_; | 475 InstanceSet consts_to_retain_; |
467 FieldTypeMap field_type_map_; | 476 FieldTypeMap field_type_map_; |
468 Error& error_; | 477 Error& error_; |
| 478 |
| 479 bool get_runtime_type_is_unique_; |
469 }; | 480 }; |
470 | 481 |
471 | 482 |
472 class FunctionsTraits { | 483 class FunctionsTraits { |
473 public: | 484 public: |
474 static const char* Name() { return "FunctionsTraits"; } | 485 static const char* Name() { return "FunctionsTraits"; } |
475 static bool ReportStats() { return false; } | 486 static bool ReportStats() { return false; } |
476 | 487 |
477 static bool IsMatch(const Object& a, const Object& b) { | 488 static bool IsMatch(const Object& a, const Object& b) { |
478 Zone* zone = Thread::Current()->zone(); | 489 Zone* zone = Thread::Current()->zone(); |
(...skipping 16 matching lines...) Expand all Loading... |
495 return function.raw(); | 506 return function.raw(); |
496 } | 507 } |
497 }; | 508 }; |
498 | 509 |
499 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 510 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
500 | 511 |
501 | 512 |
502 } // namespace dart | 513 } // namespace dart |
503 | 514 |
504 #endif // VM_PRECOMPILER_H_ | 515 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |