Closed Bug 1783397 Opened 2 years ago Closed 7 months ago

Add JS::Value::dump

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(19 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.

the Symbol's description field was wrong.
I'll fix it.

js> dumpValue(true);

{
  "type": "boolean",
  "value": true
}

js> dumpValue(null);

{
  "type": "null"
}

js> dumpValue(undefined);

{
  "type": "undefined"
}

js> dumpValue(10);

{
  "type": "int32",
  "value": 10
}

js> dumpValue(1.1);

{
  "type": "double",
  "value": "1.1",
  "private": "0x3ff199999999999a"
}

js> dumpValue(10n);

{
  "type": "bigint",
  "address": "(JS::BigInt*)0x11199796b030",
  "digitLength": 1,
  "value": "10n"
}

js> dumpValue("foo");

{
  "type": "string",
  "address": "(JSAtom*)0x11199792d440",
  "flags": [ "ATOM_BIT", "LINEAR_BIT", "INLINE_BIT", "PERMANENT", "LATIN1_CHARS_BIT", "PINNED_ATOM_BIT" ],
  "isTenured": true,
  "length": 3,
  "chars": "(JS::Latin1Char*)0x11199792d448",
  "value": "foo"
}

js> dumpValue(Symbol.iterator);

{
  "type": "symbol",
  "address": "(JS::Symbol*)0x11199793a040",
  "code": "iterator",
  "description": "Symbol.iterator"
}

js> dumpValue(Symbol("foo"));

{
  "type": "symbol",
  "address": "(JS::Symbol*)0x11199796c030",
  "code": "UniqueSymbol",
  "description": "foo"
}

js> dumpValue(Symbol.for("foo"));

{
  "type": "symbol",
  "address": "(JS::Symbol*)0x11199796c040",
  "code": "InSymbolRegistry",
  "description": "foo"
}

js> dumpValue(/foo/ig);

{
  "type": "object",
  "address": "(JSObject*)0x203dde901158",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<RegExp @ (JSClass*)0x105e2bc00>",
  "shape": "<(js::Shape*)0x111997966fe0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c298",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x1119979410d0"
  },
  "source": "foo",
  "flags": [ "IgnoreCase", "Global" ],
  "lastIndex": "0",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "0",
    "1": "'foo' @ (JSAtom*)0x11199792d440",
    "2": "3",
    "3": "<private GCThing @ 0x111997971098>"
  },
  "properties": {
    "lastIndex": "0 (map=(js::CompactPropMap*)0x111997944f30, index=0, writable, slot=0)"
  }
}

js> dumpValue({});

{
  "type": "object",
  "address": "(JSObject*)0x203dde901278",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Object @ (JSClass*)0x105e1f8e8>",
  "shape": "<(js::Shape*)0x111997972040, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c0e8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941040"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "properties": {
  }
}

js> dumpValue([]);

{
  "type": "object",
  "address": "(JSObject*)0x203dde901398",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Array @ (JSClass*)0x105e1d520>",
  "shape": "<(js::Shape*)0x111997966500, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c220",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x11199793e088"
  },
  "elementsHeader": "<(js::ObjectElements*)0x203dde9013b0, flags=[FIXED], init=0, capacity=6, length=0>",
  "properties": {
    "length": "(map=(js::NormalPropMap*)0x11199795f780, index=0, writable, <custom-data-prop>)"
  }
}

js> dumpValue(Array);

{
  "type": "object",
  "address": "(JSObject*)0x111997963820",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Function @ (JSClass*)0x105e29760>",
  "shape": "<(js::Shape*)0x1119979662a0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c0a0",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997943040"
  },
  "displayAtom": "Array",
  "nargs": 1,
  "flags": [ "NORMAL_KIND", "CONSTRUCTOR" ],
  "native": "0x1024e63d8",
  "jitInfo": "0x104930578",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "65664",
    "1": "2.14111208e-314 / <private @ 0x1024e63d8>",
    "2": "2.1599123926e-314 / <private @ 0x104930578>",
    "3": "'Array' @ (JSAtom*)0x11199792c520"
  },
  "properties": {
    "isArray": "<Function isArray @ (JSObject*)0x111997963b30> (map=(js::CompactPropMap*)0x111997944bf0, index=0, configurable, writable, slot=4)"
    "from": "<Function from @ (JSObject*)0x111997945dc0> (map=(js::CompactPropMap*)0x111997944bf0, index=1, configurable, writable, slot=5)"
    "of": "<Function of @ (JSObject*)0x111997963b68> (map=(js::CompactPropMap*)0x111997944bf0, index=2, configurable, writable, slot=6)"
    "Symbol.species": "getter=0x111997945e08, setter=0x0 (map=(js::CompactPropMap*)0x111997944bf0, index=3, configurable, slot=7)"
    "prototype": "<Array @ (JSObject*)0x11199793e088> (map=(js::CompactPropMap*)0x111997944bf0, index=4, slot=8)"
  }
}

js> dumpValue(function f() {});

{
  "type": "object",
  "address": "(JSObject*)0x203dde9015b0",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Function @ (JSClass*)0x105e29760>",
  "shape": "<(js::Shape*)0x11199793d160, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c0a0",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997943040"
  },
  "displayAtom": "f",
  "baseScript": "/Users/arai/Documents/xpi/mozpatch/dump-value/test.js line 3 > eval:1:20 @ 0x11199796a560",
  "nargs": 0,
  "flags": [ "NORMAL_KIND", "BASESCRIPT", "CONSTRUCTOR", "LAMBDA" ],
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "672",
    "1": "<Call @ (JSObject*)0x203dde9014d8>",
    "2": "9.2892321007895e-311 / <private @ 0x11199796a560>",
    "3": "'f' @ (JSAtom*)0x111997904d00"
  },
  "properties": {
  }
}

js> dumpValue(new Int8Array([1, 2, 3]));

{
  "type": "object",
  "address": "(JSObject*)0x203dde9016c8",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Int8Array @ (JSClass*)0x105e2fe60>",
  "shape": "<(js::Shape*)0x111997972b20, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c328",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941100"
  },
  "length": "3",
  "byteOffset": "0",
  "data": "0x203dde901700",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "null",
    "1": "1.5e-323 / <private @ 0x3>",
    "2": "0 / <private @ 0x0>",
    "3": "1.7514676096559e-310 / <private @ 0x203dde901700>"
  },
  "properties": {
  }
}

js> dumpValue(new Int8Array(new Int8Array([1, 2, 3]).buffer, 1));

{
  "type": "object",
  "address": "(JSObject*)0x203dde901860",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Int8Array @ (JSClass*)0x105e2fe60>",
  "shape": "<(js::Shape*)0x111997972b20, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c328",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941100"
  },
  "length": "2",
  "byteOffset": "1",
  "data": "0x111997974069",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "<ArrayBuffer byteLength=3, bufferKind=INLINE_DATA, flags=[], data=0x111997974068 @ (JSObject*)0x111997974030>",
    "1": "1e-323 / <private @ 0x2>",
    "2": "5e-324 / <private @ 0x1>",
    "3": "9.2892321203985e-311 / <private @ 0x111997974069>"
  },
  "properties": {
  }
}

js> dumpValue(new Int32Array([1, 2, 3]));

{
  "type": "object",
  "address": "(JSObject*)0x203dde901978",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Int32Array @ (JSClass*)0x105e2ff20>",
  "shape": "<(js::Shape*)0x111997972d80, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c388",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941160"
  },
  "length": "3",
  "byteOffset": "0",
  "data": "0x203dde9019b0",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "null",
    "1": "1.5e-323 / <private @ 0x3>",
    "2": "0 / <private @ 0x0>",
    "3": "1.7514676096899e-310 / <private @ 0x203dde9019b0>"
  },
  "properties": {
  }
}

js> dumpValue(new Int32Array(new Int32Array([1, 2, 3]).buffer, 4));

{
  "type": "object",
  "address": "(JSObject*)0x203dde901b10",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Int32Array @ (JSClass*)0x105e2ff20>",
  "shape": "<(js::Shape*)0x111997972d80, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c388",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941160"
  },
  "length": "2",
  "byteOffset": "4",
  "data": "0x1119979740c4",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "<ArrayBuffer byteLength=12, bufferKind=INLINE_DATA, flags=[], data=0x1119979740c0 @ (JSObject*)0x111997974088>",
    "1": "1e-323 / <private @ 0x2>",
    "2": "2e-323 / <private @ 0x4>",
    "3": "9.2892321204434e-311 / <private @ 0x1119979740c4>"
  },
  "properties": {
  }
}

js> dumpValue(new Int8Array([1, 2, 3]).buffer);

{
  "type": "object",
  "address": "(JSObject*)0x1119979740e0",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<ArrayBuffer @ (JSClass*)0x105e21340>",
  "shape": "<(js::Shape*)0x111997972cc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c358",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941148"
  },
  "byteLength": "3",
  "bufferKind": "INLINE_DATA",
  "flags": [ ],
  "data": "0x111997974118",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "9.289232120485e-311 / <private @ 0x111997974118>",
    "1": "1.5e-323 / <private @ 0x3>",
    "2": "<Int8Array length=3, byteOffset=0, data=0x111997974118 @ (JSObject*)0x203dde901c28>",
    "3": "0"
  },
  "properties": {
  }
}

js> dumpValue(new Promise(() => {}));

{
  "type": "object",
  "address": "(JSObject*)0x203dde901da0",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ ],
  "state": "pending",
  "reactions": [
  ],
  "allocationTime": "591.630542",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d138>",
  "resolutionTime": "0.000000",
  "resolutionSite": "null",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "0",
    "1": "undefined",
    "2": "<Function (anonymous) @ (JSObject*)0x203dde901e90>",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde901de0>"
  },
  "properties": {
  }
}

js> var p = new Promise(() => {}); p.then(() => {}); dumpValue(p);

{
  "type": "object",
  "address": "(JSObject*)0x203dde901ff8",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ "HANDLED" ],
  "state": "pending",
  "reactions": [
    {
      "promise": "<Promise  @ (JSObject*)0x203dde902178>",
      "incumbentGlobal": "<Object @ (JSObject*)0x111997941040>",
      "flags": [ ]
    }
  ],
  "allocationTime": "652.663083",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d240>",
  "resolutionTime": "0.000000",
  "resolutionSite": "null",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "4",
    "1": "<PromiseReactionRecord @ (JSObject*)0x203dde902218>",
    "2": "<Function (anonymous) @ (JSObject*)0x203dde9020e8>",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde902038>"
  },
  "properties": {
  }
}

js> var p = new Promise(() => {}); p.then(() => {}); p.then(() => {}); dumpValue(p);

{
  "type": "object",
  "address": "(JSObject*)0x203dde902390",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ "HANDLED" ],
  "state": "pending",
  "reactions": [
    {
      "promise": "<Promise  @ (JSObject*)0x203dde902510>",
      "incumbentGlobal": "<Object @ (JSObject*)0x111997941040>",
      "flags": [ ]
    },
    {
      "promise": "<Promise  @ (JSObject*)0x203dde902650>",
      "incumbentGlobal": "<Object @ (JSObject*)0x111997941040>",
      "flags": [ ]
    }
  ],
  "allocationTime": "711.244417",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d3a0>",
  "resolutionTime": "0.000000",
  "resolutionSite": "null",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "4",
    "1": "<Array @ (JSObject*)0x203dde902750>",
    "2": "<Function (anonymous) @ (JSObject*)0x203dde902480>",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde9023d0>"
  },
  "properties": {
  }
}

js> dumpValue(Promise.resolve(10));

{
  "type": "object",
  "address": "(JSObject*)0x203dde902868",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ "RESOLVED", "FULFILLED", "DEFAULT_RESOLVING_FUNCTIONS", "DEFAULT_RESOLVING_FUNCTIONS_ALREADY_RESOLVED" ],
  "state": "fulfilled",
  "value": {
    "type": "int32",
    "value": 10
  },
  "allocationTime": "717.482875",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d558>",
  "resolutionTime": "717.531500",
  "resolutionSite": "<SavedFrame @ (JSObject*)0x11199794d558>",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "27",
    "1": "10",
    "2": "undefined",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde9028a8>"
  },
  "properties": {
  }
}

js> var p = Promise.reject(10); dumpValue(p);

{
  "type": "object",
  "address": "(JSObject*)0x203dde9029e0",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ "RESOLVED", "DEFAULT_RESOLVING_FUNCTIONS", "DEFAULT_RESOLVING_FUNCTIONS_ALREADY_RESOLVED" ],
  "state": "rejected",
  "reason": {
    "type": "int32",
    "value": 10
  },
  "allocationTime": "756.589917",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d660>",
  "resolutionTime": "756.620458",
  "resolutionSite": "<SavedFrame @ (JSObject*)0x11199794d660>",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "25",
    "1": "10",
    "2": "undefined",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde902a20>"
  },
  "properties": {
  }
}

js> dumpValue((async function() {})());

{
  "type": "object",
  "address": "(JSObject*)0x203dde902c18",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Promise @ (JSClass*)0x105e29cf8>",
  "shape": "<(js::Shape*)0x111997972fc0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c3b8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941178"
  },
  "flags": [ "RESOLVED", "FULFILLED", "DEFAULT_RESOLVING_FUNCTIONS", "ASYNC" ],
  "state": "fulfilled",
  "value": {
    "type": "undefined"
  },
  "allocationTime": "818.985458",
  "allocationSite": "<SavedFrame @ (JSObject*)0x11199794d7c0>",
  "resolutionTime": "819.177167",
  "resolutionSite": "<SavedFrame @ (JSObject*)0x11199794d7c0>",
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "43",
    "1": "undefined",
    "2": "undefined",
    "3": "<PromiseDebugInfo @ (JSObject*)0x203dde902c58>"
  },
  "properties": {
  }
}

js> dumpValue(new Date());

{
  "type": "object",
  "address": "(JSObject*)0x203dde902e30",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Date @ (JSClass*)0x105e37250>",
  "shape": "<(js::Shape*)0x111997975de0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c4d8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x1119979411d8"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "1660745415458 / <private @ 0x42782ac23fb22000>",
    "1": "undefined",
    "2": "undefined",
    "3": "undefined",
    "4": "undefined",
    "5": "undefined",
    "6": "undefined",
    "7": "undefined"
  },
  "properties": {
  }
}

js> dumpValue(new Map([ ["foo", 10], ["bar", 20] ]));

{
  "type": "object",
  "address": "(JSObject*)0x203dde902fa8",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Map @ (JSClass*)0x105e1ef48>",
  "shape": "<(js::Shape*)0x111997977080, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c508",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x1119979411f0"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "2.201448021e-314 / <private @ 0x10995d030>",
    "1": "0 / <private @ 0x0>",
    "2": "true"
  },
  "properties": {
  }
}

js> dumpValue(new Set([1, 2, 3]));

{
  "type": "object",
  "address": "(JSObject*)0x203dde903190",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Set @ (JSClass*)0x105e1f368>",
  "shape": "<(js::Shape*)0x111997975500, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c448",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x1119979411a8"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "2.2014473886e-314 / <private @ 0x10995cb30>",
    "1": "0 / <private @ 0x0>",
    "2": "true"
  },
  "properties": {
  }
}

js> dumpValue(new WeakMap([ [{}, 10], [{}, 20] ]));

{
  "type": "object",
  "address": "(JSObject*)0x11199793f150",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<WeakMap @ (JSClass*)0x105e33db8>",
  "shape": "<(js::Shape*)0x1119979773a0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c550",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941208"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "2.201325232e-314 / <private @ 0x109920560>"
  },
  "properties": {
  }
}

js> dumpValue(new WeakSet([{}, {}]));

{
  "type": "object",
  "address": "(JSObject*)0x11199793f178",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<WeakSet @ (JSClass*)0x105e34120>",
  "shape": "<(js::Shape*)0x1119979774e0, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c580",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941220"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "2.2013261726e-314 / <private @ 0x109920cd0>"
  },
  "properties": {
  }
}

js> dumpValue(new Proxy({}, {}));

{
  "type": "object",
  "address": "(JSObject*)0x111997942190",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Proxy @ (JSClass*)0x105e20a10>",
  "shape": "<(js::Shape*)0x111997977540, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c598",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "<dynamic>"
  },
  "handler": "(js::BaseProxyHandler*)0x105e20b70",
  "private": "<Object @ (JSObject*)0x203dde903728>"
}

js> dumpValue((function* f() {})());

{
  "type": "object",
  "address": "(JSObject*)0x203dde903940",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Generator @ (JSClass*)0x105e28448>",
  "shape": "<(js::Shape*)0x111997977780, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c5f8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941268"
  },
  "elementsHeader": "<(js::ObjectElements*)0x1048d8bd0, flags=[], init=0, capacity=0, length=0>",
  "reservedSlots": {
    "0": "<Function f (/Users/arai/Documents/xpi/mozpatch/dump-value/test.js line 3 > eval:1:22 @ 0x11199796af10) @ (JSObject*)0x203dde903880>",
    "1": "<Call @ (JSObject*)0x203dde9038c0>",
    "2": "undefined",
    "3": "<Array @ (JSObject*)0x203dde9039a0>",
    "4": "0"
  },
  "properties": {
  }
}

js> dumpValue({
  1: true,
  2: {},
  foo: false,
  bar: null,
  get x() {},
  set x(c) {},
});

{
  "type": "object",
  "address": "(JSObject*)0x203dde903ad8",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Object @ (JSClass*)0x105e1f8e8>",
  "shape": "<(js::Shape*)0x111997977800, objectFlags=[HasEnumerable, HasNonWritableOrAccessorPropExclProto, HadGetterSetterChange]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c0e8",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x111997941040"
  },
  "elementsHeader": "<(js::ObjectElements*)0x203dde903af0, flags=[NON_PACKED], init=3, capacity=5, length=0>",
  "properties": {
    "foo": "false (map=(js::CompactPropMap*)0x111997973a50, index=0, enumerable, configurable, writable, slot=0)"
    "bar": "null (map=(js::CompactPropMap*)0x111997973a50, index=1, enumerable, configurable, writable, slot=1)"
    "x": "getter=0x203dde903bb0, setter=0x203dde903bf0 (map=(js::CompactPropMap*)0x111997973a50, index=2, enumerable, configurable, slot=2)"
  },
  "elements": {
    "0": "<magic JS_ELEMENTS_HOLE>",
    "1": "true",
    "2": "<Object @ (JSObject*)0x203dde903b30>"
  }
}

js> dumpValue([
  true,
  null,
  undefined,
  10,
  1.1,
  10n,
  "foo",
  Symbol.iterator,
  Symbol("foo"),
  Symbol.for("foo"),
  /foo/ig,
  {},
  [],
  Array,
  function f() {},
  new Int8Array([1, 2, 3]),
  new Int8Array([1, 2, 3]).buffer,
]);

{
  "type": "object",
  "address": "(JSObject*)0x203dde903d08",
  "nonCCWGlobal": "<global @ (JSObject*)0x11199793e030>",
  "clasp": "<Array @ (JSClass*)0x105e1d520>",
  "shape": "<(js::Shape*)0x111997966500, objectFlags=[]>",
  "shape.base": {
    "address": "(js::BaseShape*)0x11199793c220",
    "realm": "(JS::Realm*)0x109916000",
    "proto": "(JSObject*)0x11199793e088"
  },
  "elementsHeader": "<(js::ObjectElements*)0x203dde903d30, flags=[], init=17, capacity=17, length=17>",
  "properties": {
    "length": "(map=(js::NormalPropMap*)0x11199795f780, index=0, writable, <custom-data-prop>)"
  },
  "elements": {
    "0": "true",
    "1": "null",
    "2": "undefined",
    "3": "10",
    "4": "1.1 / <private @ 0x3ff199999999999a>",
    "5": "10n @ (JS::BigInt*)0x11199796b040",
    "6": "'foo' @ (JSAtom*)0x11199792d440",
    "7": "Symbol.iterator",
    "8": "Symbol('foo') @ (JS::Symbol*)0x11199796c050",
    "9": "Symbol.for('foo') @ (JS::Symbol*)0x11199796c040",
    "10": "<RegExp /foo/ig @ (JSObject*)0x203dde903dd0>",
    "11": "<Object @ (JSObject*)0x203dde903e10>",
    "12": "<Array @ (JSObject*)0x203dde903e50>",
    "13": "<Function Array @ (JSObject*)0x111997963820>",
    "14": "<Function f (/Users/arai/Documents/xpi/mozpatch/dump-value/test.js line 3 > eval:16:12 @ 0x111997979100) @ (JSObject*)0x203dde903eb0>",
    "15": "<Int8Array length=3, byteOffset=0, data=0x203dde903f28 @ (JSObject*)0x203dde903ef0>",
    "16": "<ArrayBuffer byteLength=3, bufferKind=INLINE_DATA, flags=[], data=0x111997974170 @ (JSObject*)0x111997974138>"
  }
}

Also

js> var s = "Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! "; dumpStringRepresentation(s.slice(4, 80));

{
  "address": "(JSDependentString*)0x1b81a000798",
  "flags": [ "LINEAR_BIT", "DEPENDENT_BIT", "LATIN1_CHARS_BIT" ],
  "isTenured": false,
  "length": 76,
  "offset": 4,
  "base": {
    "address": "(JSLinearString*)0x17c287167040",
    "flags": [ "LINEAR_BIT", "LATIN1_CHARS_BIT" ],
    "isTenured": true,
    "length": 126,
    "chars": "(JS::Latin1Char*)0x10a624a80",
    "value": "Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! "
  },
  "chars": "(JS::Latin1Char*)0x10a624a84",
  "value": "o, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, Wor"
}

js> var rope = "test".repeat(10); dumpStringRepresentation(rope);

{
  "address": "(JSRope*)0x1b81a000818",
  "flags": [ "LATIN1_CHARS_BIT" ],
  "isTenured": false,
  "length": 40,
  "left": {
    "address": "(JSThinInlineString*)0x1b81a0007b8",
    "flags": [ "LINEAR_BIT", "INLINE_BIT", "LATIN1_CHARS_BIT" ],
    "isTenured": false,
    "length": 8,
    "chars": "(JS::Latin1Char*)0x1b81a0007c0",
    "value": "testtest"
  },
  "right": {
    "address": "(JSRope*)0x1b81a0007f8",
    "flags": [ "LATIN1_CHARS_BIT" ],
    "isTenured": false,
    "length": 32,
    "left": {
      "address": "(JSThinInlineString*)0x1b81a0007d8",
      "flags": [ "LINEAR_BIT", "INLINE_BIT", "LATIN1_CHARS_BIT" ],
      "isTenured": false,
      "length": 16,
      "chars": "(JS::Latin1Char*)0x1b81a0007e0",
      "value": "testtesttesttest"
    },
    "right": {
      "address": "(JSThinInlineString*)0x1b81a0007d8",
      "flags": [ "LINEAR_BIT", "INLINE_BIT", "LATIN1_CHARS_BIT" ],
      "isTenured": false,
      "length": 16,
      "chars": "(JS::Latin1Char*)0x1b81a0007e0",
      "value": "testtesttesttest"
    }
  }
}

so far, indent-based dump around string and object are replaced with JSON dump, with extra information.
there's limitation that, compact notation for special value needs to be in string, and JSString vs non-string became unclear,
so, I've added single quotation for JSStrings in some cases.

See Also: → 486637
See Also: → 1278949

This reverts commit 5f149f8b11b9f725663845475f2be0365f25575f.

Attachment #9376852 - Attachment description: Bug 1783397 - Part 11: Add {js::Shape,js::PropMap}::dump. r=mgaudet → Bug 1783397 - Part 11: Add {js::Shape,js::PropMap}::dump. r=mgaudet!
Attachment #9376853 - Attachment description: Bug 1783397 - Part 12: Add {JS::BigInt,ObjectElements,Shape}::dumpStringContent methods. r=mgaudet → Bug 1783397 - Part 12: Add {JS::BigInt,ObjectElements,Shape}::dumpStringContent methods. r=mgaudet!
Attachment #9376854 - Attachment description: Bug 1783397 - Part 13: Make JSObject::dump JSON-based, and add JS::Value::dump. r=mgaudet → Bug 1783397 - Part 13: Make JSObject::dump JSON-based, and add JS::Value::dump. r=mgaudet!
Attachment #9376855 - Attachment description: Bug 1783397 - Part 14: Add dumpValue testing funtion. r=mgaudet → Bug 1783397 - Part 14: Add dumpValue testing funtion. r=mgaudet!
Attachment #9376856 - Attachment description: Bug 1783397 - Part 15: Specialize JSObject::dump for JSFunction and RegExpObject. r=mgaudet → Bug 1783397 - Part 15: Specialize JSObject::dump for JSFunction and RegExpObject. r=mgaudet!
Attachment #9376857 - Attachment description: Bug 1783397 - Part 16: Remove non-existent dumpBytecode methods for RegExp. r=mgaudet → Bug 1783397 - Part 16: Remove non-existent dumpBytecode methods for RegExp. r=mgaudet!
Attachment #9376858 - Attachment description: Bug 1783397 - Part 17: Specialize JSObject::dump for PromiseObject. r=mgaudet → Bug 1783397 - Part 17: Specialize JSObject::dump for PromiseObject. r=mgaudet!
Attachment #9376859 - Attachment description: Bug 1783397 - Part 18: Specialize JSObject::dump for typed array. r=mgaudet → Bug 1783397 - Part 18: Specialize JSObject::dump for typed array. r=mgaudet!
Attachment #9376860 - Attachment description: Bug 1783397 - Part 19: Add tests. r=mgaudet → Bug 1783397 - Part 19: Add tests. r=mgaudet!
Attachment #9376842 - Attachment description: Bug 1783397 - Part 1: Add JSONPrinter::beforeValue for common operations before printing key/value. r=mgaudet → Bug 1783397 - Part 1: Add JSONPrinter::beforeValue for common operations before printing key/value. r=mgaudet!
Attachment #9376843 - Attachment description: Bug 1783397 - Part 2: Expose JSONPrinter::propertyName to print property name and value separately. r=mgaudet → Bug 1783397 - Part 2: Expose JSONPrinter::propertyName to print property name and value separately. r=mgaudet!
Attachment #9376844 - Attachment description: Bug 1783397 - Part 3: Add JSONPrinter::{beginStringPropertyName,endStringPropertyName}. r=mgaudet → Bug 1783397 - Part 3: Add JSONPrinter::{beginStringPropertyName,endStringPropertyName}. r=mgaudet!
Attachment #9376845 - Attachment description: Bug 1783397 - Part 4: Add JSONPrinter::{beginInlineListProperty,endInlineList}. r=mgaudet → Bug 1783397 - Part 4: Add JSONPrinter::{beginInlineListProperty,endInlineList}. r=mgaudet!
Attachment #9376846 - Attachment description: Bug 1783397 - Part 5: Make JS::BigInt::dump JSON-based. r=mgaudet → Bug 1783397 - Part 5: Make JS::BigInt::dump JSON-based. r=mgaudet!
Attachment #9376847 - Attachment description: Bug 1783397 - Part 6: Make JSString::{dump,dumpRepresentation} JSON-based. r=mgaudet → Bug 1783397 - Part 6: Make JSString::{dump,dumpRepresentation} JSON-based. r=mgaudet!
Attachment #9376848 - Attachment description: Bug 1783397 - Part 7: Make JS::Symbol::dump JSON-based. r=mgaudet → Bug 1783397 - Part 7: Make JS::Symbol::dump JSON-based. r=mgaudet!
Attachment #9376849 - Attachment description: Bug 1783397 - Part 8: Add JS::PropertyKey::dump. r=mgaudet → Bug 1783397 - Part 8: Add JS::PropertyKey::dump. r=mgaudet!
Attachment #9376850 - Attachment description: Bug 1783397 - Part 9: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpPropertyName. r=mgaudet → Bug 1783397 - Part 9: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpPropertyName. r=mgaudet!
Attachment #9376851 - Attachment description: Bug 1783397 - Part 10: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpStringContent methods. r=mgaudet → Bug 1783397 - Part 10: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpStringContent methods. r=mgaudet!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/67cda330103c
Part 1: Add JSONPrinter::beforeValue for common operations before printing key/value. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/47e30f0625fc
Part 2: Expose JSONPrinter::propertyName to print property name and value separately. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/0a99182792eb
Part 3: Add JSONPrinter::{beginStringPropertyName,endStringPropertyName}. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/7cfd9198841d
Part 4: Add JSONPrinter::{beginInlineListProperty,endInlineList}. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/da88bfbf8dd5
Part 5: Make JS::BigInt::dump JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/10e81e8b31a6
Part 6: Make JSString::{dump,dumpRepresentation} JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/997dd2cbe1bf
Part 7: Make JS::Symbol::dump JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/0514e2038baa
Part 8: Add JS::PropertyKey::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/7453c0e7c345
Part 9: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpPropertyName. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/08fd66807078
Part 10: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpStringContent methods. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/38477162dadf
Part 11: Add {js::Shape,js::PropMap}::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/7e51d514e0a0
Part 12: Add {JS::BigInt,ObjectElements,Shape}::dumpStringContent methods. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/2bc5e87ff79f
Part 13: Make JSObject::dump JSON-based, and add JS::Value::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/3e370ef627cf
Part 14: Add dumpValue testing funtion. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/97e72d850c26
Part 15: Specialize JSObject::dump for JSFunction and RegExpObject. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/b784c637b023
Part 16: Remove non-existent dumpBytecode methods for RegExp. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/8bfa6cc84377
Part 17: Specialize JSObject::dump for PromiseObject. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/d9615c8d21a0
Part 18: Specialize JSObject::dump for typed array. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/b4429209f9f8
Part 19: Add tests. r=mgaudet

Backed out for causing spidermonkey bustages

  • Backout link
  • Push with failures
  • Failure Log
  • Failure Log 2
  • Failure line: /builds/worker/checkouts/gecko/js/src/vm/Id.cpp:86:49: error: format specifies type 'unsigned long' but the argument has type 'uintptr_t' (aka 'unsigned int') [-Werror,-Wformat]
    /builds/worker/checkouts/gecko/js/src/vm/Value.cpp:252:30: error: member reference type 'JSObject' is not a pointer; did you mean to use '.'?
Flags: needinfo?(arai.unmht)
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/ca70023ae54b
Part 1: Add JSONPrinter::beforeValue for common operations before printing key/value. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/a1b0aa328d77
Part 2: Expose JSONPrinter::propertyName to print property name and value separately. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/82312c5cf445
Part 3: Add JSONPrinter::{beginStringPropertyName,endStringPropertyName}. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/07f3b0a19ff5
Part 4: Add JSONPrinter::{beginInlineListProperty,endInlineList}. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/e3f72d580893
Part 5: Make JS::BigInt::dump JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/865ed9e42941
Part 6: Make JSString::{dump,dumpRepresentation} JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/d2f48f681ab4
Part 7: Make JS::Symbol::dump JSON-based. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/be5cab83ca84
Part 8: Add JS::PropertyKey::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/520e28927657
Part 9: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpPropertyName. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/54687ab737ec
Part 10: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpStringContent methods. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/03ce887fcd1a
Part 11: Add {js::Shape,js::PropMap}::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/3b7fb84c8ac8
Part 12: Add {JS::BigInt,ObjectElements,Shape}::dumpStringContent methods. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/41ba51bc740b
Part 13: Make JSObject::dump JSON-based, and add JS::Value::dump. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/8d7916c07be5
Part 14: Add dumpValue testing funtion. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/f856e45cb9b9
Part 15: Specialize JSObject::dump for JSFunction and RegExpObject. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/dfc51d76c7f3
Part 16: Remove non-existent dumpBytecode methods for RegExp. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/f5698a260f72
Part 17: Specialize JSObject::dump for PromiseObject. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/b26174e58a5e
Part 18: Specialize JSObject::dump for typed array. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/1cc0fa18c2bf
Part 19: Add tests. r=mgaudet
Flags: needinfo?(arai.unmht)
Blocks: 1879680
Regressions: 1885475
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: