Last Comment Bug 762421 - IonMonkey: Implement Name ICs
: IonMonkey: Implement Name ICs
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All Windows 2000
: -- normal (vote)
: ---
Assigned To: David Anderson [:dvander]
:
Mentors:
Depends on: 761685
Blocks: IonSpeed
  Show dependency treegraph
 
Reported: 2012-06-07 03:22 PDT by David Anderson [:dvander]
Modified: 2012-06-14 12:23 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
WIP v0 (36.89 KB, patch)
2012-06-07 19:10 PDT, David Anderson [:dvander]
no flags Details | Diff | Splinter Review
a patch (37.96 KB, patch)
2012-06-11 17:50 PDT, David Anderson [:dvander]
jdemooij: review+
Details | Diff | Splinter Review

Description David Anderson [:dvander] 2012-06-07 03:22:46 PDT
Though we have the fancy new ALIASEDVAR opcodes, they don't reach across function boundaries yet. Name ICs will let us optimize these accesses (and others) until the front-end is changed. When that happens (bug 753158), most of the really hot NAME ops will become ALIASEDVAR, but the name ICs will still be useful for eval-poisoned scopes.

This bug will should get us most of the way there for JSOP_NAME; bug 753158 will be an additional win since the steps emitted by the ICs will instead be inlined as MIR.
Comment 1 David Anderson [:dvander] 2012-06-07 19:10:31 PDT
Created attachment 631246 [details] [diff] [review]
WIP v0

Benchmark: 
var f = function (x, y) {
    return (function () {
        var t;
        for (var i = 0; i < 10000000; i++)
            t = y;
        return t;
    })();
}

Goes from 1054ms to 27ms. Yay!

Otherwise untested, test tomorrow.
Comment 2 David Anderson [:dvander] 2012-06-11 17:50:43 PDT
Created attachment 632090 [details] [diff] [review]
a patch
Comment 3 Jan de Mooij [:jandem] 2012-06-12 07:27:17 PDT
Comment on attachment 632090 [details] [diff] [review]
a patch

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

Looks good, r=me with comments addressed.

::: js/src/ion/IonCaches.cpp
@@ +1107,5 @@
> +        if (!IsCacheableNonGlobalScope(obj2))
> +            return false;
> +
> +        // Stop once we hit the global or target obj.
> +        if (obj2->isGlobal() || obj2 == obj)

IsCacheableNonGlobalScope will return |false| if obj2->isGlobal(). Do we need something like "&& !obj2->isGlobal()" there to allow global properties?

It would be good if we could somehow call IsCacheableScopeChain here if possible.

@@ +1138,5 @@
> +
> +    if (cache.stubCount() < MAX_STUBS &&
> +        IsCachableName(cx, scopeChain, obj, holder, prop))
> +    {
> +        if (!cache.attach(cx, scopeChain, obj, (Shape *)prop))

A cache.incrementStubCount(); here to avoid adding too many stubs.
Comment 4 David Anderson [:dvander] 2012-06-14 12:23:53 PDT
https://hg.mozilla.org/projects/ionmonkey/rev/6dd068259832

Note You need to log in before you can comment on or make changes to this bug.