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

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

Powered by Google App Engine
This is Rietveld 408576698