Bug 179478

Summary: [JSC] Optimize default constructor implementation for derived class with array iterator protocol check
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 178064    

Description Yusuke Suzuki 2017-11-09 07:44:48 PST
Current default constructor implementation for derived class is,

constructor(...args)
{
    super(...args);
}

But the above code allocates arrays until FTL while that is apparently unnecessary for many cases.
It makes super() call construct_varargs with opaque array... Which is not good since DFGByteCodeParser do not handle it well if the constructor is non JS.
So, extends Array case is not optimized well in this case.

We would like to explore the performance improvement by changing this to

constructor(...args)
{
    if (@isArrayIteratorProtocolFastAndNonObservable()) {
        @superForwardArguments();
        return;
    }
    super(@spread());
}