Closed Bug 853075 Opened 11 years ago Closed 11 years ago

Self-hosted code can't call methods that are listed after first self-hosted function in method array

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: mozillabugs, Assigned: till)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Self-hosted code can't call methods that are listed after the first self-hosted function in the containing class's method array.

In the attached test case patch, testCallFilter calls Array.prototype.filter. filter is listed in array_methods after several self-hosted functions, lastIndexOf to reduceRight. Output from the js shell with this patch applied:

js> print([].testCallFilter)
function testCallFilter() {
    [native code]
}
js> print([].testCallFilter())
typein:2:0 TypeError: undefined is not a function

After moving the entry for filter in array_methods to above lastIndexOf and rebuilding, you get the desired output:

js> print([].testCallFilter)
function testCallFilter() {
    [native code]
}
js> print([].testCallFilter())
hello world!
The patches in bug 769871 add workarounds for this bug to the method arrays in jsstr.cpp, jsnum.cpp, and jsdate.cpp. The files should be cleaned up when this bug is fixed.
Blocks: 784288
Well, this is embarrassing. Stopping the definition of a builtin's methods upon encountering the first self-hosted one might not actually be a good move. Not even during initialization of the self-hosting global ...

r=jonco via IRC
Assignee: general → tschneidereit
Attachment #730151 - Flags: review+
Attachment #730179 - Flags: review?(tschneidereit)
Attachment #730179 - Flags: checkin?(tschneidereit)
Comment on attachment 730179 [details] [diff] [review]
Remove workarounds

Review of attachment 730179 [details] [diff] [review]:
-----------------------------------------------------------------

https://hg.mozilla.org/integration/mozilla-inbound/rev/d1de74b4a773
Attachment #730179 - Flags: review?(tschneidereit)
Attachment #730179 - Flags: review+
Attachment #730179 - Flags: checkin?(tschneidereit)
Attachment #730179 - Flags: checkin+
https://hg.mozilla.org/mozilla-central/rev/a49b82d16504
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: