Changeset 96465 in webkit


Ignore:
Timestamp:
Oct 1, 2011 5:54:56 PM (13 years ago)
Author:
ggaren@apple.com
Message:

Removed redundant helper functions for allocating Strong handles
https://bugs.webkit.org/show_bug.cgi?id=69218

Reviewed by Sam Weinig.

../JavaScriptCore:

  • heap/Heap.h:

(JSC::Heap::handleHeap):

  • runtime/JSGlobalData.h: Removed these helper functions, since they

just created indirection.

  • heap/StrongInlines.h: Added. Broke out a header for inline functions

to resolve circular dependencies created by inlining. I'm told this is
the future for JavaScriptCore.

  • API/JSCallbackObjectFunctions.h:

(JSC::::init):

  • runtime/WeakGCMap.h:

(JSC::WeakGCMap::add):
(JSC::WeakGCMap::set):

  • runtime/StructureTransitionTable.h:

(JSC::StructureTransitionTable::setSingleTransition):

  • heap/Local.h:

(JSC::::Local):

  • heap/Strong.h:

(JSC::::Strong):
(JSC::::set):

  • heap/Weak.h:

(JSC::Weak::Weak):
(JSC::Weak::set): Allocate handles directly instead of going through a
chain of forwarding functions.

  • bytecompiler/BytecodeGenerator.cpp:
  • runtime/JSGlobalData.cpp:
  • runtime/LiteralParser.cpp:
  • runtime/RegExpCache.cpp: Updated for header changes.

../JavaScriptGlue:

  • JSRun.cpp:
  • JSValueWrapper.cpp:

../WebCore:

  • ForwardingHeaders/heap/StrongInlines.h: Added.
  • bindings/js/JSCallbackData.h:
  • bindings/js/JSDOMWindowShell.cpp:
  • bindings/js/ScheduledAction.h:
  • bindings/js/ScriptCachedFrameData.cpp:
  • bindings/js/ScriptController.cpp:
  • bindings/js/ScriptState.cpp:
  • bindings/js/ScriptValue.h:
  • bindings/js/WorkerScriptController.cpp:
  • bridge/runtime_root.cpp:

../WebKit2:

  • WebProcess/Plugins/Netscape/NPJSObject.cpp:
  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
Location:
trunk/Source
Files:
2 added
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r96164 r96465  
    107107        needsFinalizer = jsClassPtr->finalize;
    108108    if (needsFinalizer) {
    109         HandleSlot slot = exec->globalData().allocateGlobalHandle();
     109        HandleSlot slot = exec->globalData().heap.handleHeap()->allocate();
    110110        HandleHeap::heapFor(slot)->makeWeak(slot, m_callbackObjectData.get(), classRef());
    111111        HandleHeap::heapFor(slot)->writeBarrier(slot, this);
  • trunk/Source/JavaScriptCore/ChangeLog

    r96463 r96465  
     12011-10-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Removed redundant helper functions for allocating Strong handles
     4        https://bugs.webkit.org/show_bug.cgi?id=69218
     5
     6        Reviewed by Sam Weinig.
     7
     8        * heap/Heap.h:
     9        (JSC::Heap::handleHeap):
     10        * runtime/JSGlobalData.h: Removed these helper functions, since they
     11        just created indirection.
     12
     13        * heap/StrongInlines.h: Added. Broke out a header for inline functions
     14        to resolve circular dependencies created by inlining. I'm told this is
     15        the future for JavaScriptCore.
     16
     17        * GNUmakefile.list.am:
     18        * JavaScriptCore.gypi:
     19        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
     20        * JavaScriptCore.xcodeproj/project.pbxproj: Go forth and build.
     21
     22        * API/JSCallbackObjectFunctions.h:
     23        (JSC::::init):
     24        * runtime/WeakGCMap.h:
     25        (JSC::WeakGCMap::add):
     26        (JSC::WeakGCMap::set):
     27        * runtime/StructureTransitionTable.h:
     28        (JSC::StructureTransitionTable::setSingleTransition):
     29        * heap/Local.h:
     30        (JSC::::Local):
     31        * heap/Strong.h:
     32        (JSC::::Strong):
     33        (JSC::::set):
     34        * heap/Weak.h:
     35        (JSC::Weak::Weak):
     36        (JSC::Weak::set): Allocate handles directly instead of going through a
     37        chain of forwarding functions.
     38
     39        * bytecompiler/BytecodeGenerator.cpp:
     40        * runtime/JSGlobalData.cpp:
     41        * runtime/LiteralParser.cpp:
     42        * runtime/RegExpCache.cpp: Updated for header changes.
     43
    1442011-09-30  Filip Pizlo  <fpizlo@apple.com>
    245
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r96463 r96465  
    163163        Source/JavaScriptCore/heap/MarkedSpace.h \
    164164        Source/JavaScriptCore/heap/Strong.h \
     165        Source/JavaScriptCore/heap/StrongInlines.h \
    165166        Source/JavaScriptCore/heap/VTableSpectrum.cpp \
    166167        Source/JavaScriptCore/heap/VTableSpectrum.h \
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r96001 r96465  
    3939            'heap/LocalScope.h',
    4040            'heap/Strong.h',
     41            'heap/StrongInlines.h',
    4142            'heap/Weak.h',
    4243            'config.h',
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj

    r96463 r96465  
    19751975                            </File>
    19761976                            <File
     1977                                    RelativePath="..\..\heap\StrongInlines.h"
     1978                                    >
     1979                            </File>
     1980                            <File
    19771981                                    RelativePath="..\..\heap\Handle.h"
    19781982                                    >
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r96463 r96465  
    167167                14469DEE107EC7E700650446 /* UString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* UString.cpp */; };
    168168                144836E7132DA7BE005BE785 /* ConservativeRoots.h in Headers */ = {isa = PBXBuildFile; fileRef = 149DAAF212EB559D0083B12B /* ConservativeRoots.h */; settings = {ATTRIBUTES = (Private, ); }; };
     169                145722861437E140005FDE26 /* StrongInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 145722851437E140005FDE26 /* StrongInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
    169170                146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; };
    170171                146B16D812EB5B59001BEC1B /* ConservativeRoots.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146B14DB12EB5B12001BEC1B /* ConservativeRoots.cpp */; };
     
    892893                1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; };
    893894                14456A311314657800212CA3 /* DoublyLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoublyLinkedList.h; sourceTree = "<group>"; };
     895                145722851437E140005FDE26 /* StrongInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StrongInlines.h; sourceTree = "<group>"; };
    894896                145C507F0D9DF63B0088F6B9 /* CallData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallData.h; sourceTree = "<group>"; };
    895897                146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; };
     
    16941696                                0FC8150814043BCA00CFA603 /* WriteBarrierSupport.cpp */,
    16951697                                0FC8150914043BD200CFA603 /* WriteBarrierSupport.h */,
     1698                                145722851437E140005FDE26 /* StrongInlines.h */,
    16961699                        );
    16971700                        path = heap;
     
    24782481                                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
    24792482                                86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */,
     2483                                145722861437E140005FDE26 /* StrongInlines.h in Headers */,
    24802484                                0FD82F4B142806A100179C94 /* BitVector.h in Headers */,
    24812485                                0FD82F2B1426CA6D00179C94 /* JettisonedCodeBlocks.h in Headers */,
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r95901 r96465  
    3535#include "Interpreter.h"
    3636#include "ScopeChain.h"
     37#include "StrongInlines.h"
    3738#include "UString.h"
    3839
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r96432 r96465  
    119119        template<typename Functor> typename Functor::ReturnType forEachProtectedCell(Functor&);
    120120        template<typename Functor> typename Functor::ReturnType forEachProtectedCell();
    121        
    122         HandleSlot allocateGlobalHandle() { return m_handleHeap.allocate(); }
    123         HandleSlot allocateLocalHandle() { return m_handleStack.push(); }
    124 
     121
     122        HandleHeap* handleHeap() { return &m_handleHeap; }
    125123        HandleStack* handleStack() { return &m_handleStack; }
     124
    126125        void getConservativeRegisterRoots(HashSet<JSCell*>& roots);
    127126
  • trunk/Source/JavaScriptCore/heap/Local.h

    r95912 r96465  
    5858
    5959template <typename T> inline Local<T>::Local(JSGlobalData& globalData, ExternalType value)
    60     : Handle<T>(globalData.allocateLocalHandle())
     60    : Handle<T>(globalData.heap.handleStack()->push())
    6161{
    6262    set(value);
     
    6464
    6565template <typename T> inline Local<T>::Local(JSGlobalData& globalData, Handle<T> other)
    66     : Handle<T>(globalData.allocateLocalHandle())
     66    : Handle<T>(globalData.heap.handleStack()->push())
    6767{
    6868    set(other.get());
  • trunk/Source/JavaScriptCore/heap/Strong.h

    r95901 r96465  
    3434
    3535class JSGlobalData;
    36 HandleSlot allocateGlobalHandle(JSGlobalData&);
    3736
    3837// A strongly referenced handle that prevents the object it points to from being garbage collected.
     
    4948    }
    5049   
    51     Strong(JSGlobalData& globalData, ExternalType value = ExternalType())
    52         : Handle<T>(allocateGlobalHandle(globalData))
    53     {
    54         set(value);
    55     }
     50    Strong(JSGlobalData&, ExternalType = ExternalType());
    5651
    57     Strong(JSGlobalData& globalData, Handle<T> handle)
    58         : Handle<T>(allocateGlobalHandle(globalData))
    59     {
    60         set(handle.get());
    61     }
     52    Strong(JSGlobalData&, Handle<T>);
    6253   
    6354    Strong(const Strong& other)
     
    9687    }
    9788
    98     void set(JSGlobalData& globalData, ExternalType value)
    99     {
    100         if (!slot())
    101             setSlot(allocateGlobalHandle(globalData));
    102         set(value);
    103     }
     89    void set(JSGlobalData&, ExternalType);
    10490
    10591    template <typename U> Strong& operator=(const Strong<U>& other)
  • trunk/Source/JavaScriptCore/heap/Weak.h

    r95912 r96465  
    4848
    4949    Weak(JSGlobalData& globalData, ExternalType value = ExternalType(), WeakHandleOwner* weakOwner = 0, void* context = 0)
    50         : Handle<T>(globalData.allocateGlobalHandle())
     50        : Handle<T>(globalData.heap.handleHeap()->allocate())
    5151    {
    5252        HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context);
     
    107107    {
    108108        if (!slot()) {
    109             setSlot(globalData.allocateGlobalHandle());
     109            setSlot(globalData.heap.handleHeap()->allocate());
    110110            HandleHeap::heapFor(slot())->makeWeak(slot(), weakOwner, context);
    111111        }
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r95758 r96465  
    5757#include "RegExpObject.h"
    5858#include "StrictEvalActivation.h"
     59#include "StrongInlines.h"
    5960#include <wtf/Threading.h>
    6061#include <wtf/WTFThreadData.h>
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r95758 r96465  
    296296#endif
    297297        void dumpRegExpTrace();
    298         HandleSlot allocateGlobalHandle() { return heap.allocateGlobalHandle(); }
    299         HandleSlot allocateLocalHandle() { return heap.allocateLocalHandle(); }
    300298        void clearBuiltinStructures();
    301299
     
    321319    };
    322320
    323     inline HandleSlot allocateGlobalHandle(JSGlobalData& globalData)
    324     {
    325         return globalData.allocateGlobalHandle();
    326     }
    327 
    328321#if ENABLE(GC_VALIDATION)
    329322    inline bool JSGlobalData::isInitializingObject() const
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp

    r95901 r96465  
    3030#include "JSString.h"
    3131#include "Lexer.h"
     32#include "StrongInlines.h"
    3233#include "UStringBuilder.h"
    3334#include <wtf/ASCIICType.h>
  • trunk/Source/JavaScriptCore/runtime/RegExpCache.cpp

    r95901 r96465  
    3030#include "RegExpCache.h"
    3131#include "RegExpObject.h"
     32#include "StrongInlines.h"
    3233
    3334namespace JSC {
  • trunk/Source/JavaScriptCore/runtime/StructureTransitionTable.h

    r95901 r96465  
    157157        HandleSlot slot = this->slot();
    158158        if (!slot) {
    159             slot = globalData.allocateGlobalHandle();
     159            slot = globalData.heap.handleHeap()->allocate();
    160160            HandleHeap::heapFor(slot)->makeWeak(slot, 0, 0);
    161161            m_data = reinterpret_cast<intptr_t>(slot) | UsingSingleSlotFlag;
  • trunk/Source/JavaScriptCore/runtime/WeakGCMap.h

    r95901 r96465  
    126126        pair<typename MapType::iterator, bool> iter = m_map.add(key, 0);
    127127        if (iter.second) {
    128             HandleSlot slot = globalData.allocateGlobalHandle();
     128            HandleSlot slot = globalData.heap.handleHeap()->allocate();
    129129            iter.first->second = slot;
    130130            HandleHeap::heapFor(slot)->makeWeak(slot, this, FinalizerCallback::finalizerContextFor(key));
     
    148148        HandleSlot slot = iter.first->second;
    149149        if (iter.second) {
    150             slot = globalData.allocateGlobalHandle();
     150            slot = globalData.heap.handleHeap()->allocate();
    151151            HandleHeap::heapFor(slot)->makeWeak(slot, this, key);
    152152            iter.first->second = slot;
  • trunk/Source/JavaScriptGlue/ChangeLog

    r96346 r96465  
     12011-10-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Removed redundant helper functions for allocating Strong handles
     4        https://bugs.webkit.org/show_bug.cgi?id=69218
     5
     6        Reviewed by Sam Weinig.
     7
     8        * JSRun.cpp:
     9        * JSValueWrapper.cpp:
     10
    1112011-09-29  Mark Hahnenberg  <mhahnenberg@apple.com>
    212
  • trunk/Source/JavaScriptGlue/JSRun.cpp

    r95108 r96465  
    3333#include <JavaScriptCore/Completion.h>
    3434#include <JavaScriptCore/SourceCode.h>
     35#include <JavaScriptCore/StrongInlines.h>
    3536
    3637JSGlueGlobalObject::JSGlueGlobalObject(JSGlobalData& globalData, Structure* structure, Structure* userObjectStructure, JSFlags flags)
  • trunk/Source/JavaScriptGlue/JSValueWrapper.cpp

    r96164 r96465  
    3232#include <JavaScriptCore/JSArray.h>
    3333#include <JavaScriptCore/PropertyNameArray.h>
     34#include <JavaScriptCore/StrongInlines.h>
    3435#include <pthread.h>
    3536
  • trunk/Source/WebCore/ChangeLog

    r96455 r96465  
     12011-10-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Removed redundant helper functions for allocating Strong handles
     4        https://bugs.webkit.org/show_bug.cgi?id=69218
     5
     6        Reviewed by Sam Weinig.
     7
     8        * ForwardingHeaders/heap/StrongInlines.h: Added.
     9        * bindings/js/JSCallbackData.h:
     10        * bindings/js/JSDOMWindowShell.cpp:
     11        * bindings/js/ScheduledAction.h:
     12        * bindings/js/ScriptCachedFrameData.cpp:
     13        * bindings/js/ScriptController.cpp:
     14        * bindings/js/ScriptState.cpp:
     15        * bindings/js/ScriptValue.h:
     16        * bindings/js/WorkerScriptController.cpp:
     17        * bridge/runtime_root.cpp:
     18
    1192011-10-01  Sheriff Bot  <webkit.review.bot@gmail.com>
    220
  • trunk/Source/WebCore/bindings/js/JSCallbackData.h

    r85094 r96465  
    3434#include "ScriptExecutionContext.h"
    3535#include <heap/Strong.h>
     36#include <heap/StrongInlines.h>
    3637#include <runtime/JSObject.h>
    3738#include <wtf/Threading.h>
  • trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp

    r96346 r96465  
    3434#include "DOMWindow.h"
    3535#include "ScriptController.h"
     36#include <heap/StrongInlines.h>
    3637#include <runtime/JSObject.h>
    3738
  • trunk/Source/WebCore/bindings/js/ScheduledAction.h

    r84073 r96465  
    2424#include "PlatformString.h"
    2525#include <heap/Strong.h>
     26#include <heap/StrongInlines.h>
    2627#include <runtime/JSCell.h>
    2728#include <wtf/PassOwnPtr.h>
  • trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp

    r95901 r96465  
    3737#include "Page.h"
    3838#include "PageGroup.h"
     39#include <heap/StrongInlines.h>
    3940#include <runtime/JSLock.h>
    4041#include "ScriptController.h"
  • trunk/Source/WebCore/bindings/js/ScriptController.cpp

    r95449 r96465  
    4545#include "runtime_root.h"
    4646#include <debugger/Debugger.h>
     47#include <heap/StrongInlines.h>
    4748#include <runtime/InitializeThreading.h>
    4849#include <runtime/JSLock.h>
  • trunk/Source/WebCore/bindings/js/ScriptState.cpp

    r95901 r96465  
    3838#include "WorkerContext.h"
    3939#include "WorkerScriptController.h"
     40#include <heap/StrongInlines.h>
    4041#include <interpreter/CallFrame.h>
    4142#include <runtime/JSGlobalObject.h>
  • trunk/Source/WebCore/bindings/js/ScriptValue.h

    r95901 r96465  
    3737#include "ScriptState.h"
    3838#include <heap/Strong.h>
     39#include <heap/StrongInlines.h>
    3940#include <runtime/JSValue.h>
    4041#include <wtf/PassRefPtr.h>
  • trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp

    r94918 r96465  
    3939#include "WorkerObjectProxy.h"
    4040#include "WorkerThread.h"
     41#include <heap/StrongInlines.h>
    4142#include <interpreter/Interpreter.h>
    4243#include <runtime/Completion.h>
  • trunk/Source/WebCore/bridge/runtime_root.cpp

    r87192 r96465  
    2929#include "BridgeJSC.h"
    3030#include "runtime_object.h"
     31#include <heap/StrongInlines.h>
    3132#include <heap/Weak.h>
    3233#include <runtime/JSGlobalObject.h>
  • trunk/Source/WebKit2/ChangeLog

    r96439 r96465  
     12011-10-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Removed redundant helper functions for allocating Strong handles
     4        https://bugs.webkit.org/show_bug.cgi?id=69218
     5
     6        Reviewed by Sam Weinig.
     7
     8        * WebProcess/Plugins/Netscape/NPJSObject.cpp:
     9        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
     10
    1112011-09-30  Sam Weinig  <sam@webkit.org>
    212
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp

    r95901 r96465  
    3232#include <JavaScriptCore/JSLock.h>
    3333#include <JavaScriptCore/JSObject.h>
     34#include <JavaScriptCore/StrongInlines.h>
    3435#include <WebCore/Frame.h> 
    3536#include <WebCore/IdentifierRep.h>
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r95901 r96465  
    3737#include <JavaScriptCore/SourceCode.h>
    3838#include <JavaScriptCore/Strong.h>
     39#include <JavaScriptCore/StrongInlines.h>
    3940#include <WebCore/Frame.h>
    4041
Note: See TracChangeset for help on using the changeset viewer.