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

Unified Diff: runtime/observatory/lib/src/models/objects/instance.dart

Issue 2244433003: Converted Observatory refs elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: All element tested Created 4 years, 4 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/observatory/lib/src/models/objects/instance.dart
diff --git a/runtime/observatory/lib/src/models/objects/instance.dart b/runtime/observatory/lib/src/models/objects/instance.dart
index eb65ea5ae23d113ad4159f80a7a30fe7418fdae8..8ad270727ecda156055d7ce0fb76a3ec2f129da6 100644
--- a/runtime/observatory/lib/src/models/objects/instance.dart
+++ b/runtime/observatory/lib/src/models/objects/instance.dart
@@ -4,7 +4,131 @@
part of models;
+enum InstanceKind {
+ /// A general instance of the Dart class Object.
+ plainInstance,
+ /// null instance.
+ vNull,
+ /// true or false.
+ bool,
+ /// An instance of the Dart class double.
+ double,
+ /// An instance of the Dart class int.
+ int,
+ /// An instance of the Dart class String.
+ string,
+ /// An instance of the built-in VM List implementation. User-defined
+ /// Lists will be PlainInstance.
+ list,
+ /// An instance of the built-in VM Map implementation. User-defined
+ /// Maps will be PlainInstance.
+ map,
+ /// Vector instance kinds.
+ float32x4,
+ /// Vector instance kinds.
+ float64x2,
+ /// Vector instance kinds.
+ int32x4,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ uint8ClampedList,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ uint8List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ uint16List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ uint32List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ uint64List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ int8List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ int16List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ int32List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ int64List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ float32List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ float64List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ int32x4List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ float32x4List,
+ /// An instance of the built-in VM TypedData implementations. User-defined
+ /// TypedDatas will be PlainInstance.
+ float64x2List,
+ /// An instance of the Dart class StackTrace.
+ stackTrace,
+ /// An instance of the built-in VM Closure implementation. User-defined
+ /// Closures will be PlainInstance.
+ closure,
+ /// An instance of the Dart class MirrorReference.
+ mirrorReference,
+ /// An instance of the Dart class RegExp.
+ regExp,
+ /// An instance of the Dart class WeakProperty.
+ weakProperty,
+ /// An instance of the Dart class Type.
+ type,
+ /// An instance of the Dart class TypeParameter.
+ typeParameter,
+ /// An instance of the Dart class TypeRef.
+ typeRef,
+ /// An instance of the Dart class BoundedType.
+ boundedType,
+}
+
+bool isTypedData(InstanceKind kind) {
+ switch (kind) {
+ case InstanceKind.uint8ClampedList:
+ case InstanceKind.uint8List:
+ case InstanceKind.uint16List:
+ case InstanceKind.uint32List:
+ case InstanceKind.uint64List:
+ case InstanceKind.int8List:
+ case InstanceKind.int16List:
+ case InstanceKind.int32List:
+ case InstanceKind.int64List:
+ case InstanceKind.float32List:
+ case InstanceKind.float64List:
+ case InstanceKind.int32x4List:
+ case InstanceKind.float32x4List:
+ case InstanceKind.float64x2List:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool isSimdValue(InstanceKind kind) {
+ switch (kind) {
+ case InstanceKind.float32x4:
+ case InstanceKind.float64x2:
+ case InstanceKind.int32x4:
+ return true;
+ default:
+ return false;
+ }
+}
+
abstract class InstanceRef extends ObjectRef {
+ /// What kind of instance is this?
+ InstanceKind get kind;
+
/// Instance references always include their class.
ClassRef get clazz;
@@ -76,6 +200,113 @@ abstract class InstanceRef extends ObjectRef {
/// Provided for instance kinds:
/// RegExp
InstanceRef get pattern;
+
+ /// [optional] The function associated with a Closure instance.
+ ///
+ /// Provided for instance kinds:
+ /// Closure
+ FunctionRef get closureFunction;
}
-abstract class Instance extends Object implements InstanceRef {}
+abstract class Instance extends Object implements InstanceRef {
+ /// [optional] The index of the first element or association or codeunit
+ /// returned. This is only provided when it is non-zero.
+ ///
+ /// Provided for instance kinds:
+ /// String
+ /// List
+ /// Map
+ /// Uint8ClampedList
+ /// Uint8List
+ /// Uint16List
+ /// Uint32List
+ /// Uint64List
+ /// Int8List
+ /// Int16List
+ /// Int32List
+ /// Int64List
+ /// Float32List
+ /// Float64List
+ /// Int32x4List
+ /// Float32x4List
+ /// Float64x2List
+ int get offset;
+
+ /// [optional] The number of elements or associations or codeunits returned.
+ /// This is only provided when it is less than length.
+ ///
+ /// Provided for instance kinds:
+ /// String
+ /// List
+ /// Map
+ /// Uint8ClampedList
+ /// Uint8List
+ /// Uint16List
+ /// Uint32List
+ /// Uint64List
+ /// Int8List
+ /// Int16List
+ /// Int32List
+ /// Int64List
+ /// Float32List
+ /// Float64List
+ /// Int32x4List
+ /// Float32x4List
+ /// Float64x2List
+ int get count;
+
+ /// [optional] The elements of a TypedData instance.
+ ///
+ /// Provided for instance kinds:
+ /// Uint8ClampedList
+ /// Uint8List
+ /// Uint16List
+ /// Uint32List
+ /// Uint64List
+ /// Int8List
+ /// Int16List
+ /// Int32List
+ /// Int64List
+ /// Float32List
+ /// Float64List
+ /// Int32x4List
+ /// Float32x4List
+ /// Float64x2List
+ Iterable<dynamic> get typedElements;
+
+ /// [optional]The fields of this Instance.
+ Iterable<BoundField> get fields;
+
+ /// [optional] The elements of a List instance.
+ ///
+ /// Provided for instance kinds:
+ /// List
+ Iterable<Guarded<ObjectRef>> get elements;
+ // It should be:
+ // Iterable<Guarded<InstanceRef>> get elements;
+ // In some situations we obtain lists of non Instances
+
+ /// [optional] The elements of a Map instance.
+ ///
+ /// Provided for instance kinds:
+ /// Map
+ Iterable<MapAssociation> get associations;
+
+ /// [optional] The key for a WeakProperty instance.
+ ///
+ /// Provided for instance kinds:
+ /// WeakProperty
+ InstanceRef get key;
+
+ /// [optional] The key for a WeakProperty instance.
+ ///
+ /// Provided for instance kinds:
+ /// WeakProperty
+ InstanceRef get value;
+
+ /// [optional] The referent of a MirrorReference instance.
+ ///
+ /// Provided for instance kinds:
+ /// MirrorReference
+ InstanceRef get referent;
+}

Powered by Google App Engine
This is Rietveld 408576698