Ignore:
Timestamp:
Jul 5, 2011, 4:18:23 PM (14 years ago)
Author:
[email protected]
Message:

2011-07-05 Filip Pizlo <[email protected]>

JSC JIT has code duplication for the handling of call and construct
https://bugs.webkit.org/show_bug.cgi?id=63957

Reviewed by Gavin Barraclough.

  • jit/JIT.cpp: (JSC::JIT::linkFor):
  • jit/JIT.h:
  • jit/JITStubs.cpp: (JSC::jitCompileFor): (JSC::DEFINE_STUB_FUNCTION): (JSC::arityCheckFor): (JSC::lazyLinkFor):
  • runtime/Executable.h: (JSC::ExecutableBase::generatedJITCodeFor): (JSC::FunctionExecutable::compileFor): (JSC::FunctionExecutable::isGeneratedFor): (JSC::FunctionExecutable::generatedBytecodeFor): (JSC::FunctionExecutable::generatedJITCodeWithArityCheckFor):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r89973 r90414  
    4444
    4545    struct ExceptionInfo;
     46   
     47    enum CodeSpecializationKind { CodeForCall, CodeForConstruct };
    4648
    4749    class ExecutableBase : public JSCell {
     
    9193            ASSERT(m_jitCodeForConstruct);
    9294            return m_jitCodeForConstruct;
     95        }
     96       
     97        JITCode& generatedJITCodeFor(CodeSpecializationKind kind)
     98        {
     99            if (kind == CodeForCall)
     100                return generatedJITCodeForCall();
     101            ASSERT(kind == CodeForConstruct);
     102            return generatedJITCodeForConstruct();
    93103        }
    94104
     
    388398            return *m_codeBlockForConstruct;
    389399        }
     400       
     401        JSObject* compileFor(ExecState* exec, ScopeChainNode* scopeChainNode, CodeSpecializationKind kind)
     402        {
     403            if (kind == CodeForCall)
     404                return compileForCall(exec, scopeChainNode);
     405            ASSERT(kind == CodeForConstruct);
     406            return compileForConstruct(exec, scopeChainNode);
     407        }
     408       
     409        bool isGeneratedFor(CodeSpecializationKind kind)
     410        {
     411            if (kind == CodeForCall)
     412                return isGeneratedForCall();
     413            ASSERT(kind == CodeForConstruct);
     414            return isGeneratedForConstruct();
     415        }
     416       
     417        FunctionCodeBlock& generatedBytecodeFor(CodeSpecializationKind kind)
     418        {
     419            if (kind == CodeForCall)
     420                return generatedBytecodeForCall();
     421            ASSERT(kind == CodeForConstruct);
     422            return generatedBytecodeForConstruct();
     423        }
    390424
    391425        const Identifier& name() { return m_name; }
     
    437471            ASSERT(m_jitCodeForConstructWithArityCheck);
    438472            return m_jitCodeForConstructWithArityCheck;
     473        }
     474       
     475        MacroAssemblerCodePtr generatedJITCodeWithArityCheckFor(CodeSpecializationKind kind)
     476        {
     477            if (kind == CodeForCall)
     478                return generatedJITCodeForCallWithArityCheck();
     479            ASSERT(kind == CodeForConstruct);
     480            return generatedJITCodeForConstructWithArityCheck();
    439481        }
    440482#endif
Note: See TracChangeset for help on using the changeset viewer.