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

Unified Diff: runtime/vm/object.cc

Issue 1157003003: Add TypedData instance kinds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d95d307668ba37b42e9980ae11f4ba5dfb406bae..dd1c7e6f5073c75e8e11c748e80c360c3ed6f9ae 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3301,9 +3301,15 @@ RawString* Class::GenerateUserVisibleName() const {
case kTypedDataUint64ArrayCid:
case kExternalTypedDataUint64ArrayCid:
return Symbols::Uint64List().raw();
+ case kTypedDataInt32x4ArrayCid:
+ case kExternalTypedDataInt32x4ArrayCid:
+ return Symbols::Int32x4List().raw();
case kTypedDataFloat32x4ArrayCid:
case kExternalTypedDataFloat32x4ArrayCid:
return Symbols::Float32x4List().raw();
+ case kTypedDataFloat64x2ArrayCid:
+ case kExternalTypedDataFloat64x2ArrayCid:
+ return Symbols::Float64x2List().raw();
case kTypedDataFloat32ArrayCid:
case kExternalTypedDataFloat32ArrayCid:
return Symbols::Float32List().raw();
@@ -20108,7 +20114,23 @@ const char* TypedData::ToCString() const {
void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const {
- Instance::PrintJSONImpl(stream, ref);
+ JSONObject jsobj(stream);
+ PrintSharedInstanceJSON(&jsobj, ref);
+ const Class& cls = Class::Handle(clazz());
+ const String& user_name = String::Handle(cls.UserVisibleName());
Cutch 2015/06/08 23:10:19 const String& kind = String::Handle(cls.UserVisibl
+ jsobj.AddProperty("kind", user_name.ToCString());
+ jsobj.AddServiceId(*this);
+ jsobj.AddProperty("length", Length());
+ if (ref) {
+ return;
+ }
+
+ {
+ NoSafepointScope no_safepoint;
+ jsobj.AddPropertyBase64("bytes",
+ reinterpret_cast<const uint8_t*>(DataAddr(0)),
+ LengthInBytes());
+ }
}
@@ -20143,7 +20165,23 @@ const char* ExternalTypedData::ToCString() const {
void ExternalTypedData::PrintJSONImpl(JSONStream* stream,
bool ref) const {
- Instance::PrintJSONImpl(stream, ref);
+ JSONObject jsobj(stream);
+ PrintSharedInstanceJSON(&jsobj, ref);
+ const Class& cls = Class::Handle(clazz());
+ const String& user_name = String::Handle(cls.UserVisibleName());
+ jsobj.AddProperty("kind", user_name.ToCString());
+ jsobj.AddServiceId(*this);
+ jsobj.AddProperty("length", Length());
+ if (ref) {
+ return;
+ }
+
+ {
+ NoSafepointScope no_safepoint;
+ jsobj.AddPropertyBase64("bytes",
+ reinterpret_cast<const uint8_t*>(DataAddr(0)),
+ LengthInBytes());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698