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

Side by Side Diff: runtime/vm/object.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_OBJECT_H_ 5 #ifndef RUNTIME_VM_OBJECT_H_
6 #define RUNTIME_VM_OBJECT_H_ 6 #define RUNTIME_VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 static RawClass* megamorphic_cache_class() { 518 static RawClass* megamorphic_cache_class() {
519 return megamorphic_cache_class_; 519 return megamorphic_cache_class_;
520 } 520 }
521 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } 521 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; }
522 522
523 // Initialize the VM isolate. 523 // Initialize the VM isolate.
524 static void InitNull(Isolate* isolate); 524 static void InitNull(Isolate* isolate);
525 static void InitOnce(Isolate* isolate); 525 static void InitOnce(Isolate* isolate);
526 static void FinalizeVMIsolate(Isolate* isolate); 526 static void FinalizeVMIsolate(Isolate* isolate);
527 527
528 // Initialize a new isolate either from source or from a snapshot. 528 // Initialize a new isolate either from a Kernel IR, from source, or from a
529 static RawError* Init(Isolate* isolate); 529 // snapshot.
530 static RawError* Init(Isolate* isolate,
531 const uint8_t* kernel,
532 intptr_t kernel_length);
530 533
531 static void MakeUnusedSpaceTraversable(const Object& obj, 534 static void MakeUnusedSpaceTraversable(const Object& obj,
532 intptr_t original_size, 535 intptr_t original_size,
533 intptr_t used_size); 536 intptr_t used_size);
534 537
535 static intptr_t InstanceSize() { 538 static intptr_t InstanceSize() {
536 return RoundedAllocationSize(sizeof(RawObject)); 539 return RoundedAllocationSize(sizeof(RawObject));
537 } 540 }
538 541
539 static void VerifyBuiltinVtables(); 542 static void VerifyBuiltinVtables();
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 friend class Type; 1499 friend class Type;
1497 friend class Intrinsifier; 1500 friend class Intrinsifier;
1498 friend class Precompiler; 1501 friend class Precompiler;
1499 }; 1502 };
1500 1503
1501 1504
1502 // Unresolved class is used for storing unresolved names which will be resolved 1505 // Unresolved class is used for storing unresolved names which will be resolved
1503 // to a class after all classes have been loaded and finalized. 1506 // to a class after all classes have been loaded and finalized.
1504 class UnresolvedClass : public Object { 1507 class UnresolvedClass : public Object {
1505 public: 1508 public:
1506 RawLibraryPrefix* library_prefix() const { 1509 RawObject* library_or_library_prefix() const {
1507 return raw_ptr()->library_prefix_; 1510 return raw_ptr()->library_or_library_prefix_;
1508 } 1511 }
1509 RawString* ident() const { return raw_ptr()->ident_; } 1512 RawString* ident() const { return raw_ptr()->ident_; }
1510 TokenPosition token_pos() const { return raw_ptr()->token_pos_; } 1513 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
1511 1514
1512 RawString* Name() const; 1515 RawString* Name() const;
1513 1516
1514 static intptr_t InstanceSize() { 1517 static intptr_t InstanceSize() {
1515 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); 1518 return RoundedAllocationSize(sizeof(RawUnresolvedClass));
1516 } 1519 }
1517 1520
1518 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, 1521 static RawUnresolvedClass* New(const Object& library_prefix,
1519 const String& ident, 1522 const String& ident,
1520 TokenPosition token_pos); 1523 TokenPosition token_pos);
1521 1524
1522 private: 1525 private:
1523 void set_library_prefix(const LibraryPrefix& library_prefix) const; 1526 void set_library_or_library_prefix(const Object& library_prefix) const;
1524 void set_ident(const String& ident) const; 1527 void set_ident(const String& ident) const;
1525 void set_token_pos(TokenPosition token_pos) const; 1528 void set_token_pos(TokenPosition token_pos) const;
1526 1529
1527 static RawUnresolvedClass* New(); 1530 static RawUnresolvedClass* New();
1528 1531
1529 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 1532 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
1530 friend class Class; 1533 friend class Class;
1531 }; 1534 };
1532 1535
1533 1536
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3759 } 3762 }
3760 3763
3761 bool IsCoreLibrary() const { return raw() == CoreLibrary(); } 3764 bool IsCoreLibrary() const { return raw() == CoreLibrary(); }
3762 3765
3763 inline intptr_t UrlHash() const; 3766 inline intptr_t UrlHash() const;
3764 3767
3765 static RawLibrary* LookupLibrary(Thread* thread, const String& url); 3768 static RawLibrary* LookupLibrary(Thread* thread, const String& url);
3766 static RawLibrary* GetLibrary(intptr_t index); 3769 static RawLibrary* GetLibrary(intptr_t index);
3767 3770
3768 static void InitCoreLibrary(Isolate* isolate); 3771 static void InitCoreLibrary(Isolate* isolate);
3769 static void InitNativeWrappersLibrary(Isolate* isolate); 3772 static void InitNativeWrappersLibrary(Isolate* isolate, bool is_kernel_file);
3770 3773
3771 static RawLibrary* AsyncLibrary(); 3774 static RawLibrary* AsyncLibrary();
3772 static RawLibrary* ConvertLibrary(); 3775 static RawLibrary* ConvertLibrary();
3773 static RawLibrary* CoreLibrary(); 3776 static RawLibrary* CoreLibrary();
3774 static RawLibrary* CollectionLibrary(); 3777 static RawLibrary* CollectionLibrary();
3775 static RawLibrary* DeveloperLibrary(); 3778 static RawLibrary* DeveloperLibrary();
3776 static RawLibrary* InternalLibrary(); 3779 static RawLibrary* InternalLibrary();
3777 static RawLibrary* IsolateLibrary(); 3780 static RawLibrary* IsolateLibrary();
3778 static RawLibrary* MathLibrary(); 3781 static RawLibrary* MathLibrary();
3779 #if !defined(PRODUCT) 3782 #if !defined(PRODUCT)
(...skipping 5009 matching lines...) Expand 10 before | Expand all | Expand 10 after
8789 8792
8790 inline void TypeArguments::SetHash(intptr_t value) const { 8793 inline void TypeArguments::SetHash(intptr_t value) const {
8791 // This is only safe because we create a new Smi, which does not cause 8794 // This is only safe because we create a new Smi, which does not cause
8792 // heap allocation. 8795 // heap allocation.
8793 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8796 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8794 } 8797 }
8795 8798
8796 } // namespace dart 8799 } // namespace dart
8797 8800
8798 #endif // RUNTIME_VM_OBJECT_H_ 8801 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698