⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173541 in webkit


Ignore:
Timestamp:
Sep 11, 2014, 2:52:33 PM (12 years ago)
Author:
msaboff@apple.com
Message:

Move JSScope out of JSFunction into separate JSCallee class
​https://bugs.webkit.org/show_bug.cgi?id=136725

Reviewed by Oliver Hunt.

Created new JSCallee class that contains a JSScope*. Changed JSFunction to inherit from
JSCallee.

Source/JavaScriptCore:

Build changes. Added JSCallee.cpp and JSCallee.h.

  • runtime/JSCallee.cpp: Added.

(JSC::JSCallee::create):
(JSC::JSCallee::destroy):
(JSC::JSCallee::JSCallee):
(JSC::JSCallee::finishCreation):
(JSC::JSCallee::visitChildren):
(JSC::JSCallee::getOwnPropertySlot): Pass through wrapper function.
(JSC::JSCallee::getOwnNonIndexPropertyNames): Pass through wrapper function.
(JSC::JSCallee::put): Pass through wrapper function.
(JSC::JSCallee::deleteProperty): Pass through wrapper function.
(JSC::JSCallee::defineOwnProperty): Pass through wrapper function.

  • runtime/JSCallee.h: Added.

(JSC::JSCallee::scope):
(JSC::JSCallee::scopeUnchecked):
(JSC::JSCallee::setScope):
(JSC::JSCallee::createStructure):
(JSC::JSCallee::offsetOfScopeChain):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::JSFunction):
(JSC::JSFunction::addNameScopeIfNeeded):
(JSC::JSFunction::visitChildren):

  • runtime/JSFunction.h:

(JSC::JSFunction::scope): Deleted.
(JSC::JSFunction::scopeUnchecked): Deleted.
(JSC::JSFunction::setScope): Deleted.
(JSC::JSFunction::offsetOfScopeChain): Deleted.

  • runtime/JSFunctionInlines.h:

(JSC::JSFunction::JSFunction):
Changed to reference JSCallee and its methods.

  • runtime/JSType.h: Added JSCallee as a TypeEnum.

Source/WebCore:

  • ForwardingHeaders/runtime/JSCallee.h: New forwarding header.
Location:
trunk/Source
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r173517 r173541  
    439439    runtime/JSGlobalObjectDebuggable.cpp
    440440    runtime/JSCJSValue.cpp
     441    runtime/JSCallee.cpp
    441442    runtime/JSCell.cpp
    442443    runtime/JSConsole.cpp
    … …  
    444445    runtime/JSDataViewPrototype.cpp
    445446    runtime/JSDateMath.cpp
     447    runtime/JSEnvironmentRecord.cpp
    446448    runtime/JSFunction.cpp
    447449    runtime/JSGlobalObject.cpp
    … …  
    472474    runtime/JSTypedArrayPrototypes.cpp
    473475    runtime/JSTypedArrays.cpp
    474     runtime/JSEnvironmentRecord.cpp
    475476    runtime/JSWeakMap.cpp
    476477    runtime/JSWithScope.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r173534 r173541  
     12014-09-10  Michael Saboff  <msaboff@apple.com>
     2
     3        Move JSScope out of JSFunction into separate JSCallee class
     4        https://bugs.webkit.org/show_bug.cgi?id=136725
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Created new JSCallee class that contains a JSScope*.  Changed JSFunction to inherit from
     9        JSCallee.
     10
     11        * CMakeLists.txt:
     12        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     13        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     14        * JavaScriptCore.xcodeproj/project.pbxproj:
     15        Build changes.  Added JSCallee.cpp and JSCallee.h.
     16
     17        * runtime/JSCallee.cpp: Added.
     18        (JSC::JSCallee::create):
     19        (JSC::JSCallee::destroy):
     20        (JSC::JSCallee::JSCallee):
     21        (JSC::JSCallee::finishCreation):
     22        (JSC::JSCallee::visitChildren):
     23        (JSC::JSCallee::getOwnPropertySlot): Pass through wrapper function.
     24        (JSC::JSCallee::getOwnNonIndexPropertyNames): Pass through wrapper function.
     25        (JSC::JSCallee::put): Pass through wrapper function.
     26        (JSC::JSCallee::deleteProperty): Pass through wrapper function.
     27        (JSC::JSCallee::defineOwnProperty): Pass through wrapper function.
     28
     29        * runtime/JSCallee.h: Added.
     30        (JSC::JSCallee::scope):
     31        (JSC::JSCallee::scopeUnchecked):
     32        (JSC::JSCallee::setScope):
     33        (JSC::JSCallee::createStructure):
     34        (JSC::JSCallee::offsetOfScopeChain):
     35
     36        * runtime/JSFunction.cpp:
     37        (JSC::JSFunction::JSFunction):
     38        (JSC::JSFunction::addNameScopeIfNeeded):
     39        (JSC::JSFunction::visitChildren):
     40        * runtime/JSFunction.h:
     41        (JSC::JSFunction::scope): Deleted.
     42        (JSC::JSFunction::scopeUnchecked): Deleted.
     43        (JSC::JSFunction::setScope): Deleted.
     44        (JSC::JSFunction::offsetOfScopeChain): Deleted.
     45        * runtime/JSFunctionInlines.h:
     46        (JSC::JSFunction::JSFunction):
     47        Changed to reference JSCallee and its methods.
     48
     49        * runtime/JSType.h: Added JSCallee as a TypeEnum.
     50
    1512014-09-11  Filip Pizlo  <fpizlo@apple.com>
    252
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r173517 r173541  
    712712    <ClCompile Include="..\runtime\JSBoundFunction.cpp" />
    713713    <ClCompile Include="..\runtime\JSCJSValue.cpp" />
     714    <ClCompile Include="..\runtime\JSCallee.cpp" />
    714715    <ClCompile Include="..\runtime\JSCell.cpp" />
    715716    <ClCompile Include="..\runtime\JSConsole.cpp" />
    … …  
    14681469    <ClInclude Include="..\runtime\JSCJSValue.h" />
    14691470    <ClInclude Include="..\runtime\JSCJSValueInlines.h" />
     1471    <ClInclude Include="..\runtime\JSCallee.h" />
    14701472    <ClInclude Include="..\runtime\JSCell.h" />
    14711473    <ClInclude Include="..\runtime\JSConsole.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r173517 r173541  
    634634      <Filter>runtime</Filter>
    635635    </ClCompile>
     636    <ClCompile Include="..\runtime\JSCallee.cpp">
     637      <Filter>runtime</Filter>
     638    </ClCompile>
    636639    <ClCompile Include="..\runtime\JSCell.cpp">
    637640      <Filter>runtime</Filter>
    … …  
    25872590    </ClInclude>
    25882591    <ClInclude Include="..\runtime\JSBoundFunction.h">
     2592      <Filter>runtime</Filter>
     2593    </ClInclude>
     2594    <ClInclude Include="..\runtime\JSCallee.h">
    25892595      <Filter>runtime</Filter>
    25902596    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r173517 r173541  
    11701170                6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553A33017A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h */; };
    11711171                655EB29B10CE2581001A990E /* NodesCodegen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 655EB29A10CE2581001A990E /* NodesCodegen.cpp */; };
     1172                657CF45819BF6662004ACBF2 /* JSCallee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 657CF45619BF6662004ACBF2 /* JSCallee.cpp */; };
     1173                657CF45919BF6662004ACBF2 /* JSCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = 657CF45719BF6662004ACBF2 /* JSCallee.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1174                657CF45A19C11390004ACBF2 /* JSCallee.h in Headers */ = {isa = PBXBuildFile; fileRef = 657CF45719BF6662004ACBF2 /* JSCallee.h */; };
    11721175                658D3A5619638268003C45D6 /* VMEntryRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 658D3A5519638268003C45D6 /* VMEntryRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11731176                65C02850171795E200351E35 /* ARMv7Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C0284F171795E200351E35 /* ARMv7Disassembler.cpp */; };
    … …  
    27992802                65621E6B089E859700760F35 /* PropertySlot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertySlot.cpp; sourceTree = "<group>"; tabWidth = 8; };
    28002803                65621E6C089E859700760F35 /* PropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PropertySlot.h; sourceTree = "<group>"; tabWidth = 8; };
     2804                657CF45619BF6662004ACBF2 /* JSCallee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallee.cpp; sourceTree = "<group>"; };
     2805                657CF45719BF6662004ACBF2 /* JSCallee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallee.h; sourceTree = "<group>"; };
    28012806                65860177185A8F5E00030EEE /* MaxFrameExtentForSlowPathCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaxFrameExtentForSlowPathCall.h; sourceTree = "<group>"; };
    28022807                658D3A5519638268003C45D6 /* VMEntryRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VMEntryRecord.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
    … …  
    44994504                                86FA9E8F142BBB2D001773B7 /* JSBoundFunction.cpp */,
    45004505                                86FA9E90142BBB2E001773B7 /* JSBoundFunction.h */,
     4506                                657CF45619BF6662004ACBF2 /* JSCallee.cpp */,
     4507                                657CF45719BF6662004ACBF2 /* JSCallee.h */,
    45014508                                BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
    45024509                                BC1167D80E19BCC9008066DD /* JSCell.h */,
    … …  
    55295536                                5540771B18DA58AD00EFF7F2 /* JSArgumentsIterator.h in Headers */,
    55305537                                5540772218DA58AD00EFF7F2 /* JSArrayIterator.h in Headers */,
     5538                                657CF45A19C11390004ACBF2 /* JSCallee.h in Headers */,
    55315539                                5540774818DA58AD00EFF7F2 /* JSGlobalObjectDebuggable.h in Headers */,
    55325540                                5540774A18DA58AD00EFF7F2 /* JSGlobalObjectFunctions.h in Headers */,
    … …  
    62226230                                140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */,
    62236231                                86FA9E92142BBB2E001773B7 /* JSBoundFunction.h in Headers */,
     6232                                657CF45919BF6662004ACBF2 /* JSCallee.h in Headers */,
    62246233                                BC18C4190E16F5CD00B34460 /* JSCallbackConstructor.h in Headers */,
    62256234                                BC18C41A0E16F5CD00B34460 /* JSCallbackFunction.h in Headers */,
    … …  
    74917500                                14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */,
    74927501                                A7D801A81880D6A80026C39B /* JSCBuiltins.cpp in Sources */,
     7502                                657CF45819BF6662004ACBF2 /* JSCallee.cpp in Sources */,
    74937503                                147F39D1107EC37600427A48 /* JSCell.cpp in Sources */,
    74947504                                147F39D6107EC37600427A48 /* JSCJSValue.cpp in Sources */,
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r172176 r173541  
    8686
    8787JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure)
    88     : Base(vm, structure)
     88    : Base(vm, globalObject, structure)
    8989    , m_executable()
    90     , m_scope(vm, this, globalObject)
    9190    // We initialize blind so that changes to the prototype after function creation but before
    9291    // the optimizer kicks in don't disable optimizations. Once the optimizer kicks in, the
    … …  
    118117    if (!functionNameScopeIsDynamic(executable->usesEval(), executable->isStrictMode()))
    119118        return;
    120     m_scope.set(vm, this, JSNameScope::create(vm, m_scope->globalObject(), executable->name(), this, ReadOnly | DontDelete, m_scope.get()));
     119    setScope(vm, JSNameScope::create(vm, scope()->globalObject(), executable->name(), this, ReadOnly | DontDelete, scope()));
    121120}
    122121
    … …  
    181180    Base::visitChildren(thisObject, visitor);
    182181
    183     visitor.append(&thisObject->m_scope);
    184182    visitor.append(&thisObject->m_executable);
    185183    thisObject->m_allocationProfile.visitAggregate(visitor);
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r173517 r173541  
    2626
    2727#include "InternalFunction.h"
    28 #include "JSDestructibleObject.h"
     28#include "JSCallee.h"
    2929#include "JSScope.h"
    3030#include "ObjectAllocationProfile.h"
    … …  
    5050JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
    5151   
    52 class JSFunction : public JSDestructibleObject {
     52class JSFunction : public JSCallee {
    5353    friend class JIT;
    5454    friend class DFG::SpeculativeJIT;
    … …  
    5757
    5858public:
    59     typedef JSDestructibleObject Base;
     59    typedef JSCallee Base;
    6060
    6161    JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
    … …  
    7777    const String calculatedDisplayName(ExecState*);
    7878
    79     JSScope* scope()
    80     {
    81         ASSERT(!isHostFunctionNonInline());
    82         return m_scope.get();
    83     }
    84     // This method may be called for host functins, in which case it
    85     // will return an arbitrary value. This should only be used for
    86     // optimized paths in which the return value does not matter for
    87     // host functions, and checking whether the function is a host
    88     // function is deemed too expensive.
    89     JSScope* scopeUnchecked()
    90     {
    91         return m_scope.get();
    92     }
    93     void setScope(VM& vm, JSScope* scope)
    94     {
    95         ASSERT(!isHostFunctionNonInline());
    96         m_scope.set(vm, this, scope);
    97     }
    9879    void addNameScopeIfNeeded(VM&);
    9980
    … …  
    119100    static ConstructType getConstructData(JSCell*, ConstructData&);
    120101    static CallType getCallData(JSCell*, CallData&);
    121 
    122     static inline ptrdiff_t offsetOfScopeChain()
    123     {
    124         return OBJECT_OFFSETOF(JSFunction, m_scope);
    125     }
    126102
    127103    static inline ptrdiff_t offsetOfExecutable()
    … …  
    183159
    184160    WriteBarrier<ExecutableBase> m_executable;
    185     WriteBarrier<JSScope> m_scope;
    186161    ObjectAllocationProfile m_allocationProfile;
    187162    InlineWatchpointSet m_allocationProfileWatchpoint;
  • trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h

    r169703 r173541  
    3333
    3434inline JSFunction::JSFunction(VM& vm, FunctionExecutable* executable, JSScope* scope)
    35     : Base(vm, scope->globalObject()->functionStructure())
     35    : Base(vm, scope, scope->globalObject()->functionStructure())
    3636    , m_executable(vm, this, executable)
    37     , m_scope(vm, this, scope)
    3837    , m_allocationProfileWatchpoint(ClearWatchpoint) // See comment in JSFunction.cpp concerning the reason for using ClearWatchpoint as opposed to IsWatched.
    3938{
  • trunk/Source/JavaScriptCore/runtime/JSType.h

    r171660 r173541  
    5151    ObjectType,
    5252    FinalObjectType,
     53    JSCalleeType,
    5354    JSFunctionType,
    5455    NameInstanceType,
  • trunk/Source/WebCore/ChangeLog

    r173539 r173541  
     12014-09-10  Michael Saboff  <msaboff@apple.com>
     2
     3        Move JSScope out of JSFunction into separate JSCallee class
     4        https://bugs.webkit.org/show_bug.cgi?id=136725
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Created new JSCallee class that contains a JSScope*.  Changed JSFunction to inherit from
     9        JSCallee.
     10
     11        * ForwardingHeaders/runtime/JSCallee.h: New forwarding header.
     12
    1132014-09-11  Roger Fong  <roger_fong@apple.com>
    214
Note: See TracChangeset for help on using the changeset viewer.