Bug 785175: Discard column information if the script is too large instead of aborting. r=jorendorff
authorAlex Crichton <acrichton@mozilla.com>
Fri, 24 Aug 2012 09:47:42 -0700
changeset 103333 f2146a6c104e87e943d08c89b89d1dbac6f544f9
parent 103332 6a6f205e757045642d6a9a020db56fcf942275fd
child 103336 35431a5588e0186b2a176d51927f9962d47e0044
push id13945
push userryanvm@gmail.com
push dateFri, 24 Aug 2012 20:18:14 +0000
treeherdermozilla-inbound@b3c861bd1e2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs785175
milestone17.0a1
first release with
nightly linux32
f2146a6c104e / 17.0a1 / 20120824101755 / files
nightly linux64
f2146a6c104e / 17.0a1 / 20120824101755 / files
nightly mac
f2146a6c104e / 17.0a1 / 20120824101755 / files
nightly win32
f2146a6c104e / 17.0a1 / 20120824101755 / files
nightly win64
f2146a6c104e / 17.0a1 / 20120824101755 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 785175: Discard column information if the script is too large instead of aborting. r=jorendorff
js/src/frontend/BytecodeEmitter.cpp
js/src/jit-test/tests/basic/bug785175.js
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -426,18 +426,22 @@ UpdateSourceCoordNotes(JSContext *cx, By
         return false;
 
     ptrdiff_t colspan = ptrdiff_t(pos.index) -
                         ptrdiff_t(bce->current->lastColumn);
     if (colspan != 0) {
         if (colspan < 0) {
             colspan += SN_COLSPAN_DOMAIN;
         } else if (colspan >= SN_COLSPAN_DOMAIN / 2) {
-            ReportStatementTooLarge(cx, bce->topStmt);
-            return false;
+            // If the column span is so large that we can't store it, then just
+            // discard this information because column information would most
+            // likely be useless anyway once the column numbers are ~4000000.
+            // This has been known to happen with scripts that have been
+            // minimized and put into all one line.
+            return true;
         }
         if (NewSrcNote2(cx, bce, SRC_COLSPAN, colspan) < 0)
             return false;
         bce->current->lastColumn = pos.index;
     }
     return true;
 }
 
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug785175.js
@@ -0,0 +1,9 @@
+var str = ' ';
+// Generate a 4MB string = 2^(20+2)
+for (var i = 0; i < 22; i++) {
+    str = str + str;
+}
+str += 'var a = 1 + 1;';
+
+// don't throw an exception even though the column numbers cannot be maintained
+eval(str);