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

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

Issue 2931813002: [kernel] Stream kernel_reader (Closed)
Patch Set: Feedback Created 3 years, 6 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_flowgraph.cc ('k') | runtime/vm/kernel_reader.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_READER_H_ 5 #ifndef RUNTIME_VM_KERNEL_READER_H_
6 #define RUNTIME_VM_KERNEL_READER_H_ 6 #define RUNTIME_VM_KERNEL_READER_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 #include <map> 9 #include <map>
10 10
11 #include "vm/kernel.h" 11 #include "vm/kernel.h"
12 #include "vm/kernel_binary_flowgraph.h"
12 #include "vm/kernel_to_il.h" 13 #include "vm/kernel_to_il.h"
13 #include "vm/object.h" 14 #include "vm/object.h"
14 15
15 namespace dart { 16 namespace dart {
16 namespace kernel { 17 namespace kernel {
17 18
18 class KernelReader; 19 class KernelReader;
19 20
20 class BuildingTranslationHelper : public TranslationHelper { 21 class BuildingTranslationHelper : public TranslationHelper {
21 public: 22 public:
(...skipping 30 matching lines...) Expand all
52 }; 53 };
53 54
54 class KernelReader { 55 class KernelReader {
55 public: 56 public:
56 explicit KernelReader(Program* program); 57 explicit KernelReader(Program* program);
57 58
58 // Returns the library containing the main procedure, null if there 59 // Returns the library containing the main procedure, null if there
59 // was no main procedure, or a failure object if there was an error. 60 // was no main procedure, or a failure object if there was an error.
60 dart::Object& ReadProgram(); 61 dart::Object& ReadProgram();
61 62
62 static void SetupFunctionParameters(TranslationHelper translation_helper_, 63 void ReadLibrary(intptr_t kernel_offset);
63 DartTypeTranslator type_translator_,
64 const dart::Class& owner,
65 const dart::Function& function,
66 FunctionNode* kernel_function,
67 bool is_method,
68 bool is_closure);
69
70 void ReadLibrary(Library* kernel_library);
71 64
72 const dart::String& DartSymbol(StringIndex index) { 65 const dart::String& DartSymbol(StringIndex index) {
73 return translation_helper_.DartSymbol(index); 66 return translation_helper_.DartSymbol(index);
74 } 67 }
75 68
76 uint8_t CharacterAt(StringIndex string_index, intptr_t index); 69 uint8_t CharacterAt(StringIndex string_index, intptr_t index);
77 70
78 private: 71 private:
79 friend class BuildingTranslationHelper; 72 friend class BuildingTranslationHelper;
80 73
81 void ReadPreliminaryClass(dart::Class* klass, Class* kernel_klass); 74 void ReadPreliminaryClass(dart::Class* klass,
75 ClassHelper* class_helper,
76 intptr_t type_parameter_count);
82 dart::Class& ReadClass(const dart::Library& library, 77 dart::Class& ReadClass(const dart::Library& library,
83 const dart::Class& toplevel_class, 78 const dart::Class& toplevel_class);
84 Class* kernel_klass);
85 void ReadProcedure(const dart::Library& library, 79 void ReadProcedure(const dart::Library& library,
86 const dart::Class& owner, 80 const dart::Class& owner,
87 Procedure* procedure, 81 bool in_class);
88 Class* kernel_klass = NULL);
89 82
90 RawArray* MakeFunctionsArray(); 83 RawArray* MakeFunctionsArray();
91 84
92 // If klass's script is not the script at the uri index, return a PatchClass 85 // If klass's script is not the script at the uri index, return a PatchClass
93 // for klass whose script corresponds to the uri index. 86 // for klass whose script corresponds to the uri index.
94 // Otherwise return klass. 87 // Otherwise return klass.
95 const Object& ClassForScriptAt(const dart::Class& klass, 88 const Object& ClassForScriptAt(const dart::Class& klass,
96 intptr_t source_uri_index); 89 intptr_t source_uri_index);
97 Script& ScriptAt(intptr_t source_uri_index, 90 Script& ScriptAt(intptr_t source_uri_index,
98 StringIndex import_uri = StringIndex()); 91 StringIndex import_uri = StringIndex());
99 92
100 void GenerateFieldAccessors(const dart::Class& klass, 93 void GenerateFieldAccessors(const dart::Class& klass,
101 const dart::Field& field, 94 const dart::Field& field,
102 Field* kernel_field); 95 FieldHelper* field_helper,
96 intptr_t field_offset);
103 97
104 void SetupFieldAccessorFunction(const dart::Class& klass, 98 void SetupFieldAccessorFunction(const dart::Class& klass,
105 const dart::Function& function); 99 const dart::Function& function);
106 100
107 dart::Library& LookupLibrary(NameIndex library); 101 dart::Library& LookupLibrary(NameIndex library);
108 dart::Class& LookupClass(NameIndex klass); 102 dart::Class& LookupClass(NameIndex klass);
109 103
110 dart::RawFunction::Kind GetFunctionType(Procedure* kernel_procedure); 104 dart::RawFunction::Kind GetFunctionType(
105 Procedure::ProcedureKind procedure_kind);
111 106
112 Program* program_; 107 Program* program_;
113 108
114 dart::Thread* thread_; 109 dart::Thread* thread_;
115 dart::Zone* zone_; 110 dart::Zone* zone_;
116 dart::Isolate* isolate_; 111 dart::Isolate* isolate_;
117 Array& scripts_; 112 Array& scripts_;
118 ActiveClass active_class_; 113 ActiveClass active_class_;
119 BuildingTranslationHelper translation_helper_; 114 BuildingTranslationHelper translation_helper_;
120 DartTypeTranslator type_translator_; 115 StreamingFlowGraphBuilder builder_;
121 116
122 Mapping<dart::Library> libraries_; 117 Mapping<dart::Library> libraries_;
123 Mapping<dart::Class> classes_; 118 Mapping<dart::Class> classes_;
124 119
125 GrowableArray<const dart::Function*> functions_; 120 GrowableArray<const dart::Function*> functions_;
126 GrowableArray<const dart::Field*> fields_; 121 GrowableArray<const dart::Field*> fields_;
127 }; 122 };
128 123
129 } // namespace kernel 124 } // namespace kernel
130 } // namespace dart 125 } // namespace dart
131 126
132 #endif // !defined(DART_PRECOMPILED_RUNTIME) 127 #endif // !defined(DART_PRECOMPILED_RUNTIME)
133 #endif // RUNTIME_VM_KERNEL_READER_H_ 128 #endif // RUNTIME_VM_KERNEL_READER_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.cc ('k') | runtime/vm/kernel_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698