Last Comment Bug 706110 - JS Correctness: Different output with options "-m -n" vs. "-m -n -a"
: JS Correctness: Different output with options "-m -n" vs. "-m -n -a"
: regression, testcase
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86_64 Linux
-- critical (vote)
: mozilla11
Assigned To: Brian Hackett (:bhackett)
: Jason Orendorff [:jorendorff]
: 698101 (view as bug list)
Depends on:
Blocks: langfuzz
  Show dependency treegraph
Reported: 2011-11-29 07:30 PST by Christian Holler (:decoder)
Modified: 2011-11-30 03:54 PST (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (1.17 KB, patch)
2011-11-29 10:34 PST, Brian Hackett (:bhackett)
wmccloskey: review+
Details | Diff | Splinter Review

Description User image Christian Holler (:decoder) 2011-11-29 07:30:30 PST
The following test produces different output with options "-m -n" vs. "-m -n -a" on mozilla-central revision e320f9f5536f:

function reportFailure (msg) {
  var lines = msg.split ("\n");
  var funcName = currentFunc();
  var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
  for (var i=0; i<lines.length; i++)
    print (" FAILED! " + prefix + lines[i]);
function reportCompare (expected, actual, description) {
  var output = "";
  if (expected != actual)
      reportFailure (description + " : " + output);
function currentFunc() {}
var summary = (2);
var expect = '';
function test() {
  var prototype;
  function Bug() {
  actual = (new Bug instanceof Bug);
  reportCompare(expect, actual, summary);

The number of outputted lines differs depending on the options (where $JS is just the javascript shell binary):

$ $JS -m -n min.js
 FAILED! 2 : 
 FAILED! 2 : 
$ $JS -m -n -a min.js
 FAILED! 2 :
Comment 1 User image Brian Hackett (:bhackett) 2011-11-29 10:34:08 PST
Created attachment 577665 [details] [diff] [review]

Bill, I remember you reporting this a while ago but can't find the bug.  Construction of 'this' can't be inlined for non-singletons because the resolve hook of the callee may get skipped (which constructs the default prototype objects for functions).
Comment 2 User image Bill McCloskey (:billm) 2011-11-29 11:41:49 PST
Comment on attachment 577665 [details] [diff] [review]

Cool, thanks. It was bug 698101. Could you make sure the patch works on that test case?

Also, we're now trying to put the brace on a separate line for multi-line conditionals like this one. It creates a clearer separation between the condition and the code.
Comment 3 User image Brian Hackett (:bhackett) 2011-11-29 12:42:48 PST
*** Bug 698101 has been marked as a duplicate of this bug. ***
Comment 4 User image Brian Hackett (:bhackett) 2011-11-29 13:28:00 PST
Comment 5 User image Marco Bonardo [::mak] 2011-11-30 03:54:21 PST

Note You need to log in before you can comment on or make changes to this bug.