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/jit/JITOpcodes.cpp

    r59339 r59637  
    260260    move(callFrameRegister, X86Registers::edi);
    261261
    262     call(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_data)));
     262    loadPtr(Address(X86Registers::esi, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::r9);
     263    call(Address(X86Registers::r9, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    263264   
    264265    addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
     
    338339    move(callFrameRegister, X86Registers::edx);
    339340
    340     call(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_data)));
     341    loadPtr(Address(X86Registers::eax, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
     342    call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    341343
    342344    // JSValue is a non-POD type
     
    348350    // Plant callframe
    349351    move(callFrameRegister, X86Registers::ecx);
    350     call(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_data)));
     352    loadPtr(Address(X86Registers::edx, OBJECT_OFFSETOF(JSFunction, m_executable)), X86Registers::ebx);
     353    call(Address(X86Registers::ebx, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    351354#endif
    352355
     
    396399    storePtr(regT0, Address(stackPointerRegister));
    397400
    398     call(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_data)));
     401    loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
     402    call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    399403
    400404    loadPtr(Address(regT0), regT0);
     
    414418    move(stackPointerRegister, ARMRegisters::r3);
    415419
    416     call(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_data)));
     420    loadPtr(Address(regT1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3);
     421    call(Address(regT3, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    417422
    418423    addPtr(Imm32(sizeof(ArgList)), stackPointerRegister);
     
    461466
    462467    // Call
    463     call(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_data)));
     468    loadPtr(Address(MIPSRegisters::a2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
     469    call(Address(regT2, OBJECT_OFFSETOF(NativeExecutable, m_function)));
    464470
    465471    // Get returned value from 0($v0) which is the same as 20($sp)
     
    536542    trampolines->ctiVirtualCall = trampolineAt(finalCode, virtualCallBegin);
    537543    trampolines->ctiVirtualConstruct = trampolineAt(finalCode, virtualConstructBegin);
    538     trampolines->ctiNativeCallThunk = adoptRef(new NativeExecutable(JITCode(JITCode::HostFunction(trampolineAt(finalCode, nativeCallThunk)))));
     544    trampolines->ctiNativeCall = trampolineAt(finalCode, nativeCallThunk);
    539545#if ENABLE(JIT_OPTIMIZE_MOD)
    540546    trampolines->ctiSoftModulo = trampolineAt(finalCode, softModBegin);
Note: See TracChangeset for help on using the changeset viewer.