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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 Array::Handle(Array::New(RawObject::NumberOfTypedDataClasses())); 908 Array::Handle(Array::New(RawObject::NumberOfTypedDataClasses()));
909 int index = 0; 909 int index = 0;
910 #define REGISTER_TYPED_DATA_CLASS(clazz) \ 910 #define REGISTER_TYPED_DATA_CLASS(clazz) \
911 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ 911 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \
912 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ 912 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \
913 typeddata_classes.SetAt(index, cls); \ 913 typeddata_classes.SetAt(index, cls); \
914 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ 914 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \
915 915
916 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); 916 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
917 #undef REGISTER_TYPED_DATA_CLASS 917 #undef REGISTER_TYPED_DATA_CLASS
918 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
919 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \
920 index = kTypedData##clazz##ViewCid - kTypedDataInt8ArrayCid; \
921 typeddata_classes.SetAt(index, cls); \
922 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \
923 pending_classes.Add(cls, Heap::kOld); \
924
925 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
926 cls = Class::NewTypedDataViewClass(kByteDataViewCid);
927 index = kByteDataViewCid - kTypedDataInt8ArrayCid;
928 typeddata_classes.SetAt(index, cls);
929 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib);
930 pending_classes.Add(cls, Heap::kOld);
931 #undef REGISTER_TYPED_DATA_VIEW_CLASS
918 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ 932 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
919 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ 933 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \
920 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ 934 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \
921 typeddata_classes.SetAt(index, cls); \ 935 typeddata_classes.SetAt(index, cls); \
922 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ 936 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \
923 937
924 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); 938 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
925 #undef REGISTER_EXT_TYPED_DATA_CLASS 939 #undef REGISTER_EXT_TYPED_DATA_CLASS
926 object_store->set_typeddata_classes(typeddata_classes); 940 object_store->set_typeddata_classes(typeddata_classes);
927 941
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 REGISTER_SCALARLIST_CLASS(ExternalUint64Array, external_uint64_array); 1115 REGISTER_SCALARLIST_CLASS(ExternalUint64Array, external_uint64_array);
1102 REGISTER_SCALARLIST_CLASS(ExternalFloat32x4Array, external_float32x4_array); 1116 REGISTER_SCALARLIST_CLASS(ExternalFloat32x4Array, external_float32x4_array);
1103 REGISTER_SCALARLIST_CLASS(ExternalFloat32Array, external_float32_array); 1117 REGISTER_SCALARLIST_CLASS(ExternalFloat32Array, external_float32_array);
1104 REGISTER_SCALARLIST_CLASS(ExternalFloat64Array, external_float64_array); 1118 REGISTER_SCALARLIST_CLASS(ExternalFloat64Array, external_float64_array);
1105 #undef REGISTER_SCALARLIST_CLASS 1119 #undef REGISTER_SCALARLIST_CLASS
1106 1120
1107 #define REGISTER_TYPED_DATA_CLASS(clazz) \ 1121 #define REGISTER_TYPED_DATA_CLASS(clazz) \
1108 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); 1122 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid);
1109 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); 1123 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
1110 #undef REGISTER_TYPED_DATA_CLASS 1124 #undef REGISTER_TYPED_DATA_CLASS
1125 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
1126 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid);
1127 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
1128 cls = Class::NewTypedDataViewClass(kByteDataViewCid);
1129 #undef REGISTER_TYPED_DATA_VIEW_CLASS
1111 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ 1130 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
1112 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); 1131 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid);
1113 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); 1132 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
1114 #undef REGISTER_EXT_TYPED_DATA_CLASS 1133 #undef REGISTER_EXT_TYPED_DATA_CLASS
1115 1134
1116 cls = Class::New<Integer>(); 1135 cls = Class::New<Integer>();
1117 object_store->set_integer_implementation_class(cls); 1136 object_store->set_integer_implementation_class(cls);
1118 1137
1119 cls = Class::New<Smi>(); 1138 cls = Class::New<Smi>();
1120 object_store->set_smi_class(cls); 1139 object_store->set_smi_class(cls);
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 ASSERT(RawObject::IsTypedDataClassId(class_id)); 1964 ASSERT(RawObject::IsTypedDataClassId(class_id));
1946 intptr_t instance_size = TypedData::InstanceSize(); 1965 intptr_t instance_size = TypedData::InstanceSize();
1947 Class& result = Class::Handle(New<TypedData>(class_id)); 1966 Class& result = Class::Handle(New<TypedData>(class_id));
1948 result.set_instance_size(instance_size); 1967 result.set_instance_size(instance_size);
1949 result.set_next_field_offset(instance_size); 1968 result.set_next_field_offset(instance_size);
1950 result.set_is_prefinalized(); 1969 result.set_is_prefinalized();
1951 return result.raw(); 1970 return result.raw();
1952 } 1971 }
1953 1972
1954 1973
1974 RawClass* Class::NewTypedDataViewClass(intptr_t class_id) {
1975 ASSERT(RawObject::IsTypedDataViewClassId(class_id));
1976 Class& result = Class::Handle(New<Instance>(class_id));
1977 result.set_instance_size(0);
1978 result.set_next_field_offset(0);
1979 return result.raw();
1980 }
1981
1982
1955 RawClass* Class::NewExternalTypedDataClass(intptr_t class_id) { 1983 RawClass* Class::NewExternalTypedDataClass(intptr_t class_id) {
1956 ASSERT(RawObject::IsExternalTypedDataClassId(class_id)); 1984 ASSERT(RawObject::IsExternalTypedDataClassId(class_id));
1957 intptr_t instance_size = ExternalTypedData::InstanceSize(); 1985 intptr_t instance_size = ExternalTypedData::InstanceSize();
1958 Class& result = Class::Handle(New<ExternalTypedData>(class_id)); 1986 Class& result = Class::Handle(New<ExternalTypedData>(class_id));
1959 result.set_instance_size(instance_size); 1987 result.set_instance_size(instance_size);
1960 result.set_next_field_offset(instance_size); 1988 result.set_next_field_offset(instance_size);
1961 result.set_is_prefinalized(); 1989 result.set_is_prefinalized();
1962 return result.raw(); 1990 return result.raw();
1963 } 1991 }
1964 1992
(...skipping 11674 matching lines...) Expand 10 before | Expand all | Expand 10 after
13639 } 13667 }
13640 return result.raw(); 13668 return result.raw();
13641 } 13669 }
13642 13670
13643 13671
13644 const char* WeakProperty::ToCString() const { 13672 const char* WeakProperty::ToCString() const {
13645 return "_WeakProperty"; 13673 return "_WeakProperty";
13646 } 13674 }
13647 13675
13648 } // namespace dart 13676 } // namespace dart
OLDNEW
« 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