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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 2035453002: Pixels class prototype and test (not to be committed). Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: work in progress Created 4 years, 5 months 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/snapshot.h ('k') | runtime/vm/symbols.h » ('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) 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 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 ASSERT_NO_SAFEPOINT_SCOPE(); 883 ASSERT_NO_SAFEPOINT_SCOPE();
884 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id); 884 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id);
885 RawTypedData* obj = reinterpret_cast<RawTypedData*>( 885 RawTypedData* obj = reinterpret_cast<RawTypedData*>(
886 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes))); 886 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes)));
887 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(len)); 887 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(len));
888 return obj; 888 return obj;
889 } 889 }
890 890
891 891
892 #define ALLOC_NEW_OBJECT(type) \ 892 #define ALLOC_NEW_OBJECT(type) \
893 ASSERT(Snapshot::IsFull(kind_)); \ 893 ASSERT(Snapshot::IsFull(kind_)); \
894 ASSERT_NO_SAFEPOINT_SCOPE(); \ 894 ASSERT_NO_SAFEPOINT_SCOPE(); \
895 return reinterpret_cast<Raw##type*>( \ 895 return reinterpret_cast<Raw##type*>( \
896 AllocateUninitialized(k##type##Cid, type::InstanceSize())); \ 896 AllocateUninitialized(k##type##Cid, type::InstanceSize())); \
897 897
898 898
899 RawBigint* SnapshotReader::NewBigint() { 899 RawBigint* SnapshotReader::NewBigint() {
900 ALLOC_NEW_OBJECT(Bigint); 900 ALLOC_NEW_OBJECT(Bigint);
901 } 901 }
902 902
903 903
904 RawPixels* SnapshotReader::NewPixels() {
905 ALLOC_NEW_OBJECT(Pixels);
906 }
907
908
904 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() { 909 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() {
905 ALLOC_NEW_OBJECT(UnresolvedClass); 910 ALLOC_NEW_OBJECT(UnresolvedClass);
906 } 911 }
907 912
908 913
909 RawType* SnapshotReader::NewType() { 914 RawType* SnapshotReader::NewType() {
910 ALLOC_NEW_OBJECT(Type); 915 ALLOC_NEW_OBJECT(Type);
911 } 916 }
912 917
913 918
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 return raw->ptr()->tags_; 1694 return raw->ptr()->tags_;
1690 } 1695 }
1691 1696
1692 1697
1693 #define VM_OBJECT_CLASS_LIST(V) \ 1698 #define VM_OBJECT_CLASS_LIST(V) \
1694 V(OneByteString) \ 1699 V(OneByteString) \
1695 V(TwoByteString) \ 1700 V(TwoByteString) \
1696 V(Mint) \ 1701 V(Mint) \
1697 V(Bigint) \ 1702 V(Bigint) \
1698 V(Double) \ 1703 V(Double) \
1704 V(Pixels) \
1699 V(ImmutableArray) \ 1705 V(ImmutableArray) \
1700 1706
1701 #define VM_OBJECT_WRITE(clazz) \ 1707 #define VM_OBJECT_WRITE(clazz) \
1702 case clazz::kClassId: { \ 1708 case clazz::kClassId: { \
1703 object_id = forward_list_->AddObject(zone(), rawobj, kIsSerialized); \ 1709 object_id = forward_list_->AddObject(zone(), rawobj, kIsSerialized); \
1704 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \ 1710 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(rawobj); \
1705 raw_obj->WriteTo(this, object_id, kind(), false); \ 1711 raw_obj->WriteTo(this, object_id, kind(), false); \
1706 return true; \ 1712 return true; \
1707 } \ 1713 } \
1708 1714
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 if (setjmp(*jump.Set()) == 0) { 2439 if (setjmp(*jump.Set()) == 0) {
2434 NoSafepointScope no_safepoint; 2440 NoSafepointScope no_safepoint;
2435 WriteObject(obj.raw()); 2441 WriteObject(obj.raw());
2436 } else { 2442 } else {
2437 ThrowException(exception_type(), exception_msg()); 2443 ThrowException(exception_type(), exception_msg());
2438 } 2444 }
2439 } 2445 }
2440 2446
2441 2447
2442 } // namespace dart 2448 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698