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

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

Issue 2995423002: Allow the VM to read Kernel files with external libraries (Closed)
Patch Set: Created 3 years, 4 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/kernel_binary.h ('k') | runtime/vm/kernel_binary_flowgraph.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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_KERNEL_BINARY_FLOWGRAPH_H_ 5 #ifndef RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ 6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 9
10 #include <map> 10 #include <map>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void ReadUntilExcluding(Field field); 112 void ReadUntilExcluding(Field field);
113 113
114 void SetNext(Field field) { next_read_ = field; } 114 void SetNext(Field field) { next_read_ = field; }
115 void SetJustRead(Field field) { next_read_ = field + 1; } 115 void SetJustRead(Field field) { next_read_ = field + 1; }
116 116
117 bool IsConst() { return (flags_ & kConst) != 0; } 117 bool IsConst() { return (flags_ & kConst) != 0; }
118 bool IsFinal() { return (flags_ & kFinal) != 0; } 118 bool IsFinal() { return (flags_ & kFinal) != 0; }
119 119
120 TokenPosition position_; 120 TokenPosition position_;
121 TokenPosition equals_position_; 121 TokenPosition equals_position_;
122 word flags_; 122 uint8_t flags_;
123 StringIndex name_index_; 123 StringIndex name_index_;
124 124
125 private: 125 private:
126 StreamingFlowGraphBuilder* builder_; 126 StreamingFlowGraphBuilder* builder_;
127 intptr_t next_read_; 127 intptr_t next_read_;
128 }; 128 };
129 129
130 // Helper class that reads a kernel Field from binary. 130 // Helper class that reads a kernel Field from binary.
131 // 131 //
132 // Use ReadUntilExcluding to read up to but not including a field. 132 // Use ReadUntilExcluding to read up to but not including a field.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (has_function_literal_initializer_) { 183 if (has_function_literal_initializer_) {
184 *start = function_literal_start_; 184 *start = function_literal_start_;
185 *end = function_literal_end_; 185 *end = function_literal_end_;
186 } 186 }
187 return has_function_literal_initializer_; 187 return has_function_literal_initializer_;
188 } 188 }
189 189
190 NameIndex canonical_name_; 190 NameIndex canonical_name_;
191 TokenPosition position_; 191 TokenPosition position_;
192 TokenPosition end_position_; 192 TokenPosition end_position_;
193 word flags_; 193 uint8_t flags_;
194 intptr_t source_uri_index_; 194 intptr_t source_uri_index_;
195 intptr_t annotation_count_; 195 intptr_t annotation_count_;
196 196
197 private: 197 private:
198 StreamingFlowGraphBuilder* builder_; 198 StreamingFlowGraphBuilder* builder_;
199 intptr_t next_read_; 199 intptr_t next_read_;
200 200
201 bool has_function_literal_initializer_; 201 bool has_function_literal_initializer_;
202 TokenPosition function_literal_start_; 202 TokenPosition function_literal_start_;
203 TokenPosition function_literal_end_; 203 TokenPosition function_literal_end_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 bool IsStatic() { return (flags_ & kStatic) != 0; } 259 bool IsStatic() { return (flags_ & kStatic) != 0; }
260 bool IsAbstract() { return (flags_ & kAbstract) != 0; } 260 bool IsAbstract() { return (flags_ & kAbstract) != 0; }
261 bool IsExternal() { return (flags_ & kExternal) != 0; } 261 bool IsExternal() { return (flags_ & kExternal) != 0; }
262 bool IsConst() { return (flags_ & kConst) != 0; } 262 bool IsConst() { return (flags_ & kConst) != 0; }
263 263
264 NameIndex canonical_name_; 264 NameIndex canonical_name_;
265 TokenPosition position_; 265 TokenPosition position_;
266 TokenPosition end_position_; 266 TokenPosition end_position_;
267 Kind kind_; 267 Kind kind_;
268 word flags_; 268 uint8_t flags_;
269 intptr_t source_uri_index_; 269 intptr_t source_uri_index_;
270 intptr_t annotation_count_; 270 intptr_t annotation_count_;
271 271
272 private: 272 private:
273 StreamingFlowGraphBuilder* builder_; 273 StreamingFlowGraphBuilder* builder_;
274 intptr_t next_read_; 274 intptr_t next_read_;
275 }; 275 };
276 276
277 // Helper class that reads a kernel Constructor from binary. 277 // Helper class that reads a kernel Constructor from binary.
278 // 278 //
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 void SetNext(Field field) { next_read_ = field; } 316 void SetNext(Field field) { next_read_ = field; }
317 void SetJustRead(Field field) { next_read_ = field + 1; } 317 void SetJustRead(Field field) { next_read_ = field + 1; }
318 318
319 bool IsExternal() { return (flags_ & kExternal) != 0; } 319 bool IsExternal() { return (flags_ & kExternal) != 0; }
320 bool IsConst() { return (flags_ & kConst) != 0; } 320 bool IsConst() { return (flags_ & kConst) != 0; }
321 321
322 NameIndex canonical_name_; 322 NameIndex canonical_name_;
323 TokenPosition position_; 323 TokenPosition position_;
324 TokenPosition end_position_; 324 TokenPosition end_position_;
325 word flags_; 325 uint8_t flags_;
326 intptr_t annotation_count_; 326 intptr_t annotation_count_;
327 327
328 private: 328 private:
329 StreamingFlowGraphBuilder* builder_; 329 StreamingFlowGraphBuilder* builder_;
330 intptr_t next_read_; 330 intptr_t next_read_;
331 }; 331 };
332 332
333 // Helper class that reads a kernel Class from binary. 333 // Helper class that reads a kernel Class from binary.
334 // 334 //
335 // Use ReadUntilExcluding to read up to but not including a field. 335 // Use ReadUntilExcluding to read up to but not including a field.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 kAnnotations, 403 kAnnotations,
404 kDependencies, 404 kDependencies,
405 kParts, 405 kParts,
406 kTypedefs, 406 kTypedefs,
407 kClasses, 407 kClasses,
408 kToplevelField, 408 kToplevelField,
409 kToplevelProcedures, 409 kToplevelProcedures,
410 kEnd, 410 kEnd,
411 }; 411 };
412 412
413 enum Flag {
414 kExternal = 1,
415 };
416
413 explicit LibraryHelper(StreamingFlowGraphBuilder* builder) { 417 explicit LibraryHelper(StreamingFlowGraphBuilder* builder) {
414 builder_ = builder; 418 builder_ = builder;
415 next_read_ = kFlags; 419 next_read_ = kFlags;
416 } 420 }
417 421
418 void ReadUntilIncluding(Field field) { 422 void ReadUntilIncluding(Field field) {
419 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1)); 423 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
420 } 424 }
421 425
422 void ReadUntilExcluding(Field field); 426 void ReadUntilExcluding(Field field);
423 427
424 void SetNext(Field field) { next_read_ = field; } 428 void SetNext(Field field) { next_read_ = field; }
425 void SetJustRead(Field field) { next_read_ = field + 1; } 429 void SetJustRead(Field field) { next_read_ = field + 1; }
426 430
431 bool IsExternal() const { return (flags_ & kExternal) != 0; }
432
433 uint8_t flags_;
427 NameIndex canonical_name_; 434 NameIndex canonical_name_;
428 StringIndex name_index_; 435 StringIndex name_index_;
429 intptr_t source_uri_index_; 436 intptr_t source_uri_index_;
430 437
431 private: 438 private:
432 StreamingFlowGraphBuilder* builder_; 439 StreamingFlowGraphBuilder* builder_;
433 intptr_t next_read_; 440 intptr_t next_read_;
434 }; 441 };
435 442
436 class StreamingDartTypeTranslator { 443 class StreamingDartTypeTranslator {
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 void SkipVariableDeclaration(); 837 void SkipVariableDeclaration();
831 void SkipLibraryCombinator(); 838 void SkipLibraryCombinator();
832 void SkipLibraryDependency(); 839 void SkipLibraryDependency();
833 void SkipLibraryPart(); 840 void SkipLibraryPart();
834 void SkipLibraryTypedef(); 841 void SkipLibraryTypedef();
835 TokenPosition ReadPosition(bool record = true); 842 TokenPosition ReadPosition(bool record = true);
836 void record_token_position(TokenPosition position); 843 void record_token_position(TokenPosition position);
837 void record_yield_position(TokenPosition position); 844 void record_yield_position(TokenPosition position);
838 Tag ReadTag(uint8_t* payload = NULL); 845 Tag ReadTag(uint8_t* payload = NULL);
839 Tag PeekTag(uint8_t* payload = NULL); 846 Tag PeekTag(uint8_t* payload = NULL);
840 word ReadFlags(); 847 uint8_t ReadFlags() { return reader_->ReadFlags(); }
841 848
842 void loop_depth_inc(); 849 void loop_depth_inc();
843 void loop_depth_dec(); 850 void loop_depth_dec();
844 intptr_t for_in_depth(); 851 intptr_t for_in_depth();
845 void for_in_depth_inc(); 852 void for_in_depth_inc();
846 void for_in_depth_dec(); 853 void for_in_depth_dec();
847 void catch_depth_inc(); 854 void catch_depth_inc();
848 void catch_depth_dec(); 855 void catch_depth_dec();
849 void try_depth_inc(); 856 void try_depth_inc();
850 void try_depth_dec(); 857 void try_depth_dec();
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 const uint8_t* saved_raw_buffer_; 1129 const uint8_t* saved_raw_buffer_;
1123 const TypedData* saved_typed_data_; 1130 const TypedData* saved_typed_data_;
1124 intptr_t saved_offset_; 1131 intptr_t saved_offset_;
1125 }; 1132 };
1126 1133
1127 } // namespace kernel 1134 } // namespace kernel
1128 } // namespace dart 1135 } // namespace dart
1129 1136
1130 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1137 #endif // !defined(DART_PRECOMPILED_RUNTIME)
1131 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ 1138 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary.h ('k') | runtime/vm/kernel_binary_flowgraph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698