Bug 122289 - Transition stack check JITStubs to CCallHelper functions
Summary: Transition stack check JITStubs to CCallHelper functions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords:
Depends on:
Blocks: 122287
  Show dependency treegraph
 
Reported: 2013-10-03 11:22 PDT by Michael Saboff
Modified: 2013-10-07 11:19 PDT (History)
0 users

See Also:


Attachments
Works for X64-64 baseline JIT (11.29 KB, patch)
2013-10-04 16:33 PDT, Michael Saboff
no flags Details | Formatted Diff | Diff
Now DFG 64 bit is working (17.42 KB, patch)
2013-10-04 17:06 PDT, Michael Saboff
no flags Details | Formatted Diff | Diff
Patch (29.34 KB, patch)
2013-10-04 18:46 PDT, Michael Saboff
ggaren: review-
Details | Formatted Diff | Diff
Updated patch addressing review comments (30.05 KB, patch)
2013-10-06 16:35 PDT, Michael Saboff
fpizlo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2013-10-03 11:22:42 PDT
The JITStubs cti_stack_check, cti_op_call_arityCheck & cti_op_construct_arityCheck need to be transitioned to CCallHelper functions and likely moved to JITOperations.
Comment 1 Michael Saboff 2013-10-04 16:33:42 PDT
Created attachment 213417 [details]
Works for X64-64 baseline JIT

Next DFG & FTL
Comment 2 Michael Saboff 2013-10-04 17:06:19 PDT
Created attachment 213419 [details]
Now DFG 64 bit is working
Comment 3 Michael Saboff 2013-10-04 18:46:39 PDT
Created attachment 213430 [details]
Patch
Comment 4 Geoffrey Garen 2013-10-06 13:11:44 PDT
Comment on attachment 213430 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=213430&action=review

> Source/JavaScriptCore/dfg/DFGJITCompiler.cpp:128
> +        // Remove hostCallFlag from caller

Should be "hostCallFrameFlag". Please add a period to make this a sentence.

> Source/JavaScriptCore/dfg/DFGJITCompiler.cpp:131
> +        andPtr(TrustedImmPtr(reinterpret_cast<void *>(~CallFrame::hostCallFrameFlag())), GPRInfo::argumentGPR0);

Should be "void*".

> Source/JavaScriptCore/dfg/DFGJITCompiler.cpp:386
> +    m_speculative->callOperationCheckCallerException(operationStackCheck, m_codeBlock);

This is an awkward read. It sounds like you're saying "check for an exception thrown by my caller". How about "callOperationDuringCallFrameInitialization" or "callOperationWithCallFrameRollbackOnException"?

> Source/JavaScriptCore/dfg/DFGJITCompiler.h:263
> -    
> +

Please revert.

> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:1727
>          prepareForExternalCall();
>          m_jit.emitStoreCodeOrigin(m_currentNode->codeOrigin);
>          JITCompiler::Call call = m_jit.appendCall(function);
> +        m_jit.exceptionCheckForCaller();
> +        return call;
> +    }
> +    JITCompiler::Call appendCallWithCallerExceptionCheck(const FunctionPtr& function)
> +    {
> +        prepareForExternalCall();
> +        m_jit.emitStoreCodeOrigin(m_currentNode->codeOrigin);
> +        JITCompiler::Call call = m_jit.appendCall(function);
>          m_jit.exceptionCheck();
>          return call;
>      }

Is this backwards? "appendCallWithCallerExceptionCheck" seems to call "exceptionCheck", while "appendCallWithExceptionCheck" seems to call "exceptionCheckForCaller".

> Source/JavaScriptCore/ftl/FTLLink.cpp:110
> +        // Until then, use a JIT ASSERT

Please add a period, to make this a complete sentence.

> Source/JavaScriptCore/ftl/FTLLink.cpp:136
> +        jit.load64(state.graph.m_vm.addressOfException(), GPRInfo::regT1);

Ditto.

> Source/JavaScriptCore/jit/JITOperations.cpp:44
> +    // We pass in our own code block, because the callframe hasn't been populated.
> +    CodeBlock* codeBlock = static_cast<CodeBlock*>(codeBlockPtr);

Why isn't the function's argument type CodeBlock*?
Comment 5 Michael Saboff 2013-10-06 16:35:03 PDT
Created attachment 213538 [details]
Updated patch addressing review comments
Comment 6 Filip Pizlo 2013-10-07 10:31:39 PDT
Comment on attachment 213538 [details]
Updated patch addressing review comments

View in context: https://bugs.webkit.org/attachment.cgi?id=213538&action=review

r=me, but don't use "B" for CodeBlock*.

> Source/JavaScriptCore/jit/JITOperations.h:54
> +    B: CodeBlock*

I've been moving towards having new "types" use multi-character names.  The convention is that it's always first letter capitalized, all other letters lower case.  I think that "Cb" would be intuitive enough.
Comment 7 Michael Saboff 2013-10-07 10:40:17 PDT
(In reply to comment #6)
> (From update of attachment 213538 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213538&action=review
> 
> r=me, but don't use "B" for CodeBlock*.
> 
> > Source/JavaScriptCore/jit/JITOperations.h:54
> > +    B: CodeBlock*
> 
> I've been moving towards having new "types" use multi-character names.  The convention is that it's always first letter capitalized, all other letters lower case.  I think that "Cb" would be intuitive enough.

I'll use Cb.  I didn't notice the multi-letter names in the comment, but now see them used in the declarations.
Comment 8 Geoffrey Garen 2013-10-07 11:00:14 PDT
Comment on attachment 213538 [details]
Updated patch addressing review comments

View in context: https://bugs.webkit.org/attachment.cgi?id=213538&action=review

> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:1102
> +    JITCompiler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_EB operation, void* pointer)

Let's make all the names consistent with this name:

    appendCallWithCallerExceptionCheck => appendCallWithCallFrameRollbackOnException
    appendCallWithCallerExceptionCheckSetResult => appendCallWithCallFrameRollbackOnExceptionSetResult
    exceptionCheckForCaller => exceptionCheckWithCallFrameRollback
    m_exceptionChecksForCaller => m_exceptionChecksWithCallFrameRollback
    exceptionChecksForCaller => exceptionChecksWithCallFrameRollback
Comment 9 Michael Saboff 2013-10-07 11:15:09 PDT
(In reply to comment #8)
> (From update of attachment 213538 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213538&action=review
> 
> > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:1102
> > +    JITCompiler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_EB operation, void* pointer)
> 
> Let's make all the names consistent with this name:
> 
>     appendCallWithCallerExceptionCheck => appendCallWithCallFrameRollbackOnException
>     appendCallWithCallerExceptionCheckSetResult => appendCallWithCallFrameRollbackOnExceptionSetResult
>     exceptionCheckForCaller => exceptionCheckWithCallFrameRollback
>     m_exceptionChecksForCaller => m_exceptionChecksWithCallFrameRollback
>     exceptionChecksForCaller => exceptionChecksWithCallFrameRollback

I made these changes.
Comment 10 Michael Saboff 2013-10-07 11:19:22 PDT
Committed r157050: <http://trac.webkit.org/changeset/157050>