Closed Bug 485889 Opened 16 years ago Closed 16 years ago

Incorrect null checking/assignment? (with xpcshell test case)

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: standard8, Assigned: Waldo)

References

Details

(Keywords: regression, testcase, verified1.9.1, Whiteboard: [tb3needs])

Attachments

(3 files)

Attached file xpcshell test case
This is a regression caused by the tracemonkey branch merge here: http://hg.mozilla.org/mozilla-central/pushloghtml?startdate=2009-03-24+10%3A50%3A00&enddate=2009-03-24+10%3A51%3A00 This bug is keeping the Thunderbird trunk tinderboxes orange (bug 485585). We didn't pick it up earlier due to other trunk issues that were hiding the problem. Attaching a reduced test case for the failure. This fails for mozilla-central, but passes on mozilla-1.9.1. The main issue is here: do_check_neq(originator, null); while (originator.parent) { originator = originator.parent; // Adding this line can make it pass // do_check_neq(originator, null); } So we know originator is not null going into the loop, but the test fails with: TEST-UNEXPECTED-FAIL | /Users/moztest/comm/trunk/tb/mozilla/_tests/xpcshell/test_mailnewsglobaldb/unit/test_min_js_failure.js | test failed, see following log: >>>>>>> *** test pending TypeError: originator is null *** FAIL *** WARNING: nsExceptionService ignoring thread destruction after shutdown: file /Users/moztest/comm/trunk/src/mozilla/xpcom/base/nsExceptionService.cpp, line 194 nsStringStats => mAllocCount: 1029 => mReallocCount: 0 => mFreeCount: 1029 => mShareCount: 53 => mAdoptCount: 15 => mAdoptFreeCount: 15 <<<<<<< Uncommenting the do_check_neq line or doing another change as commented in the test file makes the test pass, and hence indicates this is a javascript issue.
Attached file js shell test case
robert-sayres-macbook-pro:bin sayrer$ ./js -f nullcheck.js robert-sayres-macbook-pro:bin sayrer$ ./js -j -f nullcheck.js nullcheck.js:42: TypeError: originator is null
Flags: blocking1.9.1+
Priority: -- → P1
Assignee: general → jwalden+bmo
Status: NEW → ASSIGNED
Attachment #370099 - Flags: review?(gal) → review+
Comment on attachment 370099 [details] [diff] [review] JSVAL_TAG(v) == JSVAL_OBJECT ⇏ !JSVAL_IS_PRIMITIVE(v) >From: Jeff Walden <jwalden@mit.edu> > >Bug 485889 - Incorrect null checking/assignment? (with xpcshell test case). NOT REVIEWED YET > >diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp >--- a/js/src/jstracer.cpp >+++ b/js/src/jstracer.cpp >@@ -5043,10 +5043,12 @@ TraceRecorder::ifop() > bool cond; > LIns* x; > >- /* Objects always evaluate to true since we specialize the Null type on trace. */ >- if (JSVAL_TAG(v) == JSVAL_OBJECT) { >+ if (!JSVAL_IS_PRIMITIVE(v)) { > cond = true; > x = lir->insImm(1); >+ } else if (JSVAL_IS_NULL(v)) { JSVAL_IS_PRIMITIVE(v) is (!JSVAL_IS_OBJECT(v) || JSVAL_IS_NULL(v)), so !JSVAL_IS_PRIMITIVE(v) is (JSVAL_IS_OBJECT(v) && !JSVAL_IS_NULL(v)), so maybe reorder this if-else-if to test JSVAL_IS_NULL before JSVAL_IS_OBJECT? /be
Whiteboard: fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
Target Milestone: --- → mozilla1.9.2a1
Status: RESOLVED → VERIFIED
Whiteboard: fixed-in-tracemonkey
What landed tests !JSVAL_IS_PRIMITIVE in the else-if where leading if tests JSVAL_IS_NULL, which should be optimized to JSVAL_IS_OBJECT -- but maybe it's better to write !JSVAL_IS_PRIMITIVE and preserve order independence here. /be
Today's tracemonkey merge to 1.9.1 [1] has caused bug 485585 to show up on the Thunderbird 3/SeaMonkey 2 tinderboxes which was fixed by this bug. Note that the regression also caused bug 485637 - TM: Gmail contacts list is empty. Therefore can we get this fix landed on 1.9.1 asap please? [1] http://hg.mozilla.org/releases/mozilla-1.9.1/pushloghtml?startdate=2009-04-14+11%3A46%3A00&enddate=2009-04-14+11%3A47%3A00
Whiteboard: [tb3needs]
Verified fixed with given xpshell testcase on trunk and 1.9.1 with the following debug builds: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090422 Minefield/3.6a1pre ID:20090422224452 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090422 Shiretoko/3.5b4pre ID:20090422122043
cvsroot/mozilla/js/tests/js1_8_1/trace/trace-test.js,v <-- trace-test.js new revision: 1.14; previous revision: 1.13 /cvsroot/mozilla/js/tests/shell.js,v <-- shell.js
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: