Ignore:
Timestamp:
Jan 15, 2008, 10:43:15 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Geoffrey Garen.

Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size

  • This changes the way JS functions that use Lookup tables are handled. Instead using one class per function, which allowed specialization of the virtual callAsFunction method, we now use on class, PrototypeFunction, which takes a pointer to a static function to use as the implementation. This significantly decreases the binary size of JavaScriptCore (about 145k on an Intel only build) while still keeping some of the speedup r27608 garnered (SunSpider says this is 1.005x as slow, which should leave some wiggle room from the original 1% speedup) and keeps the functions implementations in separate functions to help with optimizations.
  • JavaScriptCore.exp:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • kjs/array_object.cpp: (KJS::arrayProtoFuncToString): (KJS::arrayProtoFuncToLocaleString): (KJS::arrayProtoFuncJoin): (KJS::arrayProtoFuncConcat): (KJS::arrayProtoFuncPop): (KJS::arrayProtoFuncPush): (KJS::arrayProtoFuncReverse): (KJS::arrayProtoFuncShift): (KJS::arrayProtoFuncSlice): (KJS::arrayProtoFuncSort): (KJS::arrayProtoFuncSplice): (KJS::arrayProtoFuncUnShift): (KJS::arrayProtoFuncFilter): (KJS::arrayProtoFuncMap): (KJS::arrayProtoFuncEvery): (KJS::arrayProtoFuncForEach): (KJS::arrayProtoFuncSome): (KJS::arrayProtoFuncIndexOf): (KJS::arrayProtoFuncLastIndexOf):
  • kjs/array_object.h:
  • kjs/date_object.cpp: (KJS::DatePrototype::getOwnPropertySlot): (KJS::dateProtoFuncToString): (KJS::dateProtoFuncToUTCString): (KJS::dateProtoFuncToDateString): (KJS::dateProtoFuncToTimeString): (KJS::dateProtoFuncToLocaleString): (KJS::dateProtoFuncToLocaleDateString): (KJS::dateProtoFuncToLocaleTimeString): (KJS::dateProtoFuncValueOf): (KJS::dateProtoFuncGetTime): (KJS::dateProtoFuncGetFullYear): (KJS::dateProtoFuncGetUTCFullYear): (KJS::dateProtoFuncToGMTString): (KJS::dateProtoFuncGetMonth): (KJS::dateProtoFuncGetUTCMonth): (KJS::dateProtoFuncGetDate): (KJS::dateProtoFuncGetUTCDate): (KJS::dateProtoFuncGetDay): (KJS::dateProtoFuncGetUTCDay): (KJS::dateProtoFuncGetHours): (KJS::dateProtoFuncGetUTCHours): (KJS::dateProtoFuncGetMinutes): (KJS::dateProtoFuncGetUTCMinutes): (KJS::dateProtoFuncGetSeconds): (KJS::dateProtoFuncGetUTCSeconds): (KJS::dateProtoFuncGetMilliSeconds): (KJS::dateProtoFuncGetUTCMilliseconds): (KJS::dateProtoFuncGetTimezoneOffset): (KJS::dateProtoFuncSetTime): (KJS::dateProtoFuncSetMilliSeconds): (KJS::dateProtoFuncSetUTCMilliseconds): (KJS::dateProtoFuncSetSeconds): (KJS::dateProtoFuncSetUTCSeconds): (KJS::dateProtoFuncSetMinutes): (KJS::dateProtoFuncSetUTCMinutes): (KJS::dateProtoFuncSetHours): (KJS::dateProtoFuncSetUTCHours): (KJS::dateProtoFuncSetDate): (KJS::dateProtoFuncSetUTCDate): (KJS::dateProtoFuncSetMonth): (KJS::dateProtoFuncSetUTCMonth): (KJS::dateProtoFuncSetFullYear): (KJS::dateProtoFuncSetUTCFullYear): (KJS::dateProtoFuncSetYear): (KJS::dateProtoFuncGetYear):
  • kjs/date_object.h:
  • kjs/function.cpp: (KJS::PrototypeFunction::PrototypeFunction): (KJS::PrototypeFunction::callAsFunction):
  • kjs/function.h:
  • kjs/lookup.h: (KJS::HashEntry::): (KJS::staticFunctionGetter):
  • kjs/math_object.cpp: (KJS::mathProtoFuncAbs): (KJS::mathProtoFuncACos): (KJS::mathProtoFuncASin): (KJS::mathProtoFuncATan): (KJS::mathProtoFuncATan2): (KJS::mathProtoFuncCeil): (KJS::mathProtoFuncCos): (KJS::mathProtoFuncExp): (KJS::mathProtoFuncFloor): (KJS::mathProtoFuncLog): (KJS::mathProtoFuncMax): (KJS::mathProtoFuncMin): (KJS::mathProtoFuncPow): (KJS::mathProtoFuncRandom): (KJS::mathProtoFuncRound): (KJS::mathProtoFuncSin): (KJS::mathProtoFuncSqrt): (KJS::mathProtoFuncTan):
  • kjs/math_object.h:
  • kjs/string_object.cpp: (KJS::stringProtoFuncToString): (KJS::stringProtoFuncValueOf): (KJS::stringProtoFuncCharAt): (KJS::stringProtoFuncCharCodeAt): (KJS::stringProtoFuncConcat): (KJS::stringProtoFuncIndexOf): (KJS::stringProtoFuncLastIndexOf): (KJS::stringProtoFuncMatch): (KJS::stringProtoFuncSearch): (KJS::stringProtoFuncReplace): (KJS::stringProtoFuncSlice): (KJS::stringProtoFuncSplit): (KJS::stringProtoFuncSubstr): (KJS::stringProtoFuncSubstring): (KJS::stringProtoFuncToLowerCase): (KJS::stringProtoFuncToUpperCase): (KJS::stringProtoFuncToLocaleLowerCase): (KJS::stringProtoFuncToLocaleUpperCase): (KJS::stringProtoFuncLocaleCompare): (KJS::stringProtoFuncBig): (KJS::stringProtoFuncSmall): (KJS::stringProtoFuncBlink): (KJS::stringProtoFuncBold): (KJS::stringProtoFuncFixed): (KJS::stringProtoFuncItalics): (KJS::stringProtoFuncStrike): (KJS::stringProtoFuncSub): (KJS::stringProtoFuncSup): (KJS::stringProtoFuncFontcolor): (KJS::stringProtoFuncFontsize): (KJS::stringProtoFuncAnchor): (KJS::stringProtoFuncLink):
  • kjs/string_object.h:

WebCore:

Reviewed by Geoffrey Garen.

Fix <rdar://problem/5595552> r27608 introduced a 20% increase in JS binary size, 4% increase in WebCore binary size

  • Update JS Function implementations to use a static function based method. This decreases the binary size of an Intel only build by 1013.5K.
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::customGetOwnPropertySlot):
  • bindings/js/JSEventTargetBase.cpp: (WebCore::jsEventTargetAddEventListener): (WebCore::jsEventTargetRemoveEventListener): (WebCore::jsEventTargetDispatchEvent): (WebCore::retrieveEventTargetAndCorrespondingNode):
  • bindings/js/JSEventTargetBase.h:
  • bindings/js/JSHTMLInputElementBase.cpp: (WebCore::jsHTMLInputElementBaseFunctionSetSelectionRange): (WebCore::JSHTMLInputElementBase::getOwnPropertySlot):
  • bindings/js/JSHTMLInputElementBase.h:
  • bindings/js/JSLocation.cpp: (WebCore::JSLocation::getOwnPropertySlot): (WebCore::jsLocationProtoFuncReplace): (WebCore::jsLocationProtoFuncReload): (WebCore::jsLocationProtoFuncAssign): (WebCore::jsLocationProtoFuncToString):
  • bindings/js/JSLocation.h:
  • bindings/js/JSXMLHttpRequest.cpp: (KJS::jsXMLHttpRequestPrototypeFunctionAbort): (KJS::jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders): (KJS::jsXMLHttpRequestPrototypeFunctionGetResponseHeader): (KJS::jsXMLHttpRequestPrototypeFunctionOpen): (KJS::jsXMLHttpRequestPrototypeFunctionSend): (KJS::jsXMLHttpRequestPrototypeFunctionSetRequestHeader): (KJS::jsXMLHttpRequestPrototypeFunctionOverrideMIMEType): (KJS::jsXMLHttpRequestPrototypeFunctionAddEventListener): (KJS::jsXMLHttpRequestPrototypeFunctionRemoveEventListener): (KJS::jsXMLHttpRequestPrototypeFunctionDispatchEvent):
  • bindings/js/JSXMLHttpRequest.h:
  • bindings/js/JSXSLTProcessor.cpp: (KJS::jsXSLTProcessorPrototypeFunctionImportStylesheet): (KJS::jsXSLTProcessorPrototypeFunctionTransformToFragment): (KJS::jsXSLTProcessorPrototypeFunctionTransformToDocument): (KJS::jsXSLTProcessorPrototypeFunctionSetParameter): (KJS::jsXSLTProcessorPrototypeFunctionGetParameter): (KJS::jsXSLTProcessorPrototypeFunctionRemoveParameter): (KJS::jsXSLTProcessorPrototypeFunctionClearParameters): (KJS::jsXSLTProcessorPrototypeFunctionReset):
  • bindings/js/JSXSLTProcessor.h:
  • bindings/js/kjs_events.cpp: (WebCore::jsClipboardPrototypeFunctionClearData): (WebCore::jsClipboardPrototypeFunctionGetData): (WebCore::jsClipboardPrototypeFunctionSetData): (WebCore::jsClipboardPrototypeFunctionSetDragImage):
  • bindings/js/kjs_events.h:
  • bindings/js/kjs_navigator.cpp: (KJS::pluginsFunctionRefresh): (KJS::navigatorProtoFuncJavaEnabled):
  • bindings/js/kjs_navigator.h:
  • bindings/js/kjs_window.cpp: (KJS::Window::getOwnPropertySlot): (KJS::windowProtoFuncAToB): (KJS::windowProtoFuncBToA): (KJS::windowProtoFuncOpen): (KJS::windowProtoFuncSetTimeout): (KJS::windowProtoFuncClearTimeout): (KJS::windowProtoFuncSetInterval): (KJS::windowProtoFuncAddEventListener): (KJS::windowProtoFuncRemoveEventListener): (KJS::windowProtoFuncShowModalDialog): (KJS::windowProtoFuncNotImplemented):
  • bindings/js/kjs_window.h:
  • bindings/scripts/CodeGenerator.pm:
  • bindings/scripts/CodeGeneratorJS.pm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r29425 r29508  
    392392                146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; };
    393393                14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; };
    394                 1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSValueRef.h; path = ../API/JSValueRef.h; sourceTree = "<group>"; };
     394                1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = "<group>"; };
    395395                1482B74B0A43032800517CFC /* JSStringRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringRef.h; sourceTree = "<group>"; };
    396396                1482B74C0A43032800517CFC /* JSStringRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRef.cpp; sourceTree = "<group>"; };
     
    742742                        isa = PBXGroup;
    743743                        children = (
     744                                1482B78A0A4305AB00517CFC /* APICast.h */,
    744745                                1CAA8B4A0D32C39A0041BCFF /* JavaScript.h */,
    745746                                1CAA8B4B0D32C39A0041BCFF /* JavaScriptCore.h */,
    746                                 1482B78A0A4305AB00517CFC /* APICast.h */,
    747747                                1421359A0A677F4F00A8195E /* JSBase.cpp */,
    748748                                142711380A460BBB0080EEEA /* JSBase.h */,
     
    766766                                146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */,
    767767                                14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */,
     768                                1482B6EA0A4300B300517CFC /* JSValueRef.h */,
    768769                        );
    769770                        path = API;
     
    931932                        isa = PBXGroup;
    932933                        children = (
    933                                 14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */,
    934934                                659126BC0BDD1728001921FB /* AllInOneFile.cpp */,
    935935                                93ADFCE60CCBD7AC00D30B08 /* array_instance.cpp */,
     
    978978                                65EA4C9A092AF9E20093D800 /* JSLock.h */,
    979979                                14ABB454099C2A0F00E2A24F /* JSType.h */,
    980                                 1482B6EA0A4300B300517CFC /* JSValueRef.h */,
     980                                14F252600D08DF2F004ECFFF /* JSVariableObject.cpp */,
    981981                                14F252560D08DD8D004ECFFF /* JSVariableObject.h */,
    982982                                65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
Note: See TracChangeset for help on using the changeset viewer.