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/Executable.h

    r59587 r59637  
    2727#define Executable_h
    2828
     29#include "CallData.h"
    2930#include "JSFunction.h"
    3031#include "Interpreter.h"
     
    9192#if ENABLE(JIT)
    9293    class NativeExecutable : public ExecutableBase {
    93     public:
    94         NativeExecutable(ExecState* exec)
     94        friend class JIT;
     95    public:
     96        static PassRefPtr<NativeExecutable> create(MacroAssemblerCodePtr thunk, NativeFunction function)
     97        {
     98            return adoptRef(new NativeExecutable(JITCode::HostFunction(thunk), function));
     99        }
     100
     101        ~NativeExecutable();
     102
     103        NativeFunction function() { return m_function; }
     104
     105    private:
     106        NativeExecutable(JITCode thunk, NativeFunction function)
    95107            : ExecutableBase(NUM_PARAMETERS_IS_HOST)
    96         {
    97             m_jitCodeForCall = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall;
    98             m_jitCodeForConstruct = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall; // FIXME: this thunk should have a construct form
    99         }
    100         NativeExecutable(JITCode thunk)
    101             : ExecutableBase(NUM_PARAMETERS_IS_HOST)
     108            , m_function(function)
    102109        {
    103110            m_jitCodeForCall = thunk;
     
    105112        }
    106113
    107         ~NativeExecutable();
     114        NativeFunction m_function;
    108115    };
    109116#endif
     
    404411    }
    405412
     413    inline NativeFunction JSFunction::nativeFunction()
     414    {
     415        ASSERT(isHostFunction());
     416        return static_cast<NativeExecutable*>(m_executable.get())->function();
     417    }
    406418}
    407419
Note: See TracChangeset for help on using the changeset viewer.