Changeset 109343 in webkit
- Timestamp:
- Mar 1, 2012 6:15:24 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109342 r109343 1 2012-03-01 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: move heap snapshot nodes data to external array. 4 https://bugs.webkit.org/show_bug.cgi?id=79911 5 6 Reviewed by Vsevolod Vlasov. 7 8 * inspector/profiler/heap-snapshot-loader.html: 9 * inspector/profiler/heap-snapshot-test.js: 10 (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockRaw): 11 (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMock): 12 (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM): 13 1 14 2012-03-01 Nikolas Zimmermann <nzimmermann@rim.com> 2 15 -
trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html
r85182 r109343 15 15 function heapSnapshotLoaderTest(next) 16 16 { 17 var source = InspectorTest.createHeapSnapshotMock ();17 var source = InspectorTest.createHeapSnapshotMockRaw(); 18 18 var sourceStringified = JSON.stringify(source); 19 19 var partSize = sourceStringified.length >> 3; … … 22 22 loader.pushJSONChunk(sourceStringified.slice(i, i + partSize)); 23 23 var result = loader.finishLoading(); 24 InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot( source), result);24 InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock()), result); 25 25 next(); 26 26 } -
trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js
r108729 r109343 38 38 }; 39 39 40 InspectorTest.createHeapSnapshotMock = function()40 InspectorTest.createHeapSnapshotMockRaw = function() 41 41 { 42 42 return { … … 67 67 }; 68 68 69 InspectorTest._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 79 InspectorTest.createHeapSnapshotMock = function() 80 { 81 return InspectorTest._postprocessHeapSnapshotMock(InspectorTest.createHeapSnapshotMockRaw()); 82 }; 83 69 84 InspectorTest.createHeapSnapshotMockWithDOM = function() 70 85 { 71 return {86 return InspectorTest._postprocessHeapSnapshotMock({ 72 87 snapshot: {}, 73 88 nodes: [ … … 101 116 ], 102 117 strings: ["", "A", "B", "C", "D", "E", "F", "G", "H", "M", "N", "Window", "native"] 103 } ;118 }); 104 119 }; 105 120 -
trunk/Source/WebCore/ChangeLog
r109342 r109343 1 2012-03-01 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: move heap snapshot nodes data to external array. 4 https://bugs.webkit.org/show_bug.cgi?id=79911 5 6 Reviewed by Vsevolod Vlasov. 7 8 Tests: 9 heap-shapshot.html 10 heap-shapshot-loader.html 11 12 * inspector/front-end/HeapSnapshot.js: 13 (WebInspector.Int32Array): 14 (WebInspector.Int32Array.prototype.get array): 15 (WebInspector.HeapSnapshotLoader.prototype._parseNodes): 16 (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk): 17 (WebInspector.HeapSnapshot): 18 (WebInspector.HeapSnapshot.prototype._init): 19 1 20 2012-03-01 Nikolas Zimmermann <nzimmermann@rim.com> 2 21 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js
r108729 r109343 29 29 */ 30 30 31 WebInspector.Int32Array = function() 32 { 33 const preallocateSize = 1000; 34 this._usedSize = 0; 35 this._array = new Int32Array(preallocateSize); 36 } 37 38 WebInspector.Int32Array.prototype = { 39 push: function(value) 40 { 41 if (this._usedSize + 1 > this._array.length) { 42 var tempArray = new Int32Array(this._array.length * 2); 43 tempArray.set(this._array); 44 this._array = tempArray; 45 } 46 this._array[this._usedSize++] = value; 47 }, 48 49 get array() 50 { 51 return this._array.subarray(0, this._usedSize); 52 } 53 } 54 31 55 WebInspector.HeapSnapshotLoader = function() 32 56 { … … 77 101 else if (code === closingBracket) { 78 102 this._json = this._json.slice(index + 1); 79 // Shave off provisionally allocated space. 80 this._snapshot.nodes = this._snapshot.nodes.slice(0); 103 this._snapshot.nodes = this._nodes.array; 81 104 return false; 82 105 } … … 98 121 return true; 99 122 } 100 this._ snapshot.nodes.push(parseInt(this._json.slice(startIndex, index)));123 this._nodes.push(parseInt(this._json.slice(startIndex, index))); 101 124 } 102 125 }, … … 152 175 if (closingBracketIndex === -1) 153 176 return; 154 this._snapshot.nodes = [JSON.parse(this._json.slice(0, closingBracketIndex))]; 177 this._nodes = new WebInspector.Int32Array(); 178 this._nodes.push(0); 179 this._snapshot.metaNode = JSON.parse(this._json.slice(0, closingBracketIndex)); 155 180 this._json = this._json.slice(closingBracketIndex); 156 181 this._state = "parse-nodes"; … … 710 735 this.uid = profile.snapshot.uid; 711 736 this._nodes = profile.nodes; 737 this._metaNode = profile.metaNode; 712 738 this._strings = profile.strings; 713 739 … … 718 744 _init: function() 719 745 { 720 this._metaNodeIndex = 0;721 746 this._rootNodeIndex = 1; 722 var meta = this._ nodes[this._metaNodeIndex];747 var meta = this._metaNode; 723 748 this._nodeTypeOffset = meta.fields.indexOf("type"); 724 749 this._nodeNameOffset = meta.fields.indexOf("name");
Note: See TracChangeset
for help on using the changeset viewer.