Closed Bug 636364 Opened 13 years ago Closed 13 years ago

Followup fixes and tests in wake of global |this| binding change (shell failure on js1_8_5/regress/regress-555246-1.js)

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla2.0
Tracking Status
blocking2.0 --- final+

People

(Reporter: dmandelin, Assigned: brendan)

References

Details

(Keywords: regression, Whiteboard: fixed-in-tracemonkey hardblocker [has patch])

Attachments

(2 files, 2 obsolete files)

Bisected to:

changeset:   62529:4e085ba15d4c
user:        Andreas Gal <gal@mozilla.com>
date:        Thu Feb 17 17:52:55 2011 -0800
summary:     Unqualified function invocation doesn't use the global object the property was gotten from as |this| (bug 634590, r=brendan).

It might be a bug in the test case. It doesn't look like the most important test ever, but we should get back to no failures on tip one way or another.
Brendan, looks like you granted review on tests which explicitly required the behavior we had before bug 634590:

http://hg.mozilla.org/tracemonkey/rev/e4364736e170

It looks like the test expects the global for the function being called, when it has to compute this.
Yes, I like the ES5 semantics. A "use strict"; appeared before my eyes as I read function f.

Will fix and add a test for the strict-mode case (which we botch same-compartment currently as Luke pointed out!).

/be
Assignee: general → brendan
Status: NEW → ASSIGNED
Summary: Regression: shell failure on jstest js1_8_5\regress\regress-555246-1.js → Regression: shell failure on jstest js1_8_5/regress/regress-555246-1.js
This is more than a test that needs tweaking. It is a required followup to fix problems not fully fixed for bug 634590, with yet more tests.

Tests are good.

/be
blocking2.0: --- → ?
Keywords: regression
Summary: Regression: shell failure on jstest js1_8_5/regress/regress-555246-1.js → Followup fixes and tests in wake of global |this| binding change (shell failure on js1_8_5/regress/regress-555246-1.js)
Attached patch proposed fix with tests (obsolete) — Splinter Review
Attachment #514714 - Flags: review?(gal)
Attached patch diff -w version of patch (obsolete) — Splinter Review
David, could you please review the methodjit changes? Thanks,

/be
Attachment #514715 - Flags: review?(dvander)
Attachment #514715 - Attachment is patch: true
Attachment #514715 - Attachment mime type: application/octet-stream → text/plain
Priority: -- → P1
Target Milestone: --- → mozilla2.0
blocking2.0: ? → final+
Whiteboard: hardblocker
Attachment #514715 - Flags: review?(dvander) → review+
Thanks to Waldo for the newGlobal shell code. Its name goes against the more Unix-command-like lowercase names of shell functions, though. Any objection to my changing it to newglobal?

/be
Comment on attachment 514714 [details] [diff] [review]
proposed fix with tests

newGlobal or newglobal both seem ok based on previous examples, really up to you
Attachment #514714 - Flags: review?(gal) → review+
(In reply to comment #6)
> Its name goes against the more
> Unix-command-like lowercase names of shell functions, though. Any objection to
> my changing it to newglobal?

To be really Unix-y, shouldn't you shave off a couple of characters off the end of 'global' too ;-)

>+        if (!rval.isObject() ||
>+            (thisp->isGlobal()
>+             ? IsSafeForLazyThisCoercion(cx, &rval.toObject())
>+             : IsCacheableNonGlobalScope(thisp))) {
>+            thisv.setUndefined();

This expression took me a long time to understand, and now there are two copies of it.  What do you think about:
 1. Share/reuse ComputeThis
 2. Break the compound expression into separate statements, with comments (in particular, seeing "Cacheable" mentioned is initially confusing)
 3. Kill the separate IsSafeForLazyThisCoercion predicate (whose name only half tells the story of what it does) and roll it into ComputeThis so that it can be explained in context
(In reply to comment #8)
> (In reply to comment #6)
> > Its name goes against the more
> > Unix-command-like lowercase names of shell functions, though. Any objection to
> > my changing it to newglobal?
> 
> To be really Unix-y, shouldn't you shave off a couple of characters off the end
> of 'global' too ;-)

Nah. Remember, ken admitted he should have spelled it "create". Plus, "glob" means shell wildcard in Unixese.

> >+        if (!rval.isObject() ||
> >+            (thisp->isGlobal()
> >+             ? IsSafeForLazyThisCoercion(cx, &rval.toObject())
> >+             : IsCacheableNonGlobalScope(thisp))) {
> >+            thisv.setUndefined();
> 
> This expression took me a long time to understand, and now there are two copies
> of it.

In the fine spirt of methodjit/StubCalls.cpp :-/.

> What do you think about:
>  1. Share/reuse ComputeThis

Can do.

>  2. Break the compound expression into separate statements, with comments (in
> particular, seeing "Cacheable" mentioned is initially confusing)

I was trying to minimize change at this point, but ok.

>  3. Kill the separate IsSafeForLazyThisCoercion predicate (whose name only half
> tells the story of what it does) and roll it into ComputeThis so that it can be
> explained in context

Don't want too many thisv.setUndefined() calls. I will do my best, stay tuned.

/be
(In reply to comment #6)
> Its name goes against the more Unix-command-like lowercase names of shell
> functions, though.

I wrote it, do I get a vote?  :-)

I'm seeing an awful lot of camelCaps in the current listings (dateNow, revertVersion, assertEq, dumpHeap, evalInFrame, etc.).  It seems to be the direction most changes have gone recently (without checking, mjitstats looks like the only outlier).  Unix getslx/getpda/putstr/cvtargs trsnss is but the learner now, camelCaps is the master.
Whiteboard: hardblocker → hardblocker [has patch]
Luke: need your review, this is based on your good requests. gal and I have clearly collapsed into a slightly corrupt peer review clique.

Waldo: I left newGlobal spelled that way, no big.

/be
Attachment #514714 - Attachment is obsolete: true
Attachment #514821 - Flags: review?(lw)
Carry over dvander's r+ on methodjit changes.

/be
Attachment #514715 - Attachment is obsolete: true
Attachment #514823 - Flags: review+
Comment on attachment 514821 [details] [diff] [review]
luke made me use the force

Righteous comments and renamings; much appreciated.
Attachment #514821 - Flags: review?(lw) → review+
http://hg.mozilla.org/tracemonkey/rev/6e2ee1f3f6c6

/be
Whiteboard: hardblocker [has patch] → fixed-in-tracemonkey hardblocker [has patch]
This brought back the same thing we had over the weekend, massive make check failures on OS X 10.6 and total failure on OS X 10.5. Tree's closed as a result.
I pushed a hotfix that tries to force no inlining on mac. We will see if this works.

http://hg.mozilla.org/tracemonkey/rev/199117e5cbd5
Like a charm, tree's reopened.
Fach Apple's gcc fork.

/be
http://hg.mozilla.org/mozilla-central/rev/6e2ee1f3f6c6
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 652375
Blocks: 671947
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: