Give functions gotten from the Function constructor scripted function types.

RESOLVED FIXED in mozilla29

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: shu, Assigned: shu)

Tracking

unspecified
mozilla29
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
We apparently never set the type of Function constructor'd functions to be
scripted function types, meaning they aren't inlined.

This is a result of debugging the slowdown from
http://jsperf.com/function-vs-constructor-vs-eval/19, which bz showed me.
(Assignee)

Comment 1

5 years ago
Created attachment 8358740 [details] [diff] [review]
Give functions gotten from the Function constructor scripted function types.

Is this a regression? I didn't check, maybe we used to do this and somewhere it
got deleted?
Attachment #8358740 - Flags: review?(jdemooij)
Comment on attachment 8358740 [details] [diff] [review]
Give functions gotten from the Function constructor scripted function types.

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

Ugh, nice catch.

::: js/src/jsfun.cpp
@@ +1658,5 @@
>                                                  JSFunction::FinalizeKind, TenuredObject));
>      if (!fun)
>          return false;
>  
> +    if (!JSFunction::setTypeForScriptedFunction(cx, fun, /* singleton = */ false))

Nit: the last argument defaults to false so you could remove it; either way is fine with me.
Attachment #8358740 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/bf8de5ab6d04
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.