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

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

Issue 2512653002: Merge of source position information from kernel-sdk. (Closed)
Patch Set: Changed how GetTokenLocation was called back to original to fix failing failing tests. Created 4 years 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.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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 typedef typename std::map<KernelType*, VmType*> MapType; 51 typedef typename std::map<KernelType*, VmType*> MapType;
52 MapType map_; 52 MapType map_;
53 }; 53 };
54 54
55 class KernelReader { 55 class KernelReader {
56 public: 56 public:
57 KernelReader(const uint8_t* buffer, intptr_t len, bool bootstrapping = false) 57 KernelReader(const uint8_t* buffer, intptr_t len, bool bootstrapping = false)
58 : thread_(dart::Thread::Current()), 58 : thread_(dart::Thread::Current()),
59 zone_(thread_->zone()), 59 zone_(thread_->zone()),
60 isolate_(thread_->isolate()), 60 isolate_(thread_->isolate()),
61 scripts_(Array::ZoneHandle(zone_)),
62 program_(NULL),
61 translation_helper_(this, thread_, zone_, isolate_), 63 translation_helper_(this, thread_, zone_, isolate_),
62 type_translator_(&translation_helper_, 64 type_translator_(&translation_helper_,
63 &active_class_, 65 &active_class_,
64 /*finalize=*/false), 66 /*finalize=*/false),
65 bootstrapping_(bootstrapping), 67 bootstrapping_(bootstrapping),
66 buffer_(buffer), 68 buffer_(buffer),
67 buffer_length_(len) {} 69 buffer_length_(len) {}
68 70
71 // Returns either pointer to a program or null.
72 Program* ReadPrecompiledProgram();
73
69 // Returns either a library or a failure object. 74 // Returns either a library or a failure object.
70 dart::Object& ReadProgram(); 75 dart::Object& ReadProgram();
71 76
72 static void SetupFunctionParameters(TranslationHelper translation_helper_, 77 static void SetupFunctionParameters(TranslationHelper translation_helper_,
73 DartTypeTranslator type_translator_, 78 DartTypeTranslator type_translator_,
74 const dart::Class& owner, 79 const dart::Class& owner,
75 const dart::Function& function, 80 const dart::Function& function,
76 FunctionNode* kernel_function, 81 FunctionNode* kernel_function,
77 bool is_method, 82 bool is_method,
78 bool is_closure); 83 bool is_closure);
79 84
80 void ReadLibrary(Library* kernel_library); 85 void ReadLibrary(Library* kernel_library);
81 86
82 private: 87 private:
83 friend class BuildingTranslationHelper; 88 friend class BuildingTranslationHelper;
84 89
85 void ReadPreliminaryClass(dart::Class* klass, Class* kernel_klass); 90 void ReadPreliminaryClass(dart::Class* klass, Class* kernel_klass);
86 dart::Class& ReadClass(const dart::Library& library, Class* kernel_klass); 91 dart::Class& ReadClass(const dart::Library& library, Class* kernel_klass);
87 void ReadProcedure(const dart::Library& library, 92 void ReadProcedure(const dart::Library& library,
88 const dart::Class& owner, 93 const dart::Class& owner,
89 Procedure* procedure, 94 Procedure* procedure,
90 Class* kernel_klass = NULL); 95 Class* kernel_klass = NULL);
91 96
97 // If klass's script is not the script at the uri index, return a PatchClass
98 // for klass whose script corresponds to the uri index.
99 // Otherwise return klass.
100 const Object& ClassForScriptAt(const dart::Class& klass,
101 intptr_t source_uri_index);
102 Script& ScriptAt(intptr_t source_uri_index);
103
92 void GenerateFieldAccessors(const dart::Class& klass, 104 void GenerateFieldAccessors(const dart::Class& klass,
93 const dart::Field& field, 105 const dart::Field& field,
94 Field* kernel_field); 106 Field* kernel_field);
95 107
96 void SetupFieldAccessorFunction(const dart::Class& klass, 108 void SetupFieldAccessorFunction(const dart::Class& klass,
97 const dart::Function& function); 109 const dart::Function& function);
98 110
99 dart::Library& LookupLibrary(Library* library); 111 dart::Library& LookupLibrary(Library* library);
100 dart::Class& LookupClass(Class* klass); 112 dart::Class& LookupClass(Class* klass);
101 113
102 dart::RawFunction::Kind GetFunctionType(Procedure* kernel_procedure); 114 dart::RawFunction::Kind GetFunctionType(Procedure* kernel_procedure);
103 115
104 dart::Thread* thread_; 116 dart::Thread* thread_;
105 dart::Zone* zone_; 117 dart::Zone* zone_;
106 dart::Isolate* isolate_; 118 dart::Isolate* isolate_;
119 Array& scripts_;
120 Program* program_;
107 ActiveClass active_class_; 121 ActiveClass active_class_;
108 BuildingTranslationHelper translation_helper_; 122 BuildingTranslationHelper translation_helper_;
109 DartTypeTranslator type_translator_; 123 DartTypeTranslator type_translator_;
110 124
111 bool bootstrapping_; 125 bool bootstrapping_;
112 126
113 const uint8_t* buffer_; 127 const uint8_t* buffer_;
114 intptr_t buffer_length_; 128 intptr_t buffer_length_;
115 129
116 Mapping<Library, dart::Library> libraries_; 130 Mapping<Library, dart::Library> libraries_;
117 Mapping<Class, dart::Class> classes_; 131 Mapping<Class, dart::Class> classes_;
118 }; 132 };
119 133
120 } // namespace kernel 134 } // namespace kernel
121 } // namespace dart 135 } // namespace dart
122 136
123 #endif // !defined(DART_PRECOMPILED_RUNTIME) 137 #endif // !defined(DART_PRECOMPILED_RUNTIME)
124 #endif // RUNTIME_VM_KERNEL_READER_H_ 138 #endif // RUNTIME_VM_KERNEL_READER_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary.cc ('k') | runtime/vm/kernel_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698