| Index: runtime/observatory/lib/src/service/object.dart
|
| diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
|
| index 8cff98b4b1c80ed16b79466a26a72effb1a7fe19..515fa9d2b4f1497244f292ff76af0765692a7c57 100644
|
| --- a/runtime/observatory/lib/src/service/object.dart
|
| +++ b/runtime/observatory/lib/src/service/object.dart
|
| @@ -2604,65 +2604,35 @@ class Context extends HeapObject {
|
| String toString() => 'Context($length)';
|
| }
|
|
|
| -
|
| -// TODO(koda): Sync this with VM.
|
| -class FunctionKind {
|
| - final String _strValue;
|
| - FunctionKind._internal(this._strValue);
|
| - toString() => _strValue;
|
| - bool isSynthetic() => [kCollected, kNative, kStub, kTag].contains(this);
|
| - bool isDart() => !isSynthetic();
|
| - bool isStub() => (this == kStub);
|
| - bool hasDartCode() => isDart() || isStub();
|
| - static FunctionKind fromJSON(String value) {
|
| - switch(value) {
|
| - case 'RegularFunction': return kRegularFunction;
|
| - case 'ClosureFunction': return kClosureFunction;
|
| - case 'GetterFunction': return kGetterFunction;
|
| - case 'SetterFunction': return kSetterFunction;
|
| - case 'Constructor': return kConstructor;
|
| - case 'ImplicitGetter': return kImplicitGetterFunction;
|
| - case 'ImplicitSetter': return kImplicitSetterFunction;
|
| - case 'ImplicitStaticFinalGetter': return kImplicitStaticFinalGetter;
|
| - case 'IrregexpFunction': return kIrregexpFunction;
|
| - case 'StaticInitializer': return kStaticInitializer;
|
| - case 'MethodExtractor': return kMethodExtractor;
|
| - case 'NoSuchMethodDispatcher': return kNoSuchMethodDispatcher;
|
| - case 'InvokeFieldDispatcher': return kInvokeFieldDispatcher;
|
| - case 'Collected': return kCollected;
|
| - case 'Native': return kNative;
|
| - case 'Stub': return kStub;
|
| - case 'Tag': return kTag;
|
| - case 'SignatureFunction': return kSignatureFunction;
|
| - }
|
| - Logger.root.severe('Unrecognized function kind: $value');
|
| - throw new FallThroughError();
|
| - }
|
| -
|
| - static FunctionKind kRegularFunction = new FunctionKind._internal('function');
|
| - static FunctionKind kClosureFunction = new FunctionKind._internal('closure function');
|
| - static FunctionKind kGetterFunction = new FunctionKind._internal('getter function');
|
| - static FunctionKind kSetterFunction = new FunctionKind._internal('setter function');
|
| - static FunctionKind kConstructor = new FunctionKind._internal('constructor');
|
| - static FunctionKind kImplicitGetterFunction = new FunctionKind._internal('implicit getter function');
|
| - static FunctionKind kImplicitSetterFunction = new FunctionKind._internal('implicit setter function');
|
| - static FunctionKind kImplicitStaticFinalGetter = new FunctionKind._internal('implicit static final getter');
|
| - static FunctionKind kIrregexpFunction = new FunctionKind._internal('ir regexp function');
|
| - static FunctionKind kStaticInitializer = new FunctionKind._internal('static initializer');
|
| - static FunctionKind kMethodExtractor = new FunctionKind._internal('method extractor');
|
| - static FunctionKind kNoSuchMethodDispatcher = new FunctionKind._internal('noSuchMethod dispatcher');
|
| - static FunctionKind kInvokeFieldDispatcher = new FunctionKind._internal('invoke field dispatcher');
|
| - static FunctionKind kCollected = new FunctionKind._internal('Collected');
|
| - static FunctionKind kNative = new FunctionKind._internal('Native');
|
| - static FunctionKind kTag = new FunctionKind._internal('Tag');
|
| - static FunctionKind kStub = new FunctionKind._internal('Stub');
|
| - static FunctionKind kSignatureFunction = new FunctionKind._internal('SignatureFunction');
|
| - static FunctionKind kUNKNOWN = new FunctionKind._internal('UNKNOWN');
|
| +M.FunctionKind stringToFunctionKind(String value) {
|
| + switch(value) {
|
| + case 'RegularFunction': return M.FunctionKind.regular;
|
| + case 'ClosureFunction': return M.FunctionKind.closure;
|
| + case 'GetterFunction': return M.FunctionKind.getter;
|
| + case 'SetterFunction': return M.FunctionKind.setter;
|
| + case 'Constructor': return M.FunctionKind.constructor;
|
| + case 'ImplicitGetter': return M.FunctionKind.implicitGetter;
|
| + case 'ImplicitSetter': return M.FunctionKind.implicitSetter;
|
| + case 'ImplicitStaticFinalGetter':
|
| + return M.FunctionKind.implicitStaticFinalGetter;
|
| + case 'IrregexpFunction': return M.FunctionKind.irregexpFunction;
|
| + case 'StaticInitializer': return M.FunctionKind.staticInitializer;
|
| + case 'MethodExtractor': return M.FunctionKind.methodExtractor;
|
| + case 'NoSuchMethodDispatcher': return M.FunctionKind.noSuchMethodDispatcher;
|
| + case 'InvokeFieldDispatcher': return M.FunctionKind.invokeFieldDispatcher;
|
| + case 'Collected': return M.FunctionKind.collected;
|
| + case 'Native': return M.FunctionKind.native;
|
| + case 'Stub': return M.FunctionKind.stub;
|
| + case 'Tag': return M.FunctionKind.tag;
|
| + case 'SignatureFunction': return M.FunctionKind.signatureFunction;
|
| + }
|
| + Logger.root.severe('Unrecognized function kind: $value');
|
| + throw new FallThroughError();
|
| }
|
|
|
| -class ServiceFunction extends HeapObject {
|
| +class ServiceFunction extends HeapObject implements M.Function {
|
| // owner is a Library, Class, or ServiceFunction.
|
| - @observable ServiceObject dartOwner;
|
| + @observable M.ObjectRef dartOwner;
|
| @observable Library library;
|
| @observable bool isStatic;
|
| @observable bool isConst;
|
| @@ -2674,7 +2644,7 @@ class ServiceFunction extends HeapObject {
|
| @observable bool hasIntrinsic;
|
| @observable bool isRecognized;
|
| @observable bool isNative;
|
| - @observable FunctionKind kind;
|
| + @observable M.FunctionKind kind;
|
| @observable int deoptimizations;
|
| @observable String qualifiedName;
|
| @observable int usageCounter;
|
| @@ -2696,8 +2666,8 @@ class ServiceFunction extends HeapObject {
|
| vmName = (map.containsKey('_vmName') ? map['_vmName'] : name);
|
|
|
| dartOwner = map['owner'];
|
| - kind = FunctionKind.fromJSON(map['_kind']);
|
| - isDart = kind.isDart();
|
| + kind = stringToFunctionKind(map['_kind']);
|
| + isDart = M.isDartFunction(kind);
|
|
|
| if (dartOwner is ServiceFunction) {
|
| ServiceFunction ownerFunction = dartOwner;
|
| @@ -3550,32 +3520,20 @@ class CodeInstruction extends Observable {
|
| }
|
| }
|
|
|
| -class CodeKind {
|
| - final _value;
|
| - const CodeKind._internal(this._value);
|
| - String toString() => '$_value';
|
| - bool isSynthetic() => [Collected, Native, Tag].contains(this);
|
| - bool isDart() => !isSynthetic();
|
| - static CodeKind fromString(String s) {
|
| - if (s == 'Native') {
|
| - return Native;
|
| - } else if (s == 'Dart') {
|
| - return Dart;
|
| - } else if (s == 'Collected') {
|
| - return Collected;
|
| - } else if (s == 'Tag') {
|
| - return Tag;
|
| - } else if (s == 'Stub') {
|
| - return Stub;
|
| - }
|
| - Logger.root.severe("Unrecognized code kind: '$s'");
|
| - throw new FallThroughError();
|
| - }
|
| - static const Collected = const CodeKind._internal('Collected');
|
| - static const Dart = const CodeKind._internal('Dart');
|
| - static const Native = const CodeKind._internal('Native');
|
| - static const Stub = const CodeKind._internal('Stub');
|
| - static const Tag = const CodeKind._internal('Tag');
|
| +M.CodeKind stringToCodeKind(String s) {
|
| + if (s == 'Native') {
|
| + return M.CodeKind.native;
|
| + } else if (s == 'Dart') {
|
| + return M.CodeKind.dart;
|
| + } else if (s == 'Collected') {
|
| + return M.CodeKind.collected;
|
| + } else if (s == 'Tag') {
|
| + return M.CodeKind.tag;
|
| + } else if (s == 'Stub') {
|
| + return M.CodeKind.stub;
|
| + }
|
| + Logger.root.severe("Unrecognized code kind: '$s'");
|
| + throw new FallThroughError();
|
| }
|
|
|
| class CodeInlineInterval {
|
| @@ -3586,8 +3544,8 @@ class CodeInlineInterval {
|
| CodeInlineInterval(this.start, this.end);
|
| }
|
|
|
| -class Code extends HeapObject {
|
| - @observable CodeKind kind;
|
| +class Code extends HeapObject implements M.Code {
|
| + @observable M.CodeKind kind;
|
| @observable ServiceObject objectPool;
|
| @observable ServiceFunction function;
|
| @observable Script script;
|
| @@ -3624,7 +3582,7 @@ class Code extends HeapObject {
|
| // Already done.
|
| return;
|
| }
|
| - if (kind != CodeKind.Dart){
|
| + if (kind != M.CodeKind.dart){
|
| return;
|
| }
|
| if (function == null) {
|
| @@ -3663,7 +3621,7 @@ class Code extends HeapObject {
|
| name = m['name'];
|
| vmName = (m.containsKey('_vmName') ? m['_vmName'] : name);
|
| isOptimized = m['_optimized'];
|
| - kind = CodeKind.fromString(m['kind']);
|
| + kind = stringToCodeKind(m['kind']);
|
| hasIntrinsic = m['_intrinsic'];
|
| isNative = m['_native'];
|
| if (mapIsRef) {
|
| @@ -3683,7 +3641,7 @@ class Code extends HeapObject {
|
| descriptors = descriptors['members'];
|
| _processDescriptors(descriptors);
|
| }
|
| - hasDisassembly = (instructions.length != 0) && (kind == CodeKind.Dart);
|
| + hasDisassembly = (instructions.length != 0) && (kind == M.CodeKind.dart);
|
| inlinedFunctions.clear();
|
| var inlinedFunctionsTable = m['_inlinedFunctions'];
|
| var inlinedIntervals = m['_inlinedIntervals'];
|
| @@ -3801,8 +3759,8 @@ class Code extends HeapObject {
|
| return (address >= startAddress) && (address < endAddress);
|
| }
|
|
|
| - @reflectable bool get isDartCode => (kind == CodeKind.Dart) ||
|
| - (kind == CodeKind.Stub);
|
| + @reflectable bool get isDartCode => (kind == M.CodeKind.dart) ||
|
| + (kind == M.CodeKind.stub);
|
|
|
| String toString() => 'Code($kind, $name)';
|
| }
|
|
|