Ignore:
Timestamp:
May 17, 2010, 7:39:20 PM (15 years ago)
Author:
[email protected]
Message:

Bug 39252 - Move host/native JSFunction's NativeFunction onto NativeExecutable.

Reviewed by Geoff Garen.

Currently host functions reuse JSFunction's ScopeChain as storage for their
NativeFunction (the C function pointer to the host function implementation).
Instead, move this onto NativeExecutable. This will allow host functions to
have a scopechain (which will be implemented as a separate patch).

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • jit/JIT.h:
  • jit/JITCall.cpp:

(JSC::JIT::compileOpCallInitializeCallFrame):
(JSC::JIT::compileOpCall):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):

  • jit/JITOpcodes32_64.cpp:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::emitSlow_op_get_by_val):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::stringGetByValStubGenerator):
(JSC::JIT::emitSlow_op_get_by_val):

  • jit/JITStubs.cpp:

(JSC::JITThunks::specializedThunk):

  • jit/JITStubs.h:

(JSC::JITThunks::ctiNativeCall):

  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::finalize):

  • jit/ThunkGenerators.cpp:

(JSC::charCodeAtThunkGenerator):
(JSC::charAtThunkGenerator):
(JSC::fromCharCodeThunkGenerator):
(JSC::sqrtThunkGenerator):
(JSC::powThunkGenerator):

  • jit/ThunkGenerators.h:
  • runtime/Executable.h:

(JSC::NativeExecutable::create):
(JSC::NativeExecutable::function):
(JSC::NativeExecutable::NativeExecutable):
(JSC::JSFunction::nativeFunction):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::~JSFunction):
(JSC::JSFunction::markChildren):
(JSC::JSFunction::getCallData):
(JSC::JSFunction::call):
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::getConstructData):
(JSC::JSFunction::construct):

  • runtime/JSFunction.h:

(JSC::JSFunction::scope):

  • runtime/JSGlobalData.h:

(JSC::JSGlobalData::getThunk):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/StringConstructor.cpp:

(JSC::StringConstructor::StringConstructor):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSFunction.h

    r58286 r59637  
    4444    public:
    4545        JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
    46         JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeExecutable*, NativeFunction);
     46        JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, PassRefPtr<NativeExecutable>);
    4747        JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
    4848        virtual ~JSFunction();
     
    5151        JSValue call(ExecState*, JSValue thisValue, const ArgList&);
    5252
    53         void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); }
    54         ScopeChain& scope() { return scopeChain(); }
     53        ScopeChain& scope()
     54        {
     55            ASSERT(!isHostFunctionNonInline());
     56            return m_scopeChain;
     57        }
     58        void setScope(const ScopeChain& scopeChain)
     59        {
     60            ASSERT(!isHostFunctionNonInline());
     61            m_scopeChain = scopeChain;
     62        }
    5563
    5664        ExecutableBase* executable() const { return m_executable.get(); }
     
    6775        }
    6876
    69         NativeFunction nativeFunction()
    70         {
    71             return *WTF::bitwise_cast<NativeFunction*>(m_data);
    72         }
     77        NativeFunction nativeFunction();
    7378
    7479        virtual ConstructType getConstructData(ConstructData&);
     
    98103
    99104        RefPtr<ExecutableBase> m_executable;
    100         ScopeChain& scopeChain()
    101         {
    102             ASSERT(!isHostFunctionNonInline());
    103             return *WTF::bitwise_cast<ScopeChain*>(m_data);
    104         }
    105         void clearScopeChain()
    106         {
    107             ASSERT(!isHostFunctionNonInline());
    108             new (m_data) ScopeChain(NoScopeChain());
    109         }
    110         void setScopeChain(ScopeChainNode* sc)
    111         {
    112             ASSERT(!isHostFunctionNonInline());
    113             new (m_data) ScopeChain(sc);
    114         }
    115         void setScopeChain(const ScopeChain& sc)
    116         {
    117             ASSERT(!isHostFunctionNonInline());
    118             *WTF::bitwise_cast<ScopeChain*>(m_data) = sc;
    119         }
    120         void setNativeFunction(NativeFunction func)
    121         {
    122             *WTF::bitwise_cast<NativeFunction*>(m_data) = func;
    123         }
    124         unsigned char m_data[sizeof(void*)];
     105        ScopeChain m_scopeChain;
    125106    };
    126107
Note: See TracChangeset for help on using the changeset viewer.