Closed Bug 958797 Opened 10 years ago Closed 10 years ago

Give functions gotten from the Function constructor scripted function types.

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: shu, Assigned: shu)

Details

Attachments

(1 file)

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.
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
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: