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

Unified Diff: runtime/vm/object.cc

Issue 12937010: Handle TypedDataView objects in Dart_TypedDataAcquireData and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 20452)
+++ runtime/vm/object.cc (working copy)
@@ -915,6 +915,20 @@
CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
#undef REGISTER_TYPED_DATA_CLASS
+#define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
+ cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \
+ index = kTypedData##clazz##ViewCid - kTypedDataInt8ArrayCid; \
+ typeddata_classes.SetAt(index, cls); \
+ RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \
+ pending_classes.Add(cls, Heap::kOld); \
+
+ CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
+ cls = Class::NewTypedDataViewClass(kByteDataViewCid);
+ index = kByteDataViewCid - kTypedDataInt8ArrayCid;
+ typeddata_classes.SetAt(index, cls);
+ RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib);
+ pending_classes.Add(cls, Heap::kOld);
+#undef REGISTER_TYPED_DATA_VIEW_CLASS
#define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \
index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \
@@ -1108,6 +1122,11 @@
cls = Class::NewTypedDataClass(kTypedData##clazz##Cid);
CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
#undef REGISTER_TYPED_DATA_CLASS
+#define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
+ cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid);
+ CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
+ cls = Class::NewTypedDataViewClass(kByteDataViewCid);
+#undef REGISTER_TYPED_DATA_VIEW_CLASS
#define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid);
CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
@@ -1952,6 +1971,15 @@
}
+RawClass* Class::NewTypedDataViewClass(intptr_t class_id) {
+ ASSERT(RawObject::IsTypedDataViewClassId(class_id));
+ Class& result = Class::Handle(New<Instance>(class_id));
+ result.set_instance_size(0);
+ result.set_next_field_offset(0);
+ return result.raw();
+}
+
+
RawClass* Class::NewExternalTypedDataClass(intptr_t class_id) {
ASSERT(RawObject::IsExternalTypedDataClassId(class_id));
intptr_t instance_size = ExternalTypedData::InstanceSize();
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698