Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Issue 335683002: Optimize Function.prototype.call (Closed)

Created:
6 years, 6 months ago by p.antonov
Modified:
6 years, 6 months ago
Reviewers:
rossberg, Toon Verwaest
CC:
v8-dev
Base URL:
https://github.com/v8/v8.git@master
Visibility:
Public.

Description

Optimize Function.prototype.call - May inline the function, or call it directly, instead of going through call - Supports arguments object escaping when it escapes to builtins (preparation for slice.call(arguments, ...) optimization) - Both .call and .apply now support inlining when calling builtins indirectly BUG= R=verwaest@chromium.org, rossberg@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=21840

Patch Set 1 #

Total comments: 18

Patch Set 2 : Address comments #

Total comments: 4

Patch Set 3 : Assert that functions are called #

Patch Set 4 : Call the correct functions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+306 lines, -47 lines) Patch
M src/hydrogen.h View 1 2 chunks +13 lines, -7 lines 0 comments Download
M src/hydrogen.cc View 1 9 chunks +113 lines, -40 lines 0 comments Download
M src/objects.h View 1 chunk +1 line, -0 lines 0 comments Download
A test/mjsunit/compiler/inlined-call.js View 1 2 3 1 chunk +179 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
p.antonov
6 years, 6 months ago (2014-06-12 16:11:59 UTC) #1
Toon Verwaest
I like this CL much better! Apart from some structural comments, I'm not sure about ...
6 years, 6 months ago (2014-06-12 21:41:14 UTC) #2
p.antonov
https://codereview.chromium.org/335683002/diff/1/src/hydrogen.cc File src/hydrogen.cc (right): https://codereview.chromium.org/335683002/diff/1/src/hydrogen.cc#newcode7978 src/hydrogen.cc:7978: bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( On 2014/06/12 21:41:13, Toon Verwaest wrote: > ...
6 years, 6 months ago (2014-06-13 08:34:24 UTC) #3
p.antonov
For handling arguments, I think we need some way to signal that a builtin can ...
6 years, 6 months ago (2014-06-13 08:36:22 UTC) #4
Toon Verwaest
Nice, lgtm with some last comments regarding the tests. If you address those, I'll land. ...
6 years, 6 months ago (2014-06-13 12:03:41 UTC) #5
p.antonov
https://codereview.chromium.org/335683002/diff/20001/test/mjsunit/compiler/inlined-call.js File test/mjsunit/compiler/inlined-call.js (right): https://codereview.chromium.org/335683002/diff/20001/test/mjsunit/compiler/inlined-call.js#newcode94 test/mjsunit/compiler/inlined-call.js:94: assertEquals(void 0, funStrictRecv); On 2014/06/13 12:03:41, Toon Verwaest wrote: ...
6 years, 6 months ago (2014-06-13 12:12:35 UTC) #6
Toon Verwaest
Committed patchset #4 manually as r21840 (presubmit successful).
6 years, 6 months ago (2014-06-13 12:52:38 UTC) #7
Jakob Kummerow
This had to be reverted in r21887. Firstly, it misses several checks, see https://codereview.chromium.org/346473002/. Also, ...
6 years, 6 months ago (2014-06-19 13:50:38 UTC) #8
p.antonov
I can add the checks but I don't know how the expression stack is out ...
6 years, 6 months ago (2014-06-23 13:59:23 UTC) #9
Jakob Kummerow
On 2014/06/23 13:59:23, p.antonov wrote: > I don't know how the expression stack is out ...
6 years, 6 months ago (2014-06-23 15:13:32 UTC) #10
p.antonov
6 years, 6 months ago (2014-06-24 08:59:30 UTC) #11
Message was sent while issue was closed.
On 2014/06/23 15:13:32, Jakob wrote:
> You can't just call Push()/Pop()/Drop() arbitrarily.

Ok I see what you mean, and actually you simply need something like a property
read deoptimization in the first argument and it will crash:

    // Flags: --allow-natives-syntax --noalways-opt

    function callsFReceiver(o) {
        return [].f.call(o.m, 1, 2, 3);
    }

    Array.prototype.f = function() {
        return this.m;
    };


    var o1 = {m: 1};
    var o2 = {a: 0, m:1};

    var r1 = callsFReceiver(o1);
    callsFReceiver(o1);
    %OptimizeFunctionOnNextCall(callsFReceiver);
    var r2 = callsFReceiver(o1);
    callsFReceiver(o2);
    var r3 = callsFReceiver(o1);

    print(r1 === r2);
    print(r2 === r3);

    callsFReceiver(o1);
    callsFReceiver(o1);
    %OptimizeFunctionOnNextCall(callsFReceiver);
    callsFReceiver(o1);

I was indeed arbitrarily calling the stack manipulation methods.

Powered by Google App Engine
This is Rietveld 408576698