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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 Value value_; | 379 Value value_; |
380 }; | 380 }; |
381 | 381 |
382 typedef DirectChainedHashMap<FunctionFeedbackPair> FunctionFeedbackMap; | 382 typedef DirectChainedHashMap<FunctionFeedbackPair> FunctionFeedbackMap; |
383 | 383 |
384 | 384 |
385 class Precompiler : public ValueObject { | 385 class Precompiler : public ValueObject { |
386 public: | 386 public: |
387 static RawError* CompileAll( | 387 static RawError* CompileAll( |
388 Dart_QualifiedFunctionName embedder_entry_points[], | 388 Dart_QualifiedFunctionName embedder_entry_points[], |
389 bool reset_fields, | |
390 uint8_t* jit_feedback, | 389 uint8_t* jit_feedback, |
391 intptr_t jit_feedback_length); | 390 intptr_t jit_feedback_length); |
392 | 391 |
393 static RawError* CompileFunction(Precompiler* precompiler, | 392 static RawError* CompileFunction(Precompiler* precompiler, |
394 Thread* thread, | 393 Thread* thread, |
395 Zone* zone, | 394 Zone* zone, |
396 const Function& function, | 395 const Function& function, |
397 FieldTypeMap* field_type_map = NULL); | 396 FieldTypeMap* field_type_map = NULL); |
398 | 397 |
399 static RawObject* EvaluateStaticInitializer(const Field& field); | 398 static RawObject* EvaluateStaticInitializer(const Field& field); |
(...skipping 12 matching lines...) Expand all Loading... |
412 void set_type_range_cache(TypeRangeCache* value) { | 411 void set_type_range_cache(TypeRangeCache* value) { |
413 type_range_cache_ = value; | 412 type_range_cache_ = value; |
414 } | 413 } |
415 | 414 |
416 bool HasFeedback() const { return jit_feedback_ != NULL; } | 415 bool HasFeedback() const { return jit_feedback_ != NULL; } |
417 static void PopulateWithICData(const Function& func, FlowGraph* graph); | 416 static void PopulateWithICData(const Function& func, FlowGraph* graph); |
418 void TryApplyFeedback(const Function& func, FlowGraph* graph); | 417 void TryApplyFeedback(const Function& func, FlowGraph* graph); |
419 void TryApplyFeedback(ParsedJSONArray* js_icdatas, const ICData& ic); | 418 void TryApplyFeedback(ParsedJSONArray* js_icdatas, const ICData& ic); |
420 | 419 |
421 private: | 420 private: |
422 Precompiler(Thread* thread, bool reset_fields); | 421 explicit Precompiler(Thread* thread); |
423 | 422 |
424 void LoadFeedback(uint8_t* jit_feedback, intptr_t jit_feedback_length); | 423 void LoadFeedback(uint8_t* jit_feedback, intptr_t jit_feedback_length); |
425 ParsedJSONObject* LookupFeedback(const Function& function); | 424 ParsedJSONObject* LookupFeedback(const Function& function); |
426 | 425 |
427 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); | 426 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); |
428 void ClearAllCode(); | 427 void ClearAllCode(); |
429 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); | 428 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); |
430 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); | 429 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); |
431 void Iterate(); | 430 void Iterate(); |
432 | 431 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 intptr_t MapCid(intptr_t feedback_cid); | 478 intptr_t MapCid(intptr_t feedback_cid); |
480 | 479 |
481 Thread* thread() const { return thread_; } | 480 Thread* thread() const { return thread_; } |
482 Zone* zone() const { return zone_; } | 481 Zone* zone() const { return zone_; } |
483 Isolate* isolate() const { return isolate_; } | 482 Isolate* isolate() const { return isolate_; } |
484 | 483 |
485 Thread* thread_; | 484 Thread* thread_; |
486 Zone* zone_; | 485 Zone* zone_; |
487 Isolate* isolate_; | 486 Isolate* isolate_; |
488 | 487 |
489 const bool reset_fields_; | |
490 | |
491 ParsedJSONObject* jit_feedback_; | 488 ParsedJSONObject* jit_feedback_; |
492 | 489 |
493 bool changed_; | 490 bool changed_; |
494 intptr_t function_count_; | 491 intptr_t function_count_; |
495 intptr_t class_count_; | 492 intptr_t class_count_; |
496 intptr_t selector_count_; | 493 intptr_t selector_count_; |
497 intptr_t dropped_function_count_; | 494 intptr_t dropped_function_count_; |
498 intptr_t dropped_field_count_; | 495 intptr_t dropped_field_count_; |
499 intptr_t dropped_class_count_; | 496 intptr_t dropped_class_count_; |
500 intptr_t dropped_typearg_count_; | 497 intptr_t dropped_typearg_count_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 } | 542 } |
546 static RawObject* NewKey(const Function& function) { return function.raw(); } | 543 static RawObject* NewKey(const Function& function) { return function.raw(); } |
547 }; | 544 }; |
548 | 545 |
549 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 546 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
550 | 547 |
551 | 548 |
552 } // namespace dart | 549 } // namespace dart |
553 | 550 |
554 #endif // RUNTIME_VM_PRECOMPILER_H_ | 551 #endif // RUNTIME_VM_PRECOMPILER_H_ |
OLD | NEW |