+2012-03-12 Ilya Tikhonovsky <loislo@chromium.org>
+
+ 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.
+
+ * inspector/profiler/heap-snapshot-loader.html:
+ * inspector/profiler/heap-snapshot-test.js:
+ (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockRaw):
+ (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMock):
+ (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotMockWithDOM):
+
2012-03-12 Hans Wennborg <hans@chromium.org>
Speech JavaScript API: SpeechRecognitionEvent
InspectorTest.runTestSuite([
function heapSnapshotLoaderTest(next)
{
- var source = InspectorTest.createHeapSnapshotMock();
+ var source = InspectorTest.createHeapSnapshotMockRaw();
var sourceStringified = JSON.stringify(source);
var partSize = sourceStringified.length >> 3;
var loader = new WebInspector.HeapSnapshotLoader();
for (var i = 0, l = sourceStringified.length; i < l; i += partSize)
loader.pushJSONChunk(sourceStringified.slice(i, i + partSize));
var result = loader.finishLoading();
- InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot(source), result);
+ InspectorTest.assertSnapshotEquals(new WebInspector.HeapSnapshot(InspectorTest.createHeapSnapshotMock()), result);
next();
}
]);
};
};
-InspectorTest.createHeapSnapshotMock = function()
+InspectorTest.createHeapSnapshotMockRaw = function()
{
return {
snapshot: {},
};
};
+InspectorTest._postprocessHeapSnapshotMock = function(mock)
+{
+ mock.metaNode = mock.nodes[0];
+ mock.nodes[0] = 0;
+ var tempNodes = new Int32Array(1000);
+ tempNodes.set(mock.nodes);
+ mock.nodes = tempNodes.subarray(0, mock.nodes.length);
+ return mock;
+};
+
+InspectorTest.createHeapSnapshotMock = function()
+{
+ return InspectorTest._postprocessHeapSnapshotMock(InspectorTest.createHeapSnapshotMockRaw());
+};
+
InspectorTest.createHeapSnapshotMockWithDOM = function()
{
- return {
+ return InspectorTest._postprocessHeapSnapshotMock({
snapshot: {},
nodes: [
{ fields: ["type", "name", "id", "children_count", "children"],
/* M */ 1, 9, 13, 0
],
strings: ["", "A", "B", "C", "D", "E", "F", "G", "H", "M", "N", "Window", "native"]
- };
+ });
};
};
+2012-03-12 Ilya Tikhonovsky <loislo@chromium.org>
+
+ 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.
+
+ 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):
+
2012-03-12 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] Fix build with newer Qt 5.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+WebInspector.Int32Array = function(size)
+{
+ const preallocateSize = 1000;
+ size = size || preallocateSize;
+ this._usedSize = 0;
+ this._array = new Int32Array(preallocateSize);
+}
+
+WebInspector.Int32Array.prototype = {
+ push: function(value)
+ {
+ if (this._usedSize + 1 > this._array.length) {
+ var tempArray = new Int32Array(this._array.length * 2);
+ tempArray.set(this._array);
+ this._array = tempArray;
+ }
+ this._array[this._usedSize++] = value;
+ },
+
+ get array()
+ {
+ return this._array.subarray(0, this._usedSize);
+ }
+}
+
WebInspector.HeapSnapshotLoader = function()
{
this._json = "";
break;
else if (code === closingBracket) {
this._json = this._json.slice(index + 1);
- // Shave off provisionally allocated space.
- this._snapshot.nodes = this._snapshot.nodes.slice(0);
+ this._snapshot.nodes = this._nodes.array;
return false;
}
++index;
this._json = this._json.slice(startIndex);
return true;
}
- this._snapshot.nodes.push(parseInt(this._json.slice(startIndex, index)));
+ this._nodes.push(parseInt(this._json.slice(startIndex, index)));
}
},
var closingBracketIndex = this._findBalancedCurlyBrackets();
if (closingBracketIndex === -1)
return;
- this._snapshot.nodes = [JSON.parse(this._json.slice(0, closingBracketIndex))];
+ this._nodes = new WebInspector.Int32Array();
+ this._nodes.push(0);
+ this._snapshot.metaNode = JSON.parse(this._json.slice(0, closingBracketIndex));
this._json = this._json.slice(closingBracketIndex);
this._state = "parse-nodes";
this.pushJSONChunk("");
{
if (typeof end === "undefined")
end = start + this._start + this.length;
- return this._snapshot[this._arrayName].slice(this._start + start, end);
+ return this._snapshot[this._arrayName].subarray(this._start + start, end);
}
}
{
this.uid = profile.snapshot.uid;
this._nodes = profile.nodes;
+ this._metaNode = profile.metaNode;
this._strings = profile.strings;
this._init();
WebInspector.HeapSnapshot.prototype = {
_init: function()
{
- this._metaNodeIndex = 0;
this._rootNodeIndex = 1;
- var meta = this._nodes[this._metaNodeIndex];
+ var meta = this._metaNode;
this._nodeTypeOffset = meta.fields.indexOf("type");
this._nodeNameOffset = meta.fields.indexOf("name");
this._nodeIdOffset = meta.fields.indexOf("id");
// interval (can be empty) with corresponding back references.
// - "indexArray" is an array of indexes in the "backRefsArray"
// with the same positions as in the _nodeIndex.
- var indexArray = this[indexArrayName] = new Array(this._nodeIndex.length);
+ var indexArray = this[indexArrayName] = new Int32Array(this._nodeIndex.length);
for (var i = 0, l = indexArray.length; i < l; ++i)
indexArray[i] = 0;
for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next()) {
var backRefsCount = 0;
for (i = 0, l = indexArray.length; i < l; ++i)
backRefsCount += indexArray[i];
- var backRefsArray = this[backRefsArrayName] = new Array(backRefsCount + 1);
+ var backRefsArray = this[backRefsArrayName] = new Int32Array(backRefsCount + 1);
// Put in the first slot of each backRefsArray slice the count of entries
// that will be filled.
var backRefsPosition = 0;
_buildNodeIndex: function()
{
var count = this.nodeCount;
- this._nodeIndex = new Array(count + 1);
+ this._nodeIndex = new Int32Array(count + 1);
count = 0;
for (var nodesIter = this._allNodes; nodesIter.hasNext(); nodesIter.next(), ++count)
this._nodeIndex[count] = nodesIter.index;