Changeset 110423 in webkit


Ignore:
Timestamp:
Mar 12, 2012 6:59:47 AM (12 years ago)
Author:
loislo@chromium.org
Message:

Re-apply the patch after v8 roll to r11000.

Web Inspector: move heap snapshot nodes data to external array.
https://bugs.webkit.org/show_bug.cgi?id=79911

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Tests:
heap-shapshot.html
heap-shapshot-loader.html

  • inspector/front-end/HeapSnapshot.js:

(WebInspector.Int32Array):
(WebInspector.Int32Array.prototype.get array):
(WebInspector.HeapSnapshotLoader.prototype._parseNodes):
(WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):
(WebInspector.HeapSnapshot):
(WebInspector.HeapSnapshot.prototype._init):

LayoutTests:

  • inspector/profiler/heap-snapshot-loader.html:
  • inspector/profiler/heap-snapshot-test.js:

(initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockRaw):
(initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMock):
(initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r110420 r110423  
     12012-03-12  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Re-apply the patch after v8 roll to r11000.
     4
     5        Web Inspector: move heap snapshot nodes data to external array.
     6        https://bugs.webkit.org/show_bug.cgi?id=79911
     7
     8        Reviewed by Vsevolod Vlasov.
     9
     10        * inspector/profiler/heap-snapshot-loader.html:
     11        * inspector/profiler/heap-snapshot-test.js:
     12        (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockRaw):
     13        (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMock):
     14        (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM):
     15
    1162012-03-12  Hans Wennborg  <hans@chromium.org>
    217
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html

    r109660 r110423  
    1515        function heapSnapshotLoaderTest(next)
    1616        {
    17             var source = InspectorTest.createHeapSnapshotMock();
     17            var source = InspectorTest.createHeapSnapshotMockRaw();
    1818            var sourceStringified = JSON.stringify(source);
    1919            var partSize = sourceStringified.length >> 3;
     
    2222                loader.pushJSONChunk(sourceStringified.slice(i, i + partSize));
    2323            var result = loader.finishLoading();
    24             InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot(source), result);
     24            InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock()), result);
    2525            next();
    2626        }
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js

    r109660 r110423  
    3838};
    3939
    40 InspectorTest.createHeapSnapshotMock = function()
     40InspectorTest.createHeapSnapshotMockRaw = function()
    4141{
    4242    return {
     
    6767};
    6868
     69InspectorTest._postprocessHeapSnapshotMock = function(mock)
     70{
     71    mock.metaNode = mock.nodes[0];
     72    mock.nodes[0] = 0;
     73    var tempNodes = new Int32Array(1000);
     74    tempNodes.set(mock.nodes);
     75    mock.nodes = tempNodes.subarray(0, mock.nodes.length);
     76    return mock;
     77};
     78
     79InspectorTest.createHeapSnapshotMock = function()
     80{
     81    return InspectorTest._postprocessHeapSnapshotMock(InspectorTest.createHeapSnapshotMockRaw());
     82};
     83
    6984InspectorTest.createHeapSnapshotMockWithDOM = function()
    7085{
    71     return {
     86    return InspectorTest._postprocessHeapSnapshotMock({
    7287        snapshot: {},
    7388        nodes: [
     
    101116            ],
    102117        strings: ["", "A", "B", "C", "D", "E", "F", "G", "H", "M", "N", "Window", "native"]
    103     };
     118    });
    104119};
    105120
  • trunk/PerformanceTests/inspector/detailed-heapshots-smoke-test.html

    r110421 r110423  
    9090}
    9191
    92 makeObjectsTree2("t", 14);
     92makeObjectsTree2("t", 16);
    9393
    9494</script>
  • trunk/Source/WebCore/ChangeLog

    r110422 r110423  
     12012-03-12  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Re-apply the patch after v8 roll to r11000.
     4
     5        Web Inspector: move heap snapshot nodes data to external array.
     6        https://bugs.webkit.org/show_bug.cgi?id=79911
     7
     8        Reviewed by Vsevolod Vlasov.
     9
     10        Tests:
     11        heap-shapshot.html
     12        heap-shapshot-loader.html
     13
     14        * inspector/front-end/HeapSnapshot.js:
     15        (WebInspector.Int32Array):
     16        (WebInspector.Int32Array.prototype.get array):
     17        (WebInspector.HeapSnapshotLoader.prototype._parseNodes):
     18        (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):
     19        (WebInspector.HeapSnapshot):
     20        (WebInspector.HeapSnapshot.prototype._init):
     21
    1222012-03-12  Simon Hausmann  <simon.hausmann@nokia.com>
    223
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js

    r109660 r110423  
    2929 */
    3030
     31WebInspector.Int32Array = function(size)
     32{
     33    const preallocateSize = 1000;
     34    size = size || preallocateSize;
     35    this._usedSize = 0;
     36    this._array = new Int32Array(preallocateSize);
     37}
     38
     39WebInspector.Int32Array.prototype = {
     40    push: function(value)
     41    {
     42        if (this._usedSize + 1 > this._array.length) {
     43            var tempArray = new Int32Array(this._array.length * 2);
     44            tempArray.set(this._array);
     45            this._array = tempArray;
     46        }
     47        this._array[this._usedSize++] = value;
     48    },
     49
     50    get array()
     51    {
     52        return this._array.subarray(0, this._usedSize);
     53    }
     54}
     55
    3156WebInspector.HeapSnapshotLoader = function()
    3257{
     
    77102                else if (code === closingBracket) {
    78103                    this._json = this._json.slice(index + 1);
    79                     // Shave off provisionally allocated space.
    80                     this._snapshot.nodes = this._snapshot.nodes.slice(0);
     104                    this._snapshot.nodes = this._nodes.array;
    81105                    return false;
    82106                }
     
    98122                return true;
    99123            }
    100             this._snapshot.nodes.push(parseInt(this._json.slice(startIndex, index)));
     124            this._nodes.push(parseInt(this._json.slice(startIndex, index)));
    101125        }
    102126    },
     
    152176            if (closingBracketIndex === -1)
    153177                return;
    154             this._snapshot.nodes = [JSON.parse(this._json.slice(0, closingBracketIndex))];
     178            this._nodes = new WebInspector.Int32Array();
     179            this._nodes.push(0);
     180            this._snapshot.metaNode = JSON.parse(this._json.slice(0, closingBracketIndex));
    155181            this._json = this._json.slice(closingBracketIndex);
    156182            this._state = "parse-nodes";
     
    203229        if (typeof end === "undefined")
    204230            end = start + this._start + this.length;
    205         return this._snapshot[this._arrayName].slice(this._start + start, end);
     231        return this._snapshot[this._arrayName].subarray(this._start + start, end);
    206232    }
    207233}
     
    710736    this.uid = profile.snapshot.uid;
    711737    this._nodes = profile.nodes;
     738    this._metaNode = profile.metaNode;
    712739    this._strings = profile.strings;
    713740
     
    718745    _init: function()
    719746    {
    720         this._metaNodeIndex = 0;
    721747        this._rootNodeIndex = 1;
    722         var meta = this._nodes[this._metaNodeIndex];
     748        var meta = this._metaNode;
    723749        this._nodeTypeOffset = meta.fields.indexOf("type");
    724750        this._nodeNameOffset = meta.fields.indexOf("name");
     
    896922        //  - "indexArray" is an array of indexes in the "backRefsArray"
    897923        //    with the same positions as in the _nodeIndex.
    898         var indexArray = this[indexArrayName] = new Array(this._nodeIndex.length);
     924        var indexArray = this[indexArrayName] = new Int32Array(this._nodeIndex.length);
    899925        for (var i = 0, l = indexArray.length; i < l; ++i)
    900926            indexArray[i] = 0;
     
    905931        for (i = 0, l = indexArray.length; i < l; ++i)
    906932            backRefsCount += indexArray[i];
    907         var backRefsArray = this[backRefsArrayName] = new Array(backRefsCount + 1);
     933        var backRefsArray = this[backRefsArrayName] = new Int32Array(backRefsCount + 1);
    908934        // Put in the first slot of each backRefsArray slice the count of entries
    909935        // that will be filled.
     
    10581084    {
    10591085        var count = this.nodeCount;
    1060         this._nodeIndex = new Array(count + 1);
     1086        this._nodeIndex = new Int32Array(count + 1);
    10611087        count = 0;
    10621088        for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count)
Note: See TracChangeset for help on using the changeset viewer.