Changeset 182899 in webkit


Ignore:
Timestamp:
Apr 16, 2015 12:15:09 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Extract the allocation profile from JSFunction into a rare object
https://bugs.webkit.org/show_bug.cgi?id=143807
.:

Patch by Basile Clement <basile_clement@apple.com> on 2015-04-16
Reviewed by Filip Pizlo.

  • WebKit.xcworkspace/contents.xcworkspacedata:

Source/JavaScriptCore:

Patch by Basile Clement <basile_clement@apple.com> on 2015-04-16
Reviewed by Filip Pizlo.

The allocation profile is only needed for those functions that are used
to create objects with [new].
Extracting it into its own JSCell removes the need for JSFunction and
JSCallee to be JSDestructibleObjects, which should improve performances in most
cases at the cost of an extra pointer dereference when the allocation profile
is actually needed.

  • CMakeLists.txt:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_create_this):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_create_this):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/FunctionRareData.cpp: Added.

(JSC::FunctionRareData::create):
(JSC::FunctionRareData::destroy):
(JSC::FunctionRareData::createStructure):
(JSC::FunctionRareData::visitChildren):
(JSC::FunctionRareData::FunctionRareData):
(JSC::FunctionRareData::~FunctionRareData):
(JSC::FunctionRareData::finishCreation):

  • runtime/FunctionRareData.h: Added.

(JSC::FunctionRareData::offsetOfAllocationProfile):
(JSC::FunctionRareData::allocationProfile):
(JSC::FunctionRareData::allocationStructure):
(JSC::FunctionRareData::allocationProfileWatchpointSet):

  • runtime/JSBoundFunction.cpp:

(JSC::JSBoundFunction::destroy): Deleted.

  • runtime/JSBoundFunction.h:
  • runtime/JSCallee.cpp:

(JSC::JSCallee::destroy): Deleted.

  • runtime/JSCallee.h:
  • runtime/JSFunction.cpp:

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::createRareData):
(JSC::JSFunction::visitChildren):
(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):
(JSC::JSFunction::destroy): Deleted.
(JSC::JSFunction::createAllocationProfile): Deleted.

  • runtime/JSFunction.h:

(JSC::JSFunction::offsetOfRareData):
(JSC::JSFunction::rareData):
(JSC::JSFunction::allocationStructure):
(JSC::JSFunction::allocationProfileWatchpointSet):
(JSC::JSFunction::offsetOfAllocationProfile): Deleted.
(JSC::JSFunction::allocationProfile): Deleted.

  • runtime/JSFunctionInlines.h:

(JSC::JSFunction::JSFunction):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:
Location:
trunk
Files:
2 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r182885 r182899  
     12015-04-16  Basile Clement  <basile_clement@apple.com>
     2
     3        Extract the allocation profile from JSFunction into a rare object
     4        https://bugs.webkit.org/show_bug.cgi?id=143807
     5
     6        Reviewed by Filip Pizlo.
     7
     8        * WebKit.xcworkspace/contents.xcworkspacedata:
     9
    1102015-04-16  Csaba Osztrogonác  <ossy@webkit.org>
    211
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r182871 r182899  
    449449    runtime/FunctionHasExecutedCache.cpp
    450450    runtime/FunctionPrototype.cpp
     451    runtime/FunctionRareData.cpp
    451452    runtime/GetterSetter.cpp
    452453    runtime/Identifier.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r182890 r182899  
     12015-04-16  Basile Clement  <basile_clement@apple.com>
     2 
     3        Extract the allocation profile from JSFunction into a rare object
     4        https://bugs.webkit.org/show_bug.cgi?id=143807
     5 
     6        Reviewed by Filip Pizlo.
     7 
     8        The allocation profile is only needed for those functions that are used
     9        to create objects with [new].
     10        Extracting it into its own JSCell removes the need for JSFunction and
     11        JSCallee to be JSDestructibleObjects, which should improve performances in most
     12        cases at the cost of an extra pointer dereference when the allocation profile
     13        is actually needed.
     14 
     15        * CMakeLists.txt:
     16        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     17        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     18        * JavaScriptCore.xcodeproj/project.pbxproj:
     19        * dfg/DFGOperations.cpp:
     20        * dfg/DFGSpeculativeJIT32_64.cpp:
     21        (JSC::DFG::SpeculativeJIT::compile):
     22        * dfg/DFGSpeculativeJIT64.cpp:
     23        (JSC::DFG::SpeculativeJIT::compile):
     24        * jit/JITOpcodes.cpp:
     25        (JSC::JIT::emit_op_create_this):
     26        * jit/JITOpcodes32_64.cpp:
     27        (JSC::JIT::emit_op_create_this):
     28        * llint/LowLevelInterpreter32_64.asm:
     29        * llint/LowLevelInterpreter64.asm:
     30        * runtime/CommonSlowPaths.cpp:
     31        (JSC::SLOW_PATH_DECL):
     32        * runtime/FunctionRareData.cpp: Added.
     33        (JSC::FunctionRareData::create):
     34        (JSC::FunctionRareData::destroy):
     35        (JSC::FunctionRareData::createStructure):
     36        (JSC::FunctionRareData::visitChildren):
     37        (JSC::FunctionRareData::FunctionRareData):
     38        (JSC::FunctionRareData::~FunctionRareData):
     39        (JSC::FunctionRareData::finishCreation):
     40        * runtime/FunctionRareData.h: Added.
     41        (JSC::FunctionRareData::offsetOfAllocationProfile):
     42        (JSC::FunctionRareData::allocationProfile):
     43        (JSC::FunctionRareData::allocationStructure):
     44        (JSC::FunctionRareData::allocationProfileWatchpointSet):
     45        * runtime/JSBoundFunction.cpp:
     46        (JSC::JSBoundFunction::destroy): Deleted.
     47        * runtime/JSBoundFunction.h:
     48        * runtime/JSCallee.cpp:
     49        (JSC::JSCallee::destroy): Deleted.
     50        * runtime/JSCallee.h:
     51        * runtime/JSFunction.cpp:
     52        (JSC::JSFunction::JSFunction):
     53        (JSC::JSFunction::createRareData):
     54        (JSC::JSFunction::visitChildren):
     55        (JSC::JSFunction::put):
     56        (JSC::JSFunction::defineOwnProperty):
     57        (JSC::JSFunction::destroy): Deleted.
     58        (JSC::JSFunction::createAllocationProfile): Deleted.
     59        * runtime/JSFunction.h:
     60        (JSC::JSFunction::offsetOfRareData):
     61        (JSC::JSFunction::rareData):
     62        (JSC::JSFunction::allocationStructure):
     63        (JSC::JSFunction::allocationProfileWatchpointSet):
     64        (JSC::JSFunction::offsetOfAllocationProfile): Deleted.
     65        (JSC::JSFunction::allocationProfile): Deleted.
     66        * runtime/JSFunctionInlines.h:
     67        (JSC::JSFunction::JSFunction):
     68        * runtime/VM.cpp:
     69        (JSC::VM::VM):
     70        * runtime/VM.h:
     71 
    1722015-04-16  Csaba Osztrogonác  <ossy@webkit.org>
    273
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r182871 r182899  
    717717    <ClCompile Include="..\runtime\FunctionHasExecutedCache.cpp" />
    718718    <ClCompile Include="..\runtime\FunctionPrototype.cpp" />
     719    <ClCompile Include="..\runtime\FunctionRareData.cpp" />
    719720    <ClCompile Include="..\runtime\GetterSetter.cpp" />
    720721    <ClCompile Include="..\runtime\Identifier.cpp" />
     
    14971498    <ClInclude Include="..\runtime\FunctionHasExecutedCache.h" />
    14981499    <ClInclude Include="..\runtime\FunctionPrototype.h" />
     1500    <ClInclude Include="..\runtime\FunctionRareData.h" />
    14991501    <ClInclude Include="..\runtime\GenericArguments.h" />
    15001502    <ClInclude Include="..\runtime\GenericArgumentsInlines.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r182871 r182899  
    607607      <Filter>runtime</Filter>
    608608    </ClCompile>
     609    <ClCompile Include="..\runtime\FunctionRareData.cpp">
     610      <Filter>runtime</Filter>
     611    </ClCompile>
    609612    <ClCompile Include="..\runtime\GetterSetter.cpp">
    610613      <Filter>runtime</Filter>
     
    26322635    </ClInclude>
    26332636    <ClInclude Include="..\runtime\FunctionPrototype.h">
     2637      <Filter>runtime</Filter>
     2638    </ClInclude>
     2639    <ClInclude Include="..\runtime\FunctionRareData.h">
    26342640      <Filter>runtime</Filter>
    26352641    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r182871 r182899  
    954954                5DBB1525131D0BD70056AD36 /* minidom.js in Copy Support Script */ = {isa = PBXBuildFile; fileRef = 1412110D0A48788700480255 /* minidom.js */; };
    955955                5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (); }; };
     956                62D2D38F1ADF103F000206C1 /* FunctionRareData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */; };
     957                62D2D3901ADF103F000206C1 /* FunctionRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 62D2D38E1ADF103F000206C1 /* FunctionRareData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    956958                6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
    957959                651122FD14046A4C002B101D /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
     
    26452647                5DDDF44614FEE72200B4FB4D /* LLIntDesiredOffsets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntDesiredOffsets.h; path = LLIntOffsets/LLIntDesiredOffsets.h; sourceTree = BUILT_PRODUCTS_DIR; };
    26462648                5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = "<group>"; };
     2649                62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionRareData.cpp; sourceTree = "<group>"; };
     2650                62D2D38E1ADF103F000206C1 /* FunctionRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionRareData.h; sourceTree = "<group>"; };
    26472651                6507D2970E871E4A00D7D896 /* JSTypeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypeInfo.h; sourceTree = "<group>"; };
    26482652                651122E5140469BA002B101D /* testRegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testRegExp.cpp; sourceTree = "<group>"; };
     
    43984402                                F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
    43994403                                F692A85D0255597D01FF60F7 /* FunctionPrototype.h */,
     4404                                62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */,
     4405                                62D2D38E1ADF103F000206C1 /* FunctionRareData.h */,
    44004406                                0FE050111AA9091100D33B33 /* GenericArguments.h */,
    44014407                                0FE050121AA9091100D33B33 /* GenericArgumentsInlines.h */,
     
    56255631                                0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */,
    56265632                                0FB7F39815ED8E4600F167B2 /* ButterflyInlines.h in Headers */,
     5633                                62D2D3901ADF103F000206C1 /* FunctionRareData.h in Headers */,
    56275634                                C2FCAE1117A9C24E0034C735 /* BytecodeBasicBlock.h in Headers */,
    56285635                                0F21C27F14BEAA8200ADC64B /* BytecodeConventions.h in Headers */,
     
    74467453                                A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */,
    74477454                                0F24E55017EE274900ABB217 /* Repatch.cpp in Sources */,
     7455                                62D2D38F1ADF103F000206C1 /* FunctionRareData.cpp in Sources */,
    74487456                                0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */,
    74497457                                1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */,
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r182759 r182899  
    230230#endif
    231231   
    232     return constructEmptyObject(exec, jsCast<JSFunction*>(constructor)->allocationProfile(exec, inlineCapacity)->structure());
     232    return constructEmptyObject(exec, jsCast<JSFunction*>(constructor)->rareData(exec, inlineCapacity)->allocationProfile()->structure());
    233233}
    234234
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r182827 r182899  
    34983498        GPRReg structureGPR = structure.gpr();
    34993499        GPRReg scratchGPR = scratch.gpr();
     3500        // Rare data is only used to access the allocator & structure
     3501        // We can avoid using an additional GPR this way
     3502        GPRReg rareDataGPR = structureGPR;
    35003503       
    35013504        MacroAssembler::JumpList slowPath;
    35023505
    3503         m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorGPR);
    3504         m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureGPR);
    3505         slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, allocatorGPR));
     3506        m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfRareData()), rareDataGPR);
     3507        slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, rareDataGPR));
     3508        m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorGPR);
     3509        m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureGPR);
    35063510        emitAllocateJSObject(resultGPR, allocatorGPR, structureGPR, TrustedImmPtr(0), scratchGPR, slowPath);
    35073511
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r182827 r182899  
    35693569        GPRReg structureGPR = structure.gpr();
    35703570        GPRReg scratchGPR = scratch.gpr();
     3571        // Rare data is only used to access the allocator & structure
     3572        // We can avoid using an additional GPR this way
     3573        GPRReg rareDataGPR = structureGPR;
    35713574
    35723575        MacroAssembler::JumpList slowPath;
    3573        
    3574         m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorGPR);
    3575         m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureGPR);
    3576         slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, allocatorGPR));
     3576
     3577        m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfRareData()), rareDataGPR);
     3578        slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, rareDataGPR));
     3579        m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorGPR);
     3580        m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureGPR);
    35773581        emitAllocateJSObject(resultGPR, allocatorGPR, structureGPR, TrustedImmPtr(0), scratchGPR, slowPath);
    35783582
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r182759 r182899  
    696696    int callee = currentInstruction[2].u.operand;
    697697    RegisterID calleeReg = regT0;
     698    RegisterID rareDataReg = regT0;
    698699    RegisterID resultReg = regT0;
    699700    RegisterID allocatorReg = regT1;
     
    702703
    703704    emitGetVirtualRegister(callee, calleeReg);
    704     loadPtr(Address(calleeReg, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorReg);
    705     loadPtr(Address(calleeReg, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureReg);
    706     addSlowCase(branchTestPtr(Zero, allocatorReg));
     705    loadPtr(Address(calleeReg, JSFunction::offsetOfRareData()), rareDataReg);
     706    addSlowCase(branchTestPtr(Zero, rareDataReg));
     707    loadPtr(Address(rareDataReg, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorReg);
     708    loadPtr(Address(rareDataReg, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureReg);
    707709
    708710    emitAllocateJSObject(allocatorReg, structureReg, resultReg, scratchReg);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r181993 r182899  
    915915    int callee = currentInstruction[2].u.operand;
    916916    RegisterID calleeReg = regT0;
     917    RegisterID rareDataReg = regT0;
    917918    RegisterID resultReg = regT0;
    918919    RegisterID allocatorReg = regT1;
     
    921922
    922923    emitLoadPayload(callee, calleeReg);
    923     loadPtr(Address(calleeReg, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorReg);
    924     loadPtr(Address(calleeReg, JSFunction::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureReg);
    925     addSlowCase(branchTestPtr(Zero, allocatorReg));
     924    loadPtr(Address(calleeReg, JSFunction::offsetOfRareData()), rareDataReg);
     925    addSlowCase(branchTestPtr(Zero, rareDataReg));
     926    loadPtr(Address(rareDataReg, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorReg);
     927    loadPtr(Address(rareDataReg, FunctionRareData::offsetOfAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureReg);
    926928
    927929    emitAllocateJSObject(allocatorReg, structureReg, resultReg, scratchReg);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r182759 r182899  
    741741    loadi 8[PC], t0
    742742    loadp PayloadOffset[cfr, t0, 8], t0
    743     loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_allocator[t0], t1
    744     loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_structure[t0], t2
    745     btpz t1, .opCreateThisSlow
     743    loadp JSFunction::m_rareData[t0], t4
     744    btpz t4, .opCreateThisSlow
     745    loadp FunctionRareData::m_allocationProfile + ObjectAllocationProfile::m_allocator[t4], t1
     746    loadp FunctionRareData::m_allocationProfile + ObjectAllocationProfile::m_structure[t4], t2
    746747    allocateJSObject(t1, t2, t0, t3, .opCreateThisSlow)
    747748    loadi 4[PC], t1
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r182759 r182899  
    627627    loadisFromInstruction(2, t0)
    628628    loadp [cfr, t0, 8], t0
    629     loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_allocator[t0], t1
    630     loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_structure[t0], t2
    631     btpz t1, .opCreateThisSlow
     629    loadp JSFunction::m_rareData[t0], t4
     630    btpz t4, .opCreateThisSlow
     631    loadp FunctionRareData::m_allocationProfile + ObjectAllocationProfile::m_allocator[t4], t1
     632    loadp FunctionRareData::m_allocationProfile + ObjectAllocationProfile::m_structure[t4], t2
    632633    allocateJSObject(t1, t2, t0, t3, .opCreateThisSlow)
    633634    loadisFromInstruction(1, t1)
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r182759 r182899  
    237237
    238238    size_t inlineCapacity = pc[3].u.operand;
    239     Structure* structure = constructor->allocationProfile(exec, inlineCapacity)->structure();
     239    Structure* structure = constructor->rareData(exec, inlineCapacity)->allocationProfile()->structure();
    240240    RETURN(constructEmptyObject(exec, structure));
    241241}
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r171939 r182899  
    8787}
    8888
    89 void JSBoundFunction::destroy(JSCell* cell)
    90 {
    91     static_cast<JSBoundFunction*>(cell)->JSBoundFunction::~JSBoundFunction();
    92 }
    93 
    9489bool JSBoundFunction::customHasInstance(JSObject* object, ExecState* exec, JSValue value)
    9590{
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.h

    r182747 r182899  
    4141    static JSBoundFunction* create(VM&, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&);
    4242   
    43     static void destroy(JSCell*);
    44 
    4543    static bool customHasInstance(JSObject*, ExecState*, JSValue);
    4644
  • trunk/Source/JavaScriptCore/runtime/JSCallee.cpp

    r181765 r182899  
    4040const ClassInfo JSCallee::s_info = { "Callee", &Base::s_info, 0, CREATE_METHOD_TABLE(JSCallee) };
    4141
    42 void JSCallee::destroy(JSCell* cell)
    43 {
    44     static_cast<JSCallee*>(cell)->JSCallee::~JSCallee();
    45 }
    46 
    4742JSCallee::JSCallee(VM& vm, JSGlobalObject* globalObject, Structure* structure)
    4843    : Base(vm, structure)
  • trunk/Source/JavaScriptCore/runtime/JSCallee.h

    r182747 r182899  
    2727#define JSCallee_h
    2828
    29 #include "JSDestructibleObject.h"
    3029#include "JSGlobalObject.h"
     30#include "JSObject.h"
    3131#include "JSScope.h"
    3232
     
    3737
    3838
    39 class JSCallee : public JSDestructibleObject {
     39class JSCallee : public JSNonFinalObject {
    4040    friend class JIT;
    4141#if ENABLE(DFG_JIT)
     
    4646
    4747public:
    48     typedef JSDestructibleObject Base;
     48    typedef JSNonFinalObject Base;
    4949    const static unsigned StructureFlags = Base::StructureFlags | ImplementsHasInstance;
    5050
     
    5656    }
    5757   
    58     static void destroy(JSCell*);
    59 
    6058    JSScope* scope()
    6159    {
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r182759 r182899  
    8686}
    8787
    88 void JSFunction::destroy(JSCell* cell)
    89 {
    90     static_cast<JSFunction*>(cell)->JSFunction::~JSFunction();
    91 }
    92 
    9388JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure)
    9489    : Base(vm, globalObject, structure)
    9590    , m_executable()
    96     // We initialize blind so that changes to the prototype after function creation but before
    97     // the optimizer kicks in don't disable optimizations. Once the optimizer kicks in, the
    98     // watchpoint will start watching and any changes will both force deoptimization and disable
    99     // future attempts to optimize. This is necessary because we are guaranteed that the
    100     // allocation profile is changed exactly once prior to optimizations kicking in. We could be
    101     // smarter and count the number of times the prototype is clobbered and only optimize if it
    102     // was clobbered exactly once, but that seems like overkill. In almost all cases it will be
    103     // clobbered once, and if it's clobbered more than once, that will probably only occur
    104     // before we started optimizing, anyway.
    105     , m_allocationProfileWatchpoint(ClearWatchpoint)
    10691{
    10792}
     
    124109}
    125110
    126 ObjectAllocationProfile* JSFunction::createAllocationProfile(ExecState* exec, size_t inlineCapacity)
     111FunctionRareData* JSFunction::createRareData(ExecState* exec, size_t inlineCapacity)
    127112{
    128113    VM& vm = exec->vm();
     
    130115    if (!prototype)
    131116        prototype = globalObject()->objectPrototype();
    132     m_allocationProfile.initialize(globalObject()->vm(), this, prototype, inlineCapacity);
    133     return &m_allocationProfile;
     117    FunctionRareData* rareData = FunctionRareData::create(vm, prototype, inlineCapacity);
     118    m_rareData.set(vm, this, rareData);
     119    return m_rareData.get();
    134120}
    135121
     
    177163
    178164    visitor.append(&thisObject->m_executable);
    179     thisObject->m_allocationProfile.visitAggregate(visitor);
     165    if (thisObject->m_rareData)
     166        visitor.append(&thisObject->m_rareData);
    180167}
    181168
     
    403390        PropertySlot slot(thisObject);
    404391        thisObject->methodTable(exec->vm())->getOwnPropertySlot(thisObject, exec, propertyName, slot);
    405         thisObject->m_allocationProfile.clear();
    406         thisObject->m_allocationProfileWatchpoint.fireAll("Store to prototype property of a function");
    407         // Don't allow this to be cached, since a [[Put]] must clear m_allocationProfile.
     392        if (thisObject->m_rareData) {
     393            thisObject->m_rareData->allocationProfileWatchpointSet().fireAll("Store to prototype property of a function");
     394            thisObject->m_rareData.clear();
     395        }
     396        // Don't allow this to be cached, since a [[Put]] must clear m_rareData.
    408397        PutPropertySlot dontCache(thisObject);
    409398        Base::put(thisObject, exec, propertyName, value, dontCache);
     
    450439        PropertySlot slot(thisObject);
    451440        thisObject->methodTable(exec->vm())->getOwnPropertySlot(thisObject, exec, propertyName, slot);
    452         thisObject->m_allocationProfile.clear();
    453         thisObject->m_allocationProfileWatchpoint.fireAll("Store to prototype property of a function");
     441        if (thisObject->m_rareData) {
     442            thisObject->m_rareData->allocationProfileWatchpointSet().fireAll("Store to prototype property of a function");
     443            thisObject->m_rareData.clear();
     444        }
    454445        return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
    455446    }
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r182759 r182899  
    2525#define JSFunction_h
    2626
     27#include "FunctionRareData.h"
    2728#include "InternalFunction.h"
    2829#include "JSCallee.h"
    2930#include "JSScope.h"
    30 #include "ObjectAllocationProfile.h"
    3131#include "Watchpoint.h"
    3232
     
    4949
    5050JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
    51    
     51
    5252class JSFunction : public JSCallee {
    5353    friend class JIT;
     
    6767
    6868    static JSFunction* createBuiltinFunction(VM&, FunctionExecutable*, JSGlobalObject*);
    69 
    70     static void destroy(JSCell*);
    7169
    7270    JS_EXPORT_PRIVATE String name(ExecState*);
     
    10199    }
    102100
    103     static inline ptrdiff_t offsetOfAllocationProfile()
     101    static inline ptrdiff_t offsetOfRareData()
    104102    {
    105         return OBJECT_OFFSETOF(JSFunction, m_allocationProfile);
     103        return OBJECT_OFFSETOF(JSFunction, m_rareData);
    106104    }
    107105
    108     ObjectAllocationProfile* allocationProfile(ExecState* exec, unsigned inlineCapacity)
     106    FunctionRareData* rareData(ExecState* exec, unsigned inlineCapacity)
    109107    {
    110         if (UNLIKELY(m_allocationProfile.isNull()))
    111             return createAllocationProfile(exec, inlineCapacity);
    112         return &m_allocationProfile;
     108        if (UNLIKELY(!m_rareData))
     109            return createRareData(exec, inlineCapacity);
     110        return m_rareData.get();
    113111    }
    114112
    115     Structure* allocationStructure() { return m_allocationProfile.structure(); }
     113    Structure* allocationStructure()
     114    {
     115        ASSERT(m_rareData);
     116        return m_rareData.get()->allocationStructure();
     117    }
    116118
    117119    InlineWatchpointSet& allocationProfileWatchpointSet()
    118120    {
    119         return m_allocationProfileWatchpoint;
     121        ASSERT(m_rareData);
     122        return m_rareData.get()->allocationProfileWatchpointSet();
    120123    }
    121124
     
    132135    using Base::finishCreation;
    133136
    134     ObjectAllocationProfile* createAllocationProfile(ExecState*, size_t inlineCapacity);
     137    FunctionRareData* createRareData(ExecState*, size_t inlineCapacity);
    135138
    136139    static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
     
    161164
    162165    WriteBarrier<ExecutableBase> m_executable;
    163     ObjectAllocationProfile m_allocationProfile;
    164     InlineWatchpointSet m_allocationProfileWatchpoint;
     166    WriteBarrier<FunctionRareData> m_rareData;
    165167};
    166168
  • trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h

    r182759 r182899  
    4242    : Base(vm, scope, scope->globalObject()->functionStructure())
    4343    , m_executable(vm, this, executable)
    44     , m_allocationProfileWatchpoint(ClearWatchpoint) // See comment in JSFunction.cpp concerning the reason for using ClearWatchpoint as opposed to IsWatched.
     44    , m_rareData()
    4545{
    4646}
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r182831 r182899  
    232232    weakMapDataStructure.set(*this, WeakMapData::createStructure(*this, 0, jsNull()));
    233233    inferredValueStructure.set(*this, InferredValue::createStructure(*this, 0, jsNull()));
     234    functionRareDataStructure.set(*this, FunctionRareData::createStructure(*this, 0, jsNull()));
    234235#if ENABLE(PROMISES)
    235236    promiseDeferredStructure.set(*this, JSPromiseDeferred::createStructure(*this, 0, jsNull()));
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r182759 r182899  
    272272    Strong<Structure> weakMapDataStructure;
    273273    Strong<Structure> inferredValueStructure;
     274    Strong<Structure> functionRareDataStructure;
    274275#if ENABLE(PROMISES)
    275276    Strong<Structure> promiseDeferredStructure;
  • trunk/WebKit.xcworkspace/contents.xcworkspacedata

    r166950 r182899  
    22<Workspace
    33   version = "1.0">
     4   <FileRef
     5      location = "group:Source/JavaScriptCore/runtime/FunctionRareData.cpp">
     6   </FileRef>
     7   <FileRef
     8      location = "group:Source/JavaScriptCore/runtime/FunctionRareData.h">
     9   </FileRef>
     10   <FileRef
     11      location = "group:Source">
     12   </FileRef>
    413   <FileRef
    514      location = "group:Source/bmalloc/bmalloc.xcodeproj">
Note: See TracChangeset for help on using the changeset viewer.