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

Unified Diff: runtime/vm/raw_object.h

Issue 10375007: Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index f7bf58d4bf47bec0363a9691a5a3b05c02cae1d2..deef9986ab82252a6e60a1ff89c48f7ae593e4a8 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -66,26 +66,8 @@ namespace dart {
V(ImmutableArray) \
V(GrowableObjectArray) \
V(ByteArray) \
- V(Int8Array) \
- V(Uint8Array) \
- V(Int16Array) \
- V(Uint16Array) \
- V(Int32Array) \
- V(Uint32Array) \
- V(Int64Array) \
- V(Uint64Array) \
- V(Float32Array) \
- V(Float64Array) \
- V(ExternalInt8Array) \
- V(ExternalUint8Array) \
- V(ExternalInt16Array) \
- V(ExternalUint16Array) \
- V(ExternalInt32Array) \
- V(ExternalUint32Array) \
- V(ExternalInt64Array) \
- V(ExternalUint64Array) \
- V(ExternalFloat32Array) \
- V(ExternalFloat64Array) \
+ V(InternalByteArray) \
+ V(ExternalByteArray) \
V(Closure) \
V(Stacktrace) \
V(JSRegExp) \
@@ -1131,90 +1113,20 @@ class RawByteArray : public RawInstance {
};
-class RawInt8Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Int8Array);
+class RawInternalByteArray : public RawByteArray {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(InternalByteArray);
// Variable length data follows here.
- int8_t data_[0];
-};
-
-
-class RawUint8Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Uint8Array);
-
- // Variable length data follows here.
- uint8_t data_[0];
-};
-
-
-class RawInt16Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Int16Array);
-
- // Variable length data follows here.
- int16_t data_[0];
-};
-
-
-class RawUint16Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Uint16Array);
-
- // Variable length data follows here.
- uint16_t data_[0];
-};
-
-
-class RawInt32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Int32Array);
-
- // Variable length data follows here.
- int32_t data_[0];
-};
-
-
-class RawUint32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32Array);
-
- // Variable length data follows here.
- uint32_t data_[0];
-};
-
-
-class RawInt64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Int64Array);
-
- // Variable length data follows here.
- int64_t data_[0];
-};
-
-
-class RawUint64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Uint64Array);
-
- // Variable length data follows here.
- uint64_t data_[0];
-};
-
-
-class RawFloat32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Float32Array);
-
- // Variable length data follows here.
- float data_[0];
-};
-
-
-class RawFloat64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(Float64Array);
-
- // Variable length data follows here.
- double data_[0];
+ uint8_t* data() {
+ uword address_of_length = reinterpret_cast<uword>(&length_);
+ return reinterpret_cast<uint8_t*>(address_of_length + kWordSize);
+ }
};
-template<typename T>
class ExternalByteArrayData {
public:
- ExternalByteArrayData(T* data,
+ ExternalByteArrayData(uint8_t* data,
void* peer,
Dart_PeerFinalizer callback) :
data_(data), peer_(peer), callback_(callback) {
@@ -1223,7 +1135,7 @@ class ExternalByteArrayData {
if (callback_ != NULL) (*callback_)(peer_);
}
- T* data() {
+ uint8_t* data() {
return data_;
}
void* peer() {
@@ -1231,79 +1143,16 @@ class ExternalByteArrayData {
}
private:
- T* data_;
+ uint8_t* data_;
void* peer_;
Dart_PeerFinalizer callback_;
};
-class RawExternalInt8Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array);
-
- ExternalByteArrayData<int8_t>* external_data_;
-};
-
-
-class RawExternalUint8Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array);
-
- ExternalByteArrayData<uint8_t>* external_data_;
-};
-
-
-class RawExternalInt16Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array);
-
- ExternalByteArrayData<int16_t>* external_data_;
-};
-
-
-class RawExternalUint16Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint16Array);
-
- ExternalByteArrayData<uint16_t>* external_data_;
-};
-
-
-class RawExternalInt32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt32Array);
-
- ExternalByteArrayData<int32_t>* external_data_;
-};
-
-
-class RawExternalUint32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint32Array);
-
- ExternalByteArrayData<uint32_t>* external_data_;
-};
-
-
-class RawExternalInt64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt64Array);
-
- ExternalByteArrayData<int64_t>* external_data_;
-};
-
-
-class RawExternalUint64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array);
-
- ExternalByteArrayData<uint64_t>* external_data_;
-};
-
-
-class RawExternalFloat32Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array);
-
- ExternalByteArrayData<float>* external_data_;
-};
-
-
-class RawExternalFloat64Array: public RawByteArray {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array);
+class RawExternalByteArray : public RawByteArray {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalByteArray);
- ExternalByteArrayData<double>* external_data_;
+ ExternalByteArrayData* external_data_;
};
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698