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