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