Ignore:
Timestamp:
Sep 1, 2008, 2:22:54 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-09-01 Geoffrey Garen <[email protected]>

Reviewed by Darin Adler.

First cut at inline caching for access to vanilla JavaScript properties.


SunSpider says 4% faster. Tests heavy on dictionary-like access have
regressed a bit -- we have a lot of room to improve in this area,
but this patch is over-ripe as-is.


JSCells now have a StructureID that uniquely identifies their layout,
and holds their prototype.


JSValue::put takes a PropertySlot& argument, so it can fill in details
about where it put a value, for the sake of caching.

  • VM/CodeGenerator.cpp: (KJS::CodeGenerator::CodeGenerator): Avoid calling removeDirect if we can, since it disables inline caching in the global object. This can probably improve in the future.
  • kjs/JSGlobalObject.cpp: Nixed reset(), since it complicates caching, and wasn't really necessary.
  • kjs/JSObject.cpp: Tweaked getter / setter behavior not to rely on the IsGetterSetter flag, since the flag was buggy. This is necessary in order to avoid accidentally accessing a getter / setter as a normal property.


Also changed getter / setter creation to honor ReadOnly, matching Mozilla.


  • kjs/PropertyMap.cpp: Nixed clear(), since it complicates caching and isn't necessary.
  • kjs/Shell.cpp: Moved SamplingTool dumping outside the loop. This allows you to aggregate sampling of multiple files (or the same file repeatedly), which helped me track down regressions.
  • kjs/ustring.h: Moved IdentifierRepHash here to share it.

WebCore:

2008-09-01 Geoffrey Garen <[email protected]>

Reviewed by Darin Adler.

First cut at inline caching for access to vanilla JavaScript properties.

Updated for JavaScriptCore changes. Mostly mechanical addition of StructureIDs
to WebCore classes, and PutPropertySlot& arguments to put functions.

(WebCore::JSCSSStyleDeclaration::customPut): Be sure to play nice with
inline caching for global properties, so global assignment can be optimized.

  • ForwardingHeaders/kjs/StructureID.h: Added.
  • bindings/js/JSDOMBinding.h: (WebCore::DOMObject::DOMObject):
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::put):
  • bindings/js/JSDOMWindowBase.h:
  • bindings/js/JSDOMWindowCustom.h: (WebCore::JSDOMWindow::customPut):
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::JSDOMWindowShell): (WebCore::JSDOMWindowShell::put):
  • bindings/js/JSDOMWindowShell.h:
  • bindings/js/JSEventTargetBase.h: (WebCore::JSEventTargetBase::put):
  • bindings/js/JSEventTargetNode.h: (WebCore::JSEventTargetNode::put):
  • bindings/js/JSHTMLAppletElementCustom.cpp: (WebCore::JSHTMLAppletElement::customPut):
  • bindings/js/JSHTMLEmbedElementCustom.cpp: (WebCore::JSHTMLEmbedElement::customPut):
  • bindings/js/JSHTMLInputElementBase.cpp: (WebCore::JSHTMLInputElementBase::put):
  • bindings/js/JSHTMLInputElementBase.h:
  • bindings/js/JSHTMLObjectElementCustom.cpp: (WebCore::JSHTMLObjectElement::customPut):
  • bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::customPut):
  • bindings/js/JSInspectedObjectWrapper.cpp: (WebCore::JSInspectedObjectWrapper::wrap): (WebCore::JSInspectedObjectWrapper::JSInspectedObjectWrapper):
  • bindings/js/JSInspectedObjectWrapper.h:
  • bindings/js/JSInspectorCallbackWrapper.cpp: (WebCore::JSInspectorCallbackWrapper::wrap): (WebCore::JSInspectorCallbackWrapper::JSInspectorCallbackWrapper):
  • bindings/js/JSInspectorCallbackWrapper.h:
  • bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::customPut):
  • bindings/js/JSPluginElementFunctions.cpp: (WebCore::runtimeObjectCustomPut):
  • bindings/js/JSPluginElementFunctions.h:
  • bindings/js/JSQuarantinedObjectWrapper.cpp: (WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper): (WebCore::JSQuarantinedObjectWrapper::put):
  • bindings/js/JSQuarantinedObjectWrapper.h:
  • bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::customPut):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject setValue:forKey:]):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp: (_NPN_SetProperty):
  • bridge/jni/jni_jsobject.mm: (JavaJSObject::setMember):
  • bridge/objc/objc_class.mm: (KJS::Bindings::ObjcClass::fallbackObject):
  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm: (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::put):
  • bridge/runtime.cpp: (KJS::Bindings::Instance::createRuntimeObject):
  • bridge/runtime_array.cpp: (RuntimeArray::put):
  • bridge/runtime_array.h:
  • bridge/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::put):
  • bridge/runtime_object.h:

LayoutTests:

2008-09-01 Geoffrey Garen <[email protected]>

Reviewed by Darin Adler.

First cut at inline caching for access to vanilla JavaScript properties.


Tests for things I broke along the way.


  • fast/dom/getter-on-window-object2-expected.txt:
  • fast/js/pic: Added.
  • fast/js/pic/cached-deleted-properties-expected.txt: Added.
  • fast/js/pic/cached-deleted-properties.html: Added.
  • fast/js/pic/cached-getter-dictionary-and-proto-expected.txt: Added.
  • fast/js/pic/cached-getter-dictionary-and-proto.html: Added.
  • fast/js/pic/cached-getter-setter-expected.txt: Added.
  • fast/js/pic/cached-getter-setter.html: Added.
  • fast/js/pic/cached-prototype-setter-expected.txt: Added.
  • fast/js/pic/cached-prototype-setter.html: Added.
  • fast/js/pic/cached-single-entry-transition-expected.txt: Added.
  • fast/js/pic/cached-single-entry-transition.html: Added.
  • fast/js/pic/get-empty-string-expected.txt: Added.
  • fast/js/pic/get-empty-string.html: Added.
  • fast/js/pic/get-set-proxy-object-expected.txt: Added.
  • fast/js/pic/get-set-proxy-object.html: Added.
  • fast/js/pic/rehash-poisons-structure-expected.txt: Added.
  • fast/js/pic/rehash-poisons-structure.html: Added.
File:
1 edited

Legend:

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

    r36006 r36016  
    277277                BCD2034C0E17135E002C7E82 /* DatePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD203480E17135E002C7E82 /* DatePrototype.h */; };
    278278                BCD203E80E1718F4002C7E82 /* DatePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */; };
     279                BCDE3AB80E6C82F5001453A7 /* StructureID.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDE3AB10E6C82CF001453A7 /* StructureID.h */; settings = {ATTRIBUTES = (Private, ); }; };
     280                BCDE3B430E6C832D001453A7 /* StructureID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE3AB00E6C82CF001453A7 /* StructureID.cpp */; };
    279281                BCF605140E203EF800B9A64D /* ArgList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF605120E203EF800B9A64D /* ArgList.h */; settings = {ATTRIBUTES = (Private, ); }; };
    280282                C0A272630E50A06300E96E15 /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = C0A2723F0E509F1E00E96E15 /* NotFound.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    709711                BCD203480E17135E002C7E82 /* DatePrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePrototype.h; sourceTree = "<group>"; };
    710712                BCD203E70E1718F4002C7E82 /* DatePrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePrototype.lut.h; sourceTree = "<group>"; };
     713                BCDE3AB00E6C82CF001453A7 /* StructureID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureID.cpp; sourceTree = "<group>"; };
     714                BCDE3AB10E6C82CF001453A7 /* StructureID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureID.h; sourceTree = "<group>"; };
    711715                BCF605110E203EF800B9A64D /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArgList.cpp; sourceTree = "<group>"; };
    712716                BCF605120E203EF800B9A64D /* ArgList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgList.h; sourceTree = "<group>"; };
     
    11341138                                BC1166000E1997B1008066DD /* DateInstance.cpp */,
    11351139                                BC1166010E1997B1008066DD /* DateInstance.h */,
     1140                                D21202280AD4310C00ED79B6 /* DateMath.cpp */,
     1141                                D21202290AD4310C00ED79B6 /* DateMath.h */,
    11361142                                BCD203470E17135E002C7E82 /* DatePrototype.cpp */,
    11371143                                BCD203480E17135E002C7E82 /* DatePrototype.h */,
    1138                                 D21202280AD4310C00ED79B6 /* DateMath.cpp */,
    1139                                 D21202290AD4310C00ED79B6 /* DateMath.h */,
    11401144                                651F6412039D5B5F0078395C /* dtoa.cpp */,
    11411145                                651F6413039D5B5F0078395C /* dtoa.h */,
     
    11541158                                F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */,
    11551159                                F692A85D0255597D01FF60F7 /* FunctionPrototype.h */,
    1156                                 933A3499038AE7C6008635CE /* grammar.y */,
    11571160                                BC02E9B80E184545000F9297 /* GetterSetter.cpp */,
    11581161                                BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
    11591162                                BC257DED0E1F52ED0016B6C9 /* GlobalEvalFunction.cpp */,
    11601163                                BC257DEE0E1F52ED0016B6C9 /* GlobalEvalFunction.h */,
     1164                                933A3499038AE7C6008635CE /* grammar.y */,
    11611165                                933A349D038AE80F008635CE /* identifier.cpp */,
    11621166                                933A349A038AE7C6008635CE /* identifier.h */,
     
    11931197                                BC22A3980E16E14800AF21C8 /* JSObject.cpp */,
    11941198                                BC22A3990E16E14800AF21C8 /* JSObject.h */,
     1199                                A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */,
    11951200                                A7E42C180E3938830065A544 /* JSStaticScopeObject.h */,
    1196                                 A7E42C190E3938830065A544 /* JSStaticScopeObject.cpp */,
    11971201                                BC02E9B60E1842FA000F9297 /* JSString.cpp */,
    11981202                                F692A8620255597D01FF60F7 /* JSString.h */,
     
    12331237                                65621E6B089E859700760F35 /* PropertySlot.cpp */,
    12341238                                65621E6C089E859700760F35 /* PropertySlot.h */,
     1239                                65C02FBB0637462A003E7EE6 /* protect.h */,
    12351240                                BC257DF10E1F53740016B6C9 /* PrototypeFunction.cpp */,
    12361241                                BC257DF20E1F53740016B6C9 /* PrototypeFunction.h */,
    1237                                 65C02FBB0637462A003E7EE6 /* protect.h */,
    12381242                                F692A87D0255597D01FF60F7 /* regexp.cpp */,
    12391243                                F692A87E0255597D01FF60F7 /* regexp.h */,
     
    12581262                                BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */,
    12591263                                BC18C3C60E16EE3300B34460 /* StringPrototype.h */,
     1264                                BCDE3AB00E6C82CF001453A7 /* StructureID.cpp */,
     1265                                BCDE3AB10E6C82CF001453A7 /* StructureID.h */,
    12601266                                14A396A60CD2933100B5B4FF /* SymbolTable.h */,
    12611267                                5D53726D0E1C546B0021E549 /* Tracing.d */,
     
    15391545                                9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */,
    15401546                                933040040E6A749400786E6A /* SmallStrings.h in Headers */,
     1547                                BCDE3AB80E6C82F5001453A7 /* StructureID.h in Headers */,
    15411548                        );
    15421549                        runOnlyForDeploymentPostprocessing = 0;
     
    18461853                                95F6E6950E5B5F970091E860 /* JSProfilerPrivate.cpp in Sources */,
    18471854                                9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */,
     1855                                BCDE3B430E6C832D001453A7 /* StructureID.cpp in Sources */,
    18481856                        );
    18491857                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.