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

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

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
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_TO_IL_H_ 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_
6 #define RUNTIME_VM_KERNEL_TO_IL_H_ 6 #define RUNTIME_VM_KERNEL_TO_IL_H_
7 7
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 virtual ~TranslationHelper() {} 195 virtual ~TranslationHelper() {}
196 196
197 Thread* thread() { return thread_; } 197 Thread* thread() { return thread_; }
198 198
199 Zone* zone() { return zone_; } 199 Zone* zone() { return zone_; }
200 200
201 Isolate* isolate() { return isolate_; } 201 Isolate* isolate() { return isolate_; }
202 202
203 Heap::Space allocation_space() { return allocation_space_; } 203 Heap::Space allocation_space() { return allocation_space_; }
204 204
205 // Set whether unfinalized classes should be finalized. The base class
206 // implementation used at flow graph construction time looks up classes in the
207 // VM's heap, all of which should already be finalized.
208 virtual void SetFinalize(bool finalize) {}
209
210 RawInstance* Canonicalize(const Instance& instance); 205 RawInstance* Canonicalize(const Instance& instance);
211 206
212 const dart::String& DartString(const char* content) { 207 const dart::String& DartString(const char* content) {
213 return DartString(content, allocation_space_); 208 return DartString(content, allocation_space_);
214 } 209 }
215 const dart::String& DartString(const char* content, Heap::Space space); 210 const dart::String& DartString(const char* content, Heap::Space space);
216 211
217 dart::String& DartString(String* content) { 212 dart::String& DartString(String* content) {
218 return DartString(content, allocation_space_); 213 return DartString(content, allocation_space_);
219 } 214 }
(...skipping 14 matching lines...) Expand all
234 const dart::String& DartFactoryName(Class* klass, Name* kernel_name); 229 const dart::String& DartFactoryName(Class* klass, Name* kernel_name);
235 230
236 const Array& ArgumentNames(List<NamedExpression>* named); 231 const Array& ArgumentNames(List<NamedExpression>* named);
237 232
238 // A subclass overrides these when reading in the Kernel program in order to 233 // A subclass overrides these when reading in the Kernel program in order to
239 // support recursive type expressions (e.g. for "implements X" ... 234 // support recursive type expressions (e.g. for "implements X" ...
240 // annotations). 235 // annotations).
241 virtual RawLibrary* LookupLibraryByKernelLibrary(Library* library); 236 virtual RawLibrary* LookupLibraryByKernelLibrary(Library* library);
242 virtual RawClass* LookupClassByKernelClass(Class* klass); 237 virtual RawClass* LookupClassByKernelClass(Class* klass);
243 238
239 RawUnresolvedClass* ToUnresolvedClass(Class* klass);
240
244 RawField* LookupFieldByKernelField(Field* field); 241 RawField* LookupFieldByKernelField(Field* field);
245 RawFunction* LookupStaticMethodByKernelProcedure(Procedure* procedure); 242 RawFunction* LookupStaticMethodByKernelProcedure(Procedure* procedure);
246 RawFunction* LookupConstructorByKernelConstructor(Constructor* constructor); 243 RawFunction* LookupConstructorByKernelConstructor(Constructor* constructor);
247 dart::RawFunction* LookupConstructorByKernelConstructor( 244 dart::RawFunction* LookupConstructorByKernelConstructor(
248 const dart::Class& owner, 245 const dart::Class& owner,
249 Constructor* constructor); 246 Constructor* constructor);
250 247
251 dart::Type& GetCanonicalType(const dart::Class& klass); 248 dart::Type& GetCanonicalType(const dart::Class& klass);
252 249
253 void ReportError(const char* format, ...); 250 void ReportError(const char* format, ...);
(...skipping 21 matching lines...) Expand all
275 // * T is a parametrized Type G<T1, ...> and G is malformed 272 // * T is a parametrized Type G<T1, ...> and G is malformed
276 // * T denotes declarations from multiple imports 273 // * T denotes declarations from multiple imports
277 // 274 //
278 // Any use of a malformed type gives rise to a static warning. A malformed 275 // Any use of a malformed type gives rise to a static warning. A malformed
279 // type is then interpreted as dynamic by the static type checker and the 276 // type is then interpreted as dynamic by the static type checker and the
280 // runtime unless explicitly specified otherwise. 277 // runtime unless explicitly specified otherwise.
281 class DartTypeTranslator : public DartTypeVisitor { 278 class DartTypeTranslator : public DartTypeVisitor {
282 public: 279 public:
283 DartTypeTranslator(TranslationHelper* helper, 280 DartTypeTranslator(TranslationHelper* helper,
284 ActiveClass* active_class, 281 ActiveClass* active_class,
285 bool finalize = true) 282 bool finalize = false)
286 : translation_helper_(*helper), 283 : translation_helper_(*helper),
287 active_class_(active_class), 284 active_class_(active_class),
288 zone_(helper->zone()), 285 zone_(helper->zone()),
289 result_(AbstractType::Handle(helper->zone())), 286 result_(AbstractType::Handle(helper->zone())),
290 finalize_(finalize) {} 287 finalize_(finalize) {}
291 288
292 // Can return a malformed type. 289 // Can return a malformed type.
293 AbstractType& TranslateType(DartType* node); 290 AbstractType& TranslateType(DartType* node);
294 291
295 // Can return a malformed type. 292 // Can return a malformed type.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 491
495 492
496 class ScopeBuilder : public RecursiveVisitor { 493 class ScopeBuilder : public RecursiveVisitor {
497 public: 494 public:
498 ScopeBuilder(ParsedFunction* parsed_function, TreeNode* node) 495 ScopeBuilder(ParsedFunction* parsed_function, TreeNode* node)
499 : result_(NULL), 496 : result_(NULL),
500 parsed_function_(parsed_function), 497 parsed_function_(parsed_function),
501 node_(node), 498 node_(node),
502 zone_(Thread::Current()->zone()), 499 zone_(Thread::Current()->zone()),
503 translation_helper_(Thread::Current(), zone_, Isolate::Current()), 500 translation_helper_(Thread::Current(), zone_, Isolate::Current()),
504 type_translator_(&translation_helper_, &active_class_), 501 type_translator_(&translation_helper_,
502 &active_class_,
503 /*finalize=*/ true),
505 current_function_scope_(NULL), 504 current_function_scope_(NULL),
506 scope_(NULL), 505 scope_(NULL),
507 depth_(0), 506 depth_(0),
508 name_index_(0) {} 507 name_index_(0) {}
509 508
510 virtual ~ScopeBuilder() {} 509 virtual ~ScopeBuilder() {}
511 510
512 ScopeBuildingResult* BuildScopes(); 511 ScopeBuildingResult* BuildScopes();
513 512
514 virtual void VisitName(Name* node) { /* NOP */ 513 virtual void VisitName(Name* node) { /* NOP */
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 friend class SwitchBlock; 913 friend class SwitchBlock;
915 friend class TryCatchBlock; 914 friend class TryCatchBlock;
916 friend class TryFinallyBlock; 915 friend class TryFinallyBlock;
917 }; 916 };
918 917
919 } // namespace kernel 918 } // namespace kernel
920 } // namespace dart 919 } // namespace dart
921 920
922 921
923 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ 922 #endif // RUNTIME_VM_KERNEL_TO_IL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698