Title: [112381] trunk/Source/WebCore
- Revision
- 112381
- Author
- [email protected]
- Date
- 2012-03-28 03:10:14 -0700 (Wed, 28 Mar 2012)
Log Message
Web Inspector: REGRESSION: Stack overflow on the page with > 100kloc
https://bugs.webkit.org/show_bug.cgi?id=82436
Reviewed by Yury Semikhatsky.
This change migrates to manual splice implementation that uses additional
information about the range being inserted to make it work faster / allocate
less memory.
* inspector/front-end/TextEditorModel.js:
(WebInspector.TextEditorModel.endsWithBracketRegex.):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112380 => 112381)
--- trunk/Source/WebCore/ChangeLog 2012-03-28 10:09:34 UTC (rev 112380)
+++ trunk/Source/WebCore/ChangeLog 2012-03-28 10:10:14 UTC (rev 112381)
@@ -1,3 +1,17 @@
+2012-03-28 Pavel Feldman <[email protected]>
+
+ Web Inspector: REGRESSION: Stack overflow on the page with > 100kloc
+ https://bugs.webkit.org/show_bug.cgi?id=82436
+
+ Reviewed by Yury Semikhatsky.
+
+ This change migrates to manual splice implementation that uses additional
+ information about the range being inserted to make it work faster / allocate
+ less memory.
+
+ * inspector/front-end/TextEditorModel.js:
+ (WebInspector.TextEditorModel.endsWithBracketRegex.):
+
2012-03-28 Pavel Podivilov <[email protected]>
Web Inspector: breakpoints are not shown in sidebar pane after reload.
Modified: trunk/Source/WebCore/inspector/front-end/TextEditorModel.js (112380 => 112381)
--- trunk/Source/WebCore/inspector/front-end/TextEditorModel.js 2012-03-28 10:09:34 UTC (rev 112380)
+++ trunk/Source/WebCore/inspector/front-end/TextEditorModel.js 2012-03-28 10:10:14 UTC (rev 112381)
@@ -160,15 +160,7 @@
postCaret += newLines[0].length;
} else {
this._setLine(range.startLine, prefix + newLines[0]);
-
- for (var i = 1; i < newLines.length; ++i)
- this._lines.splice(range.startLine + i, 0, newLines[i]);
- // Adjust attributes, attributes move with the first character of line.
- var spliceParameters = new Array(newLines.length + 1); // 2 + number of items to insert.
- spliceParameters[0] = range.startColumn ? range.startLine + 1 : range.startLine;
- spliceParameters[1] = 0;
- this._attributes.splice.apply(this._attributes, spliceParameters);
-
+ this._insertLines(range, newLines);
this._setLine(range.startLine + newLines.length - 1, newLines[newLines.length - 1] + suffix);
postCaret = newLines[newLines.length - 1].length;
}
@@ -177,6 +169,28 @@
range.startLine + newLines.length - 1, postCaret);
},
+ _insertLines: function(range, newLines)
+ {
+ var lines = new Array(this._lines.length + newLines.length - 1);
+ for (var i = 0; i <= range.startLine; ++i)
+ lines[i] = this._lines[i];
+ // Line at [0] is already set via setLine.
+ for (var i = 1; i < newLines.length; ++i)
+ lines[range.startLine + i] = newLines[i];
+ for (var i = range.startLine + newLines.length; i < lines.length; ++i)
+ lines[i] = this._lines[i - newLines.length + 1];
+ this._lines = lines;
+
+ // Adjust attributes, attributes move with the first character of line.
+ var attributes = new Array(lines.length);
+ var insertionIndex = range.startColumn ? range.startLine + 1 : range.startLine;
+ for (var i = 0; i < insertionIndex; ++i)
+ attributes[i] = this._attributes[i];
+ for (var i = insertionIndex + newLines.length - 1; i < attributes.length; ++i)
+ attributes[i] = this._attributes[i - newLines.length + 1];
+ this._attributes = attributes;
+ },
+
_eraseRange: function(range)
{
if (range.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes