Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Unified Diff: src/messages.js

Issue 1033973002: Reland [V8] Removed SourceLocationRestrict (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/debug-sourceinfo.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 672fd4b8100fa26b499d983ab0d06a379d435793..95110bb95e2c82b5f4802190f17de5968dc56826 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -353,7 +353,6 @@ function GetSourceLine(message) {
var start_position = %MessageGetStartPosition(message);
var location = script.locationFromPosition(start_position, true);
if (location == null) return "";
- location.restrict();
return location.sourceText();
}
@@ -654,57 +653,6 @@ function SourceLocation(script, position, line, column, start, end) {
this.end = end;
}
-var kLineLengthLimit = 78;
-
-/**
- * Restrict source location start and end positions to make the source slice
- * no more that a certain number of characters wide.
- * @param {number} opt_limit The with limit of the source text with a default
- * of 78
- * @param {number} opt_before The number of characters to prefer before the
- * position with a default value of 10 less that the limit
- */
-function SourceLocationRestrict(opt_limit, opt_before) {
- // Find the actual limit to use.
- var limit;
- var before;
- if (!IS_UNDEFINED(opt_limit)) {
- limit = opt_limit;
- } else {
- limit = kLineLengthLimit;
- }
- if (!IS_UNDEFINED(opt_before)) {
- before = opt_before;
- } else {
- // If no before is specified center for small limits and perfer more source
- // before the the position that after for longer limits.
- if (limit <= 20) {
- before = $floor(limit / 2);
- } else {
- before = limit - 10;
- }
- }
- if (before >= limit) {
- before = limit - 1;
- }
-
- // If the [start, end[ interval is too big we restrict
- // it in one or both ends. We make sure to always produce
- // restricted intervals of maximum allowed size.
- if (this.end - this.start > limit) {
- var start_limit = this.position - before;
- var end_limit = this.position + limit - before;
- if (this.start < start_limit && end_limit < this.end) {
- this.start = start_limit;
- this.end = end_limit;
- } else if (this.start < start_limit) {
- this.start = this.end - limit;
- } else {
- this.end = this.start + limit;
- }
- }
-}
-
/**
* Get the source text for a SourceLocation
@@ -722,7 +670,6 @@ function SourceLocationSourceText() {
SetUpLockedPrototype(SourceLocation,
$Array("script", "position", "line", "column", "start", "end"),
$Array(
- "restrict", SourceLocationRestrict,
"sourceText", SourceLocationSourceText
)
);
@@ -779,7 +726,6 @@ function GetPositionInLine(message) {
var start_position = %MessageGetStartPosition(message);
var location = script.locationFromPosition(start_position, false);
if (location == null) return -1;
- location.restrict();
return start_position - location.start;
}
« no previous file with comments | « no previous file | test/mjsunit/debug-sourceinfo.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698