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

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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 static RawClass* megamorphic_cache_class() { 547 static RawClass* megamorphic_cache_class() {
548 return megamorphic_cache_class_; 548 return megamorphic_cache_class_;
549 } 549 }
550 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } 550 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; }
551 551
552 // Initialize the VM isolate. 552 // Initialize the VM isolate.
553 static void InitNull(Isolate* isolate); 553 static void InitNull(Isolate* isolate);
554 static void InitOnce(Isolate* isolate); 554 static void InitOnce(Isolate* isolate);
555 static void FinalizeVMIsolate(Isolate* isolate); 555 static void FinalizeVMIsolate(Isolate* isolate);
556 556
557 // Initialize a new isolate either from source or from a snapshot. 557 // Initialize a new isolate either from a Kernel IR, from source, or from a
558 static RawError* Init(Isolate* isolate); 558 // snapshot.
559 static RawError* Init(Isolate* isolate,
560 const uint8_t* kernel,
561 intptr_t kernel_length);
559 562
560 static void MakeUnusedSpaceTraversable(const Object& obj, 563 static void MakeUnusedSpaceTraversable(const Object& obj,
561 intptr_t original_size, 564 intptr_t original_size,
562 intptr_t used_size); 565 intptr_t used_size);
563 566
564 static intptr_t InstanceSize() { 567 static intptr_t InstanceSize() {
565 return RoundedAllocationSize(sizeof(RawObject)); 568 return RoundedAllocationSize(sizeof(RawObject));
566 } 569 }
567 570
568 static void VerifyBuiltinVtables(); 571 static void VerifyBuiltinVtables();
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 friend class Type; 1557 friend class Type;
1555 friend class Intrinsifier; 1558 friend class Intrinsifier;
1556 friend class Precompiler; 1559 friend class Precompiler;
1557 }; 1560 };
1558 1561
1559 1562
1560 // Unresolved class is used for storing unresolved names which will be resolved 1563 // Unresolved class is used for storing unresolved names which will be resolved
1561 // to a class after all classes have been loaded and finalized. 1564 // to a class after all classes have been loaded and finalized.
1562 class UnresolvedClass : public Object { 1565 class UnresolvedClass : public Object {
1563 public: 1566 public:
1564 RawLibraryPrefix* library_prefix() const { 1567 RawObject* library_or_library_prefix() const {
1565 return raw_ptr()->library_prefix_; 1568 return raw_ptr()->library_or_library_prefix_;
1566 } 1569 }
1567 RawString* ident() const { return raw_ptr()->ident_; } 1570 RawString* ident() const { return raw_ptr()->ident_; }
1568 TokenPosition token_pos() const { return raw_ptr()->token_pos_; } 1571 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
1569 1572
1570 RawString* Name() const; 1573 RawString* Name() const;
1571 1574
1572 static intptr_t InstanceSize() { 1575 static intptr_t InstanceSize() {
1573 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); 1576 return RoundedAllocationSize(sizeof(RawUnresolvedClass));
1574 } 1577 }
1575 1578
1576 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, 1579 static RawUnresolvedClass* New(const Object& library_prefix,
1577 const String& ident, 1580 const String& ident,
1578 TokenPosition token_pos); 1581 TokenPosition token_pos);
1579 1582
1580 private: 1583 private:
1581 void set_library_prefix(const LibraryPrefix& library_prefix) const; 1584 void set_library_or_library_prefix(const Object& library_prefix) const;
1582 void set_ident(const String& ident) const; 1585 void set_ident(const String& ident) const;
1583 void set_token_pos(TokenPosition token_pos) const; 1586 void set_token_pos(TokenPosition token_pos) const;
1584 1587
1585 static RawUnresolvedClass* New(); 1588 static RawUnresolvedClass* New();
1586 1589
1587 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 1590 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
1588 friend class Class; 1591 friend class Class;
1589 }; 1592 };
1590 1593
1591 1594
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3883 bool IsCoreLibrary() const { 3886 bool IsCoreLibrary() const {
3884 return raw() == CoreLibrary(); 3887 return raw() == CoreLibrary();
3885 } 3888 }
3886 3889
3887 inline intptr_t UrlHash() const; 3890 inline intptr_t UrlHash() const;
3888 3891
3889 static RawLibrary* LookupLibrary(Thread* thread, const String& url); 3892 static RawLibrary* LookupLibrary(Thread* thread, const String& url);
3890 static RawLibrary* GetLibrary(intptr_t index); 3893 static RawLibrary* GetLibrary(intptr_t index);
3891 3894
3892 static void InitCoreLibrary(Isolate* isolate); 3895 static void InitCoreLibrary(Isolate* isolate);
3893 static void InitNativeWrappersLibrary(Isolate* isolate); 3896 static void InitNativeWrappersLibrary(Isolate* isolate, bool is_kernel_file);
3894 3897
3895 static RawLibrary* AsyncLibrary(); 3898 static RawLibrary* AsyncLibrary();
3896 static RawLibrary* ConvertLibrary(); 3899 static RawLibrary* ConvertLibrary();
3897 static RawLibrary* CoreLibrary(); 3900 static RawLibrary* CoreLibrary();
3898 static RawLibrary* CollectionLibrary(); 3901 static RawLibrary* CollectionLibrary();
3899 static RawLibrary* DeveloperLibrary(); 3902 static RawLibrary* DeveloperLibrary();
3900 static RawLibrary* InternalLibrary(); 3903 static RawLibrary* InternalLibrary();
3901 static RawLibrary* IsolateLibrary(); 3904 static RawLibrary* IsolateLibrary();
3902 static RawLibrary* MathLibrary(); 3905 static RawLibrary* MathLibrary();
3903 static RawLibrary* MirrorsLibrary(); 3906 static RawLibrary* MirrorsLibrary();
(...skipping 5135 matching lines...) Expand 10 before | Expand all | Expand 10 after
9039 9042
9040 inline void TypeArguments::SetHash(intptr_t value) const { 9043 inline void TypeArguments::SetHash(intptr_t value) const {
9041 // This is only safe because we create a new Smi, which does not cause 9044 // This is only safe because we create a new Smi, which does not cause
9042 // heap allocation. 9045 // heap allocation.
9043 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 9046 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
9044 } 9047 }
9045 9048
9046 } // namespace dart 9049 } // namespace dart
9047 9050
9048 #endif // RUNTIME_VM_OBJECT_H_ 9051 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698