Ignore:
Timestamp:
Sep 20, 2008, 7:29:12 PM (17 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2008-09-20 Darin Adler <Darin Adler>

Reviewed by Maciej Stachowiak.

This also includes some optimizations that make the change an overall
small speedup. Without those it was a bit of a slowdown.

  • API/JSCallbackConstructor.cpp: (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
  • API/JSCallbackConstructor.h: Ditto.
  • API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
  • API/JSCallbackObject.h: Take a structure.
  • API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject::JSCallbackObject): Ditto.
  • API/JSClassRef.cpp: (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype if there's a custom prototype involved.
  • API/JSObjectRef.cpp: (JSObjectMake): Ditto. (JSObjectMakeConstructor): Pass in a structure.
  • VM/Machine.cpp: (JSC::jsLess): Added a special case for when both arguments are strings. This avoids converting both strings to with UString::toDouble. (JSC::jsLessEq): Ditto. (JSC::Machine::privateExecute): Pass in a structure. (JSC::Machine::cti_op_construct_JSConstruct): Ditto. (JSC::Machine::cti_op_new_regexp): Ditto. (JSC::Machine::cti_op_is_string): Ditto.
  • VM/Machine.h: Made isJSString public so it can be used in the CTI.
  • kjs/Arguments.cpp: (JSC::Arguments::Arguments): Pass in a structure.
  • kjs/JSCell.h: Mark constructor explicit.
  • kjs/JSGlobalObject.cpp: (JSC::markIfNeeded): Added an overload for marking structures. (JSC::JSGlobalObject::reset): Eliminate code to set data members to zero. We now do that in the constructor, and we no longer use this anywhere except in the constructor. Added code to create structures. Pass structures rather than prototypes when creating objects. (JSC::JSGlobalObject::mark): Mark the structures.
  • kjs/JSGlobalObject.h: Removed unneeded class declarations. Added initializers for raw pointers in JSGlobalObjectData so everything starts with a 0. Added structure data and accessor functions.
  • kjs/JSImmediate.cpp: (JSC::JSImmediate::nonInlineNaN): Added.
  • kjs/JSImmediate.h: (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
  • kjs/JSNumberCell.cpp: (JSC::jsNumberCell): Made non-inline to avoid PIC branches in functions that call this one. (JSC::jsNaN): Ditto.
  • kjs/JSNumberCell.h: Ditto.
  • kjs/JSObject.h: Removed constructor that takes a prototype. All callers now pass structures.
  • kjs/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor): (JSC::constructArrayWithSizeQuirk):
  • kjs/ArrayConstructor.h:
  • kjs/ArrayPrototype.cpp: (JSC::ArrayPrototype::ArrayPrototype):
  • kjs/ArrayPrototype.h:
  • kjs/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor): (JSC::constructBoolean): (JSC::constructBooleanFromImmediateBoolean):
  • kjs/BooleanConstructor.h:
  • kjs/BooleanObject.cpp: (JSC::BooleanObject::BooleanObject):
  • kjs/BooleanObject.h:
  • kjs/BooleanPrototype.cpp: (JSC::BooleanPrototype::BooleanPrototype):
  • kjs/BooleanPrototype.h:
  • kjs/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor): (JSC::constructDate):
  • kjs/DateConstructor.h:
  • kjs/DateInstance.cpp: (JSC::DateInstance::DateInstance):
  • kjs/DateInstance.h:
  • kjs/DatePrototype.cpp: (JSC::DatePrototype::DatePrototype):
  • kjs/DatePrototype.h:
  • kjs/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor): (JSC::constructError):
  • kjs/ErrorConstructor.h:
  • kjs/ErrorInstance.cpp: (JSC::ErrorInstance::ErrorInstance):
  • kjs/ErrorInstance.h:
  • kjs/ErrorPrototype.cpp: (JSC::ErrorPrototype::ErrorPrototype):
  • kjs/ErrorPrototype.h:
  • kjs/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor):
  • kjs/FunctionConstructor.h:
  • kjs/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype): (JSC::FunctionPrototype::addFunctionProperties):
  • kjs/FunctionPrototype.h:
  • kjs/GlobalEvalFunction.cpp: (JSC::GlobalEvalFunction::GlobalEvalFunction):
  • kjs/GlobalEvalFunction.h:
  • kjs/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction):
  • kjs/InternalFunction.h: (JSC::InternalFunction::InternalFunction):
  • kjs/JSArray.cpp: (JSC::JSArray::JSArray): (JSC::constructEmptyArray): (JSC::constructArray):
  • kjs/JSArray.h:
  • kjs/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::construct):
  • kjs/JSObject.cpp: (JSC::constructEmptyObject):
  • kjs/JSString.cpp: (JSC::StringObject::create):
  • kjs/JSWrapperObject.h:
  • kjs/MathObject.cpp: (JSC::MathObject::MathObject):
  • kjs/MathObject.h:
  • kjs/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): (JSC::NativeErrorConstructor::construct):
  • kjs/NativeErrorConstructor.h:
  • kjs/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::NativeErrorPrototype):
  • kjs/NativeErrorPrototype.h:
  • kjs/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor): (JSC::constructWithNumberConstructor):
  • kjs/NumberConstructor.h:
  • kjs/NumberObject.cpp: (JSC::NumberObject::NumberObject): (JSC::constructNumber): (JSC::constructNumberFromImmediateNumber):
  • kjs/NumberObject.h:
  • kjs/NumberPrototype.cpp: (JSC::NumberPrototype::NumberPrototype):
  • kjs/NumberPrototype.h:
  • kjs/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor): (JSC::constructObject):
  • kjs/ObjectConstructor.h:
  • kjs/ObjectPrototype.cpp: (JSC::ObjectPrototype::ObjectPrototype):
  • kjs/ObjectPrototype.h:
  • kjs/PrototypeFunction.cpp: (JSC::PrototypeFunction::PrototypeFunction):
  • kjs/PrototypeFunction.h:
  • kjs/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): (JSC::RegExpMatchesArray::RegExpMatchesArray): (JSC::constructRegExp):
  • kjs/RegExpConstructor.h:
  • kjs/RegExpObject.cpp: (JSC::RegExpObject::RegExpObject):
  • kjs/RegExpObject.h:
  • kjs/RegExpPrototype.cpp: (JSC::RegExpPrototype::RegExpPrototype):
  • kjs/RegExpPrototype.h:
  • kjs/Shell.cpp: (GlobalObject::GlobalObject):
  • kjs/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): (JSC::constructWithStringConstructor):
  • kjs/StringConstructor.h:
  • kjs/StringObject.cpp: (JSC::StringObject::StringObject):
  • kjs/StringObject.h:
  • kjs/StringObjectThatMasqueradesAsUndefined.h: (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
  • kjs/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype):
  • kjs/StringPrototype.h: Take and pass structures.

WebCore:

2008-09-20 Darin Adler <Darin Adler>

Reviewed by Maciej Stachowiak.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::nameGetter): Pass in a structure ID. Note that this makes a new structure every time -- we could optimize this slightly be caching and reusing a single one.
  • bridge/runtime_method.cpp: (JSC::RuntimeMethod::RuntimeMethod): Create a unique structure using getDOMStructure.
  • bridge/runtime_method.h: (JSC::RuntimeMethod::createPrototype): Added createPrototype so getDOMStructure will work.
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::JSDOMWindowShell): Initialize m_window to 0; needed in case garbage collection happens while creating the JSDOMWindow.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSGlobalObject.h

    r36675 r36726  
    3737    class Debugger;
    3838    class ErrorConstructor;
    39     class ErrorPrototype;
    40     class EvalError;
    41     class EvalErrorPrototype;
    4239    class FunctionPrototype;
    4340    class GlobalEvalFunction;
    44     class JSGlobalObject;
    4541    class NativeErrorConstructor;
    46     class NativeErrorPrototype;
    47     class NumberPrototype;
    48     class ObjectPrototype;
    4942    class ProgramCodeBlock;
    50     class RangeError;
    51     class RangeErrorPrototype;
    52     class ReferenceError;
    53     class ReferenceError;
    54     class ReferenceErrorPrototype;
    5543    class RegExpConstructor;
    5644    class RegExpPrototype;
    5745    class RegisterFile;
    58     class RuntimeMethod;
    59     class ScopeChain;
    60     class StringPrototype;
    61     class SyntaxErrorPrototype;
    62     class TypeError;
    63     class TypeErrorPrototype;
    64     class UriError;
    65     class UriErrorPrototype;
    6646
    6747    struct ActivationStackNode;
     
    7858                : JSVariableObjectData(&symbolTable, 0)
    7959                , globalScopeChain(globalObject, thisValue)
     60                , regExpConstructor(0)
     61                , errorConstructor(0)
     62                , evalErrorConstructor(0)
     63                , rangeErrorConstructor(0)
     64                , referenceErrorConstructor(0)
     65                , syntaxErrorConstructor(0)
     66                , typeErrorConstructor(0)
     67                , URIErrorConstructor(0)
     68                , evalFunction(0)
     69                , objectPrototype(0)
     70                , functionPrototype(0)
     71                , arrayPrototype(0)
     72                , booleanPrototype(0)
     73                , stringPrototype(0)
     74                , numberPrototype(0)
     75                , datePrototype(0)
     76                , regExpPrototype(0)
    8077            {
    8178            }
     
    114111            DatePrototype* datePrototype;
    115112            RegExpPrototype* regExpPrototype;
    116             ErrorPrototype* errorPrototype;
    117             NativeErrorPrototype* evalErrorPrototype;
    118             NativeErrorPrototype* rangeErrorPrototype;
    119             NativeErrorPrototype* referenceErrorPrototype;
    120             NativeErrorPrototype* syntaxErrorPrototype;
    121             NativeErrorPrototype* typeErrorPrototype;
    122             NativeErrorPrototype* URIErrorPrototype;
    123            
     113
     114            RefPtr<StructureID> argumentsStructure;
     115            RefPtr<StructureID> arrayStructure;
     116            RefPtr<StructureID> booleanObjectStructure;
     117            RefPtr<StructureID> callbackConstructorStructure;
     118            RefPtr<StructureID> callbackFunctionStructure;
     119            RefPtr<StructureID> callbackObjectStructure;
     120            RefPtr<StructureID> dateStructure;
     121            RefPtr<StructureID> emptyObjectStructure;
     122            RefPtr<StructureID> errorStructure;
     123            RefPtr<StructureID> functionStructure;
     124            RefPtr<StructureID> numberObjectStructure;
     125            RefPtr<StructureID> prototypeFunctionStructure;
     126            RefPtr<StructureID> regExpMatchesArrayStructure;
     127            RefPtr<StructureID> regExpStructure;
     128            RefPtr<StructureID> stringObjectStructure;
     129
    124130            SymbolTable symbolTable;
    125131            unsigned profileGroup;
     
    186192        DatePrototype* datePrototype() const { return d()->datePrototype; }
    187193        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
    188         ErrorPrototype* errorPrototype() const { return d()->errorPrototype; }
    189         NativeErrorPrototype* evalErrorPrototype() const { return d()->evalErrorPrototype; }
    190         NativeErrorPrototype* rangeErrorPrototype() const { return d()->rangeErrorPrototype; }
    191         NativeErrorPrototype* referenceErrorPrototype() const { return d()->referenceErrorPrototype; }
    192         NativeErrorPrototype* syntaxErrorPrototype() const { return d()->syntaxErrorPrototype; }
    193         NativeErrorPrototype* typeErrorPrototype() const { return d()->typeErrorPrototype; }
    194         NativeErrorPrototype* URIErrorPrototype() const { return d()->URIErrorPrototype; }
     194
     195        StructureID* argumentsStructure() const { return d()->argumentsStructure.get(); }
     196        StructureID* arrayStructure() const { return d()->arrayStructure.get(); }
     197        StructureID* booleanObjectStructure() const { return d()->booleanObjectStructure.get(); }
     198        StructureID* callbackConstructorStructure() const { return d()->callbackConstructorStructure.get(); }
     199        StructureID* callbackFunctionStructure() const { return d()->callbackFunctionStructure.get(); }
     200        StructureID* callbackObjectStructure() const { return d()->callbackObjectStructure.get(); }
     201        StructureID* dateStructure() const { return d()->dateStructure.get(); }
     202        StructureID* emptyObjectStructure() const { return d()->emptyObjectStructure.get(); }
     203        StructureID* errorStructure() const { return d()->errorStructure.get(); }
     204        StructureID* functionStructure() const { return d()->functionStructure.get(); }
     205        StructureID* numberObjectStructure() const { return d()->numberObjectStructure.get(); }
     206        StructureID* prototypeFunctionStructure() const { return d()->prototypeFunctionStructure.get(); }
     207        StructureID* regExpMatchesArrayStructure() const { return d()->regExpMatchesArrayStructure.get(); }
     208        StructureID* regExpStructure() const { return d()->regExpStructure.get(); }
     209        StructureID* stringObjectStructure() const { return d()->stringObjectStructure.get(); }
    195210
    196211        void setProfileGroup(unsigned value) { d()->profileGroup = value; }
Note: See TracChangeset for help on using the changeset viewer.