Changeset 166520 in webkit


Ignore:
Timestamp:
Mar 31, 2014 1:23:21 PM (10 years ago)
Author:
akling@apple.com
Message:

Always inline toJS() for NodeList.
<https://webkit.org/b/130974>

This is a pretty cheesy optimization, but it's a 3% progression on
Dromaeo/dom-query.html on my MBP.

Reviewed by Benjamin Poulain.

  • WebCore.exp.in:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSNodeListCustom.h: Added.

(WebCore::toJS):

  • dom/NodeList.idl:
Location:
trunk/Source/WebCore
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166519 r166520  
     12014-03-31  Andreas Kling  <akling@apple.com>
     2
     3        Always inline toJS() for NodeList.
     4        <https://webkit.org/b/130974>
     5
     6        This is a pretty cheesy optimization, but it's a 3% progression on
     7        Dromaeo/dom-query.html on my MBP.
     8
     9        Reviewed by Benjamin Poulain.
     10
     11        * WebCore.exp.in:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * bindings/js/JSNodeListCustom.h: Added.
     14        (WebCore::toJS):
     15        * dom/NodeList.idl:
     16
    1172014-03-31  Benjamin Poulain  <bpoulain@apple.com>
    218
  • trunk/Source/WebCore/WebCore.exp.in

    r166517 r166520  
    307307__ZN7WebCore13cookiesForDOMERKNS_21NetworkStorageSessionERKNS_3URLES5_
    308308__ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
     309__ZN7WebCore13createWrapperERNS_17JSDOMGlobalObjectERNS_8NodeListE
    309310__ZN7WebCore13directoryNameERKN3WTF6StringE
    310311__ZN7WebCore13listDirectoryERKN3WTF6StringES3_
     
    10821083__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
    10831084__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE
    1084 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE
    10851085__ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE
    10861086__ZN7WebCore5Color11transparentE
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r166447 r166520  
    42254225                ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; };
    42264226                AD03AAFA1468455300A39B5B /* CSSValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD03AAF81468453900A39B5B /* CSSValue.cpp */; };
     4227                AD20B18D18E9D237005A8083 /* JSNodeListCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AD20B18C18E9D216005A8083 /* JSNodeListCustom.h */; settings = {ATTRIBUTES = (Private, ); }; };
    42274228                AD4495F3141FC08900541EDF /* EventListenerMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4495F1141FC08900541EDF /* EventListenerMap.cpp */; };
    42284229                AD4495F4141FC08900541EDF /* EventListenerMap.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4495F2141FC08900541EDF /* EventListenerMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1132811329                ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderMenuList.h; sourceTree = "<group>"; };
    1132911330                AD03AAF81468453900A39B5B /* CSSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValue.cpp; sourceTree = "<group>"; };
     11331                AD20B18C18E9D216005A8083 /* JSNodeListCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNodeListCustom.h; sourceTree = "<group>"; };
    1133011332                AD4495F1141FC08900541EDF /* EventListenerMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventListenerMap.cpp; sourceTree = "<group>"; };
    1133111333                AD4495F2141FC08900541EDF /* EventListenerMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventListenerMap.h; sourceTree = "<group>"; };
     
    2056420566                                1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
    2056520567                                BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */,
     20568                                AD20B18C18E9D216005A8083 /* JSNodeListCustom.h */,
    2056620569                                FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */,
    2056720570                                FD8AA63D169514A700D2EA68 /* JSPannerNodeCustom.cpp */,
     
    2403624039                                E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */,
    2403724040                                977E2DCE12F0E28300C13379 /* HTMLSourceTracker.h in Headers */,
     24041                                AD20B18D18E9D237005A8083 /* JSNodeListCustom.h in Headers */,
    2403824042                                978AD67514130A8D00C7CAE3 /* HTMLSpanElement.h in Headers */,
    2403924043                                A871DC230A15205700B12A68 /* HTMLStyleElement.h in Headers */,
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp

    r165757 r166520  
    6161}
    6262
     63JSC::JSValue createWrapper(JSDOMGlobalObject& globalObject, NodeList& nodeList)
     64{
     65    globalObject.vm().heap.reportExtraMemoryCost(nodeList.memoryCost());
     66    return createNewWrapper<JSNodeList>(&globalObject, &nodeList);
     67}
     68
    6369} // namespace WebCore
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.h

    r166519 r166520  
    11/*
    2  * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 #include "config.h"
     26#ifndef JSNodeListCustom_h
     27#define JSNodeListCustom_h
     28
     29#include "JSDOMBinding.h"
    2730#include "JSNodeList.h"
    28 
    29 #include "ChildNodeList.h"
    30 #include "JSNode.h"
    31 #include "LiveNodeList.h"
    32 #include "Node.h"
    33 #include "NodeList.h"
    34 #include <wtf/text/AtomicString.h>
    35 
    36 using namespace JSC;
    3731
    3832namespace WebCore {
    3933
    40 bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
     34JSC::JSValue createWrapper(JSDOMGlobalObject&, NodeList&);
     35
     36ALWAYS_INLINE JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, NodeList* nodeList)
    4137{
    42     JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.slot()->asCell());
    43     if (!jsNodeList->hasCustomProperties())
    44         return false;
    45     if (jsNodeList->impl().isLiveNodeList())
    46         return visitor.containsOpaqueRoot(root(static_cast<LiveNodeList&>(jsNodeList->impl()).ownerNode()));
    47     if (jsNodeList->impl().isChildNodeList())
    48         return visitor.containsOpaqueRoot(root(static_cast<ChildNodeList&>(jsNodeList->impl()).ownerNode()));
    49     if (jsNodeList->impl().isEmptyNodeList())
    50         return visitor.containsOpaqueRoot(root(static_cast<EmptyNodeList&>(jsNodeList->impl()).ownerNode()));
    51     return false;
    52 }
    53 
    54 bool JSNodeList::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
    55 {
    56     if (Node* item = impl().namedItem(propertyNameToAtomicString(propertyName))) {
    57         slot.setValue(this, ReadOnly | DontDelete | DontEnum, toJS(exec, globalObject(), item));
    58         return true;
    59     }
    60     return false;
     38    if (!nodeList)
     39        return JSC::jsNull();
     40    if (JSC::JSValue existingWrapper = getExistingWrapper<JSNodeList>(globalObject, nodeList))
     41        return existingWrapper;
     42    return createWrapper(*globalObject, *nodeList);
    6143}
    6244
    6345} // namespace WebCore
     46
     47#endif // JSNodeListCustom_h
  • trunk/Source/WebCore/dom/NodeList.idl

    r164853 r166520  
    2121[
    2222    CustomIsReachable,
     23    CustomToJSObject,
    2324    JSCustomGetOwnPropertySlotAndDescriptor,
     25    JSCustomHeader,
    2426    SkipVTableValidation,
    2527    ReportExtraMemoryCost,
Note: See TracChangeset for help on using the changeset viewer.