Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: runtime/vm/precompiler.h

Issue 1409523003: Trace through const objects instead of spying on flow graph construction to find closure functions.… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/object.h" 10 #include "vm/object.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return key->PcOffset(); 57 return key->PcOffset();
58 } 58 }
59 59
60 static inline bool IsKeyEqual(Pair pair, Key key) { 60 static inline bool IsKeyEqual(Pair pair, Key key) {
61 return pair->Equals(*key); 61 return pair->Equals(*key);
62 } 62 }
63 }; 63 };
64 64
65 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet; 65 typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet;
66 66
67 class FunctionKeyValueTrait {
68 public:
69 // Typedefs needed for the DirectChainedHashMap template.
70 typedef const Function* Key;
71 typedef const Function* Value;
72 typedef const Function* Pair;
73
74 static Key KeyOf(Pair kv) { return kv; }
75
76 static Value ValueOf(Pair kv) { return kv; }
77
78 static inline intptr_t Hashcode(Key key) {
79 return key->token_pos();
80 }
81
82 static inline bool IsKeyEqual(Pair pair, Key key) {
83 return pair->raw() == key->raw();
84 }
85 };
86
87 typedef DirectChainedHashMap<FunctionKeyValueTrait> FunctionSet;
88
67 89
68 class Precompiler : public ValueObject { 90 class Precompiler : public ValueObject {
69 public: 91 public:
70 static RawError* CompileAll( 92 static RawError* CompileAll(
71 Dart_QualifiedFunctionName embedder_entry_points[], 93 Dart_QualifiedFunctionName embedder_entry_points[],
72 bool reset_fields); 94 bool reset_fields);
73 95
74 private: 96 private:
75 Precompiler(Thread* thread, bool reset_fields); 97 Precompiler(Thread* thread, bool reset_fields);
76 98
77 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]); 99 void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]);
78 void ClearAllCode(); 100 void ClearAllCode();
79 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]); 101 void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]);
80 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]); 102 void AddEntryPoints(Dart_QualifiedFunctionName entry_points[]);
81 void Iterate(); 103 void Iterate();
82 void CleanUp();
83 104
84 void AddCalleesOf(const Function& function); 105 void AddCalleesOf(const Function& function);
106 void AddConstObject(const Instance& instance);
85 void AddClosureCall(const ICData& call_site); 107 void AddClosureCall(const ICData& call_site);
86 void AddField(const Field& field); 108 void AddField(const Field& field);
87 void AddFunction(const Function& function); 109 void AddFunction(const Function& function);
88 void AddClass(const Class& cls); 110 void AddClass(const Class& cls);
89 void AddSelector(const String& selector); 111 void AddSelector(const String& selector);
90 bool IsSent(const String& selector); 112 bool IsSent(const String& selector);
91 113
92 void ProcessFunction(const Function& function); 114 void ProcessFunction(const Function& function);
93 void CheckForNewDynamicFunctions(); 115 void CheckForNewDynamicFunctions();
94 116
(...skipping 22 matching lines...) Expand all
117 const bool reset_fields_; 139 const bool reset_fields_;
118 140
119 bool changed_; 141 bool changed_;
120 intptr_t function_count_; 142 intptr_t function_count_;
121 intptr_t class_count_; 143 intptr_t class_count_;
122 intptr_t selector_count_; 144 intptr_t selector_count_;
123 intptr_t dropped_function_count_; 145 intptr_t dropped_function_count_;
124 146
125 const GrowableObjectArray& libraries_; 147 const GrowableObjectArray& libraries_;
126 const GrowableObjectArray& pending_functions_; 148 const GrowableObjectArray& pending_functions_;
127 const GrowableObjectArray& collected_closures_;
128 SymbolSet sent_selectors_; 149 SymbolSet sent_selectors_;
150 FunctionSet enqueued_functions_;
129 Error& error_; 151 Error& error_;
130 }; 152 };
131 153
132 } // namespace dart 154 } // namespace dart
133 155
134 #endif // VM_PRECOMPILER_H_ 156 #endif // VM_PRECOMPILER_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698