Ignore:
Timestamp:
Aug 13, 2006, 8:06:14 PM (19 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed (and tweaked a little) by Maciej.


  • shrank the size of JSObject by 8 bytes and made the corresponding reduction to the cell size, resulting in a 1.2% speed improvement on JS iBench (and probably overall memory savings).

This was done by removing _scope and _internalValue data members
from JSObject and moving them only to the subclasses that actually
make use of them.


  • kjs/object.cpp: (KJS::JSObject::mark): No need to mark scope or internal value here.
  • kjs/object.h: (KJS::JSObject::JSObject): Don't initialize them.
  • kjs/JSWrapperObject.cpp: Added. New base class for object types that wrap primitive values (Number, String, Boolean, Date). (KJS::JSWrapperObject::mark):
  • kjs/JSWrapperObject.h: Added. (KJS::JSWrapperObject::JSWrapperObject): (KJS::JSWrapperObject::internalValue): (KJS::JSWrapperObject::setInternalValue):
  • kjs/array_object.cpp: (ArrayPrototype::ArrayPrototype): Don't set useless internal value.
  • kjs/bool_object.cpp: (BooleanInstance::BooleanInstance): Inherit from JSWrapperObject. (BooleanProtoFunc::callAsFunction): Fixed to account for fact that not all JSObjects have an internal value. (BooleanObjectImp::construct): ditto.
  • kjs/bool_object.h:
  • kjs/collector.cpp: Lowered cell size to 48. (KJS::Collector::allocate): meaningless whitespace change
  • kjs/date_object.cpp: (KJS::DateInstance::DateInstance): Inherit from JSWrapperObject. (KJS::DateProtoFunc::callAsFunction): adjusted for move of internalValue (KJS::DateObjectImp::construct): ditto
  • kjs/date_object.h:
  • kjs/error_object.cpp: (ErrorPrototype::ErrorPrototype): don't set internal value
  • kjs/function.cpp: move _scope and related handling here (KJS::FunctionImp::mark): mark scope
  • kjs/function.h: (KJS::FunctionImp::scope): moved here from JSObject (KJS::FunctionImp::setScope): ditto
  • kjs/number_object.cpp: (NumberInstance::NumberInstance): inherit from JSWrapperObject (NumberProtoFunc::callAsFunction): adjusted (NumberObjectImp::construct): adjusted
  • kjs/number_object.h: shring RegExp-related objects a little
  • kjs/regexp_object.cpp: (RegExpPrototype::RegExpPrototype): Adjust for size tweaks (RegExpObjectImp::RegExpObjectImp): ditto
  • kjs/regexp_object.h:
  • kjs/string_object.cpp: (StringInstance::StringInstance): inherit from JSWrapperObject (StringProtoFunc::callAsFunction): adjusted
  • kjs/string_object.h:
  • JavaScriptCore.exp: Exported new methods as needed.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added new files to build.

WebCore:

Reviewed (and tweaked a little) by Maciej.


  • shrank the size of JSObject by 8 bytes and made the corresponding reduction to the cell size, resulting in a 1.2% speed improvement on JS iBench (and probably overall memory savings).

The WebCore part of this is to expect only FunctionImp to have a scope, not all JSObjects.


  • bindings/js/kjs_events.cpp: (KJS::JSLazyEventListener::parseCode):
File:
1 edited

Legend:

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

    r15799 r15846  
    9696                65B174F809D100FA00820339 /* string_object.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B174F409D100FA00820339 /* string_object.lut.h */; };
    9797                65C647B4093EF8D60022C380 /* RefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C647B3093EF8D60022C380 /* RefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
     98                65C7A1730A8EAACB00FA37EA /* JSWrapperObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */; };
     99                65C7A1740A8EAACB00FA37EA /* JSWrapperObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    98100                65D6D87F09B5A32E0002E4D7 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D6D87E09B5A32E0002E4D7 /* Platform.h */; settings = {ATTRIBUTES = (Private, ); }; };
    99101                65D7D19C08F10B5B0015ABD8 /* FastMallocInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */; };
     
    444446                65C02FBB0637462A003E7EE6 /* protect.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = protect.h; sourceTree = "<group>"; tabWidth = 8; };
    445447                65C647B3093EF8D60022C380 /* RefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; tabWidth = 8; };
     448                65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSWrapperObject.cpp; sourceTree = "<group>"; };
     449                65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSWrapperObject.h; sourceTree = "<group>"; };
    446450                65D6D87E09B5A32E0002E4D7 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
    447451                65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = FastMallocInternal.h; sourceTree = "<group>"; tabWidth = 8; };
     
    826830                        isa = PBXGroup;
    827831                        children = (
     832                                65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */,
     833                                65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */,
    828834                                65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */,
    829835                                65400C100A69BAF200509887 /* PropertyNameArray.h */,
     
    11121118                                65400C120A69BAF200509887 /* PropertyNameArray.h in Headers */,
    11131119                                1CAF34890A6C421700ABE06E /* WebScriptObject.h in Headers */,
     1120                                65C7A1740A8EAACB00FA37EA /* JSWrapperObject.h in Headers */,
    11141121                        );
    11151122                        runOnlyForDeploymentPostprocessing = 0;
     
    13971404                                1421359B0A677F4F00A8195E /* JSBase.cpp in Sources */,
    13981405                                65400C110A69BAF200509887 /* PropertyNameArray.cpp in Sources */,
     1406                                65C7A1730A8EAACB00FA37EA /* JSWrapperObject.cpp in Sources */,
    13991407                        );
    14001408                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.