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

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

Issue 3010543002: Rename the class "KernelReader" to "KernelLoader". (Closed)
Patch Set: Fix alphabetical order in vm_sources.gni. Created 3 years, 3 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.h ('k') | runtime/vm/kernel_loader.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_LOADER_H_
6 #define RUNTIME_VM_KERNEL_READER_H_ 6 #define RUNTIME_VM_KERNEL_LOADER_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_binary_flowgraph.h"
13 #include "vm/kernel_to_il.h" 13 #include "vm/kernel_to_il.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 15
16 namespace dart { 16 namespace dart {
17 namespace kernel { 17 namespace kernel {
18 18
19 class KernelReader; 19 class KernelLoader;
20 20
21 class BuildingTranslationHelper : public TranslationHelper { 21 class BuildingTranslationHelper : public TranslationHelper {
22 public: 22 public:
23 BuildingTranslationHelper(KernelReader* reader, Thread* thread) 23 BuildingTranslationHelper(KernelLoader* loader, Thread* thread)
24 : TranslationHelper(thread), reader_(reader) {} 24 : TranslationHelper(thread), loader_(loader) {}
25 virtual ~BuildingTranslationHelper() {} 25 virtual ~BuildingTranslationHelper() {}
26 26
27 virtual RawLibrary* LookupLibraryByKernelLibrary(NameIndex library); 27 virtual RawLibrary* LookupLibraryByKernelLibrary(NameIndex library);
28 virtual RawClass* LookupClassByKernelClass(NameIndex klass); 28 virtual RawClass* LookupClassByKernelClass(NameIndex klass);
29 29
30 private: 30 private:
31 KernelReader* reader_; 31 KernelLoader* loader_;
32 }; 32 };
33 33
34 template <typename VmType> 34 template <typename VmType>
35 class Mapping { 35 class Mapping {
36 public: 36 public:
37 bool Lookup(intptr_t canonical_name, VmType** handle) { 37 bool Lookup(intptr_t canonical_name, VmType** handle) {
38 typename MapType::Pair* pair = map_.LookupPair(canonical_name); 38 typename MapType::Pair* pair = map_.LookupPair(canonical_name);
39 if (pair != NULL) { 39 if (pair != NULL) {
40 *handle = pair->value; 40 *handle = pair->value;
41 return true; 41 return true;
42 } 42 }
43 return false; 43 return false;
44 } 44 }
45 45
46 void Insert(intptr_t canonical_name, VmType* object) { 46 void Insert(intptr_t canonical_name, VmType* object) {
47 map_.Insert(canonical_name, object); 47 map_.Insert(canonical_name, object);
48 } 48 }
49 49
50 private: 50 private:
51 typedef IntMap<VmType*> MapType; 51 typedef IntMap<VmType*> MapType;
52 MapType map_; 52 MapType map_;
53 }; 53 };
54 54
55 class KernelReader { 55 class KernelLoader {
56 public: 56 public:
57 explicit KernelReader(Program* program); 57 explicit KernelLoader(Program* program);
58 58
59 // Returns the library containing the main procedure, null if there 59 // Returns the library containing the main procedure, null if there
60 // 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.
61 Object& ReadProgram(); 61 Object& LoadProgram();
62 62
63 // Finds all libraries that have been modified in this incremental 63 // Finds all libraries that have been modified in this incremental
64 // version of the kernel program file. 64 // version of the kernel program file.
65 void FindModifiedLibraries(Isolate* isolate, 65 void FindModifiedLibraries(Isolate* isolate,
66 BitVector* modified_libs, 66 BitVector* modified_libs,
67 bool force_reload); 67 bool force_reload);
68 68
69 void ReadLibrary(intptr_t kernel_offset); 69 void LoadLibrary(intptr_t kernel_offset);
70 70
71 const String& DartSymbol(StringIndex index) { 71 const String& DartSymbol(StringIndex index) {
72 return translation_helper_.DartSymbol(index); 72 return translation_helper_.DartSymbol(index);
73 } 73 }
74 74
75 const String& LibraryUri(intptr_t library_index) { 75 const String& LibraryUri(intptr_t library_index) {
76 return translation_helper_.DartSymbol( 76 return translation_helper_.DartSymbol(
77 translation_helper_.CanonicalNameString( 77 translation_helper_.CanonicalNameString(
78 library_canonical_name(library_index))); 78 library_canonical_name(library_index)));
79 } 79 }
(...skipping 13 matching lines...) Expand all
93 (program_->library_count() - index) * 4); 93 (program_->library_count() - index) * 4);
94 reader.set_offset(reader.ReadUInt32()); 94 reader.set_offset(reader.ReadUInt32());
95 95
96 // Start reading library. 96 // Start reading library.
97 reader.ReadFlags(); 97 reader.ReadFlags();
98 return reader.ReadCanonicalNameReference(); 98 return reader.ReadCanonicalNameReference();
99 } 99 }
100 100
101 uint8_t CharacterAt(StringIndex string_index, intptr_t index); 101 uint8_t CharacterAt(StringIndex string_index, intptr_t index);
102 102
103 static bool FieldHasFunctionLiteralInitializer(const Field& field,
104 TokenPosition* start,
105 TokenPosition* end);
106
107 private: 103 private:
108 friend class BuildingTranslationHelper; 104 friend class BuildingTranslationHelper;
109 105
110 void ReadPreliminaryClass(Class* klass, 106 void LoadPreliminaryClass(Class* klass,
111 ClassHelper* class_helper, 107 ClassHelper* class_helper,
112 intptr_t type_parameter_count); 108 intptr_t type_parameter_count);
113 Class& ReadClass(const Library& library, const Class& toplevel_class); 109 Class& LoadClass(const Library& library, const Class& toplevel_class);
114 void ReadProcedure(const Library& library, const Class& owner, bool in_class); 110 void LoadProcedure(const Library& library, const Class& owner, bool in_class);
115 111
116 void ReadAndSetupTypeParameters(const Object& set_on, 112 void LoadAndSetupTypeParameters(const Object& set_on,
117 intptr_t type_parameter_count, 113 intptr_t type_parameter_count,
118 const Class& parameterized_class, 114 const Class& parameterized_class,
119 const Function& parameterized_function); 115 const Function& parameterized_function);
120 116
121 RawArray* MakeFunctionsArray(); 117 RawArray* MakeFunctionsArray();
122 118
123 // If klass's script is not the script at the uri index, return a PatchClass 119 // If klass's script is not the script at the uri index, return a PatchClass
124 // for klass whose script corresponds to the uri index. 120 // for klass whose script corresponds to the uri index.
125 // Otherwise return klass. 121 // Otherwise return klass.
126 const Object& ClassForScriptAt(const Class& klass, intptr_t source_uri_index); 122 const Object& ClassForScriptAt(const Class& klass, intptr_t source_uri_index);
(...skipping 27 matching lines...) Expand all
154 Mapping<Class> classes_; 150 Mapping<Class> classes_;
155 151
156 GrowableArray<const Function*> functions_; 152 GrowableArray<const Function*> functions_;
157 GrowableArray<const Field*> fields_; 153 GrowableArray<const Field*> fields_;
158 }; 154 };
159 155
160 } // namespace kernel 156 } // namespace kernel
161 } // namespace dart 157 } // namespace dart
162 158
163 #endif // !defined(DART_PRECOMPILED_RUNTIME) 159 #endif // !defined(DART_PRECOMPILED_RUNTIME)
164 #endif // RUNTIME_VM_KERNEL_READER_H_ 160 #endif // RUNTIME_VM_KERNEL_LOADER_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | runtime/vm/kernel_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698