Changeset 96465 in webkit for trunk/Source/JavaScriptCore/heap


Ignore:
Timestamp:
Oct 1, 2011, 5:54:56 PM (14 years ago)
Author:
[email protected]
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/JavaScriptCore/heap
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.