Ignore:
Timestamp:
Mar 18, 2007, 10:43:47 PM (18 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Mark.


  • avoid static construction (and global variable access) in a smarter, more portable way, to later enable MUTLI_THREAD mode to work on other platforms and compilers.


  • kjs/CommonIdentifiers.cpp: Added. New class to hold all the shared identifiers. (KJS::CommonIdentifiers::CommonIdentifiers): (KJS::CommonIdentifiers::shared):
  • kjs/CommonIdentifiers.h: Added.
  • kjs/ExecState.h: (KJS::ExecState::propertyNames): Hand the CommonIdentifiers instance here for easy access. (KJS::ExecState::ExecState):
  • API/JSObjectRef.cpp: (JSObjectMakeConstructor):
  • CMakeLists.txt:
  • JavaScriptCore.exp:
  • JavaScriptCore.pri:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • JavaScriptCoreSources.bkl:
  • bindings/runtime_array.cpp: (RuntimeArray::getOwnPropertySlot): (RuntimeArray::put):
  • bindings/runtime_method.cpp: (RuntimeMethod::getOwnPropertySlot):
  • kjs/array_object.cpp: (ArrayInstance::getOwnPropertySlot): (ArrayInstance::put): (ArrayInstance::deleteProperty): (ArrayProtoFunc::ArrayProtoFunc): (ArrayProtoFunc::callAsFunction): (ArrayObjectImp::ArrayObjectImp):
  • kjs/bool_object.cpp: (BooleanPrototype::BooleanPrototype): (BooleanProtoFunc::BooleanProtoFunc): (BooleanProtoFunc::callAsFunction): (BooleanObjectImp::BooleanObjectImp):
  • kjs/completion.h: (KJS::Completion::Completion):
  • kjs/date_object.cpp: (KJS::DateProtoFunc::DateProtoFunc): (KJS::DateObjectImp::DateObjectImp): (KJS::DateObjectFuncImp::DateObjectFuncImp):
  • kjs/error_object.cpp: (ErrorPrototype::ErrorPrototype): (ErrorProtoFunc::ErrorProtoFunc): (ErrorProtoFunc::callAsFunction): (ErrorObjectImp::ErrorObjectImp): (ErrorObjectImp::construct): (NativeErrorPrototype::NativeErrorPrototype): (NativeErrorImp::NativeErrorImp): (NativeErrorImp::construct): (NativeErrorImp::callAsFunction):
  • kjs/function.cpp: (KJS::FunctionImp::getOwnPropertySlot): (KJS::FunctionImp::put): (KJS::FunctionImp::deleteProperty): (KJS::FunctionImp::getParameterName): (KJS::DeclaredFunctionImp::construct): (KJS::IndexToNameMap::unMap): (KJS::Arguments::Arguments): (KJS::ActivationImp::getOwnPropertySlot): (KJS::ActivationImp::deleteProperty): (KJS::GlobalFuncImp::GlobalFuncImp):
  • kjs/function_object.cpp: (FunctionPrototype::FunctionPrototype): (FunctionProtoFunc::FunctionProtoFunc): (FunctionProtoFunc::callAsFunction): (FunctionObjectImp::FunctionObjectImp): (FunctionObjectImp::construct):
  • kjs/grammar.y:
  • kjs/identifier.cpp:
  • kjs/identifier.h:
  • kjs/interpreter.cpp: (KJS::Interpreter::init): (KJS::Interpreter::initGlobalObject):
  • kjs/interpreter.h:
  • kjs/lookup.h:
  • kjs/math_object.cpp: (MathFuncImp::MathFuncImp):
  • kjs/nodes.cpp: (ArrayNode::evaluate): (FuncDeclNode::processFuncDecl): (FuncExprNode::evaluate):
  • kjs/number_object.cpp: (NumberPrototype::NumberPrototype): (NumberProtoFunc::NumberProtoFunc): (NumberObjectImp::NumberObjectImp):
  • kjs/object.cpp: (KJS::JSObject::put): (KJS::JSObject::defaultValue): (KJS::JSObject::hasInstance):
  • kjs/object.h: (KJS::JSObject::getOwnPropertySlot):
  • kjs/object_object.cpp: (ObjectPrototype::ObjectPrototype): (ObjectProtoFunc::ObjectProtoFunc): (ObjectObjectImp::ObjectObjectImp):
  • kjs/regexp_object.cpp: (RegExpPrototype::RegExpPrototype): (RegExpProtoFunc::RegExpProtoFunc): (RegExpObjectImp::RegExpObjectImp):
  • kjs/string_object.cpp: (KJS::StringInstance::getOwnPropertySlot): (KJS::StringInstance::put): (KJS::StringInstance::deleteProperty): (KJS::StringPrototype::StringPrototype): (KJS::StringProtoFunc::StringProtoFunc): (KJS::StringProtoFunc::callAsFunction): (KJS::StringObjectImp::StringObjectImp): (KJS::StringObjectFuncImp::StringObjectFuncImp):
  • kjs/testkjs.cpp: (TestFunctionImp::TestFunctionImp):

WebCore:

Reviewed by Mark.

  • avoid static construction (and global variable access) in a smarter, more portable way, to later enable MUTLI_THREAD mode to work on other platforms and compilers.


  • bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
  • bindings/js/JSHTMLInputElementBase.cpp: (WebCore::JSHTMLInputElementBaseFunction::JSHTMLInputElementBaseFunction):
  • bindings/js/JSHTMLOptionElementConstructor.cpp: (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
  • bindings/js/JSXMLHttpRequest.cpp: (KJS::JSXMLHttpRequestConstructorImp::JSXMLHttpRequestConstructorImp):
  • bindings/js/JSXSLTProcessor.cpp: (KJS::XSLTProcessorConstructorImp::XSLTProcessorConstructorImp):
  • bindings/js/kjs_dom.cpp: (KJS::DOMNamedNodeMap::getOwnPropertySlot): (KJS::DOMNamedNodesCollection::getOwnPropertySlot):
  • bindings/js/kjs_events.cpp: (KJS::JSAbstractEventListener::handleEvent):
  • bindings/js/kjs_html.cpp: (KJS::HTMLElementFunction::HTMLElementFunction): (KJS::JSHTMLCollection::getOwnPropertySlot):
  • bindings/js/kjs_window.cpp: (KJS::ScheduledAction::execute):
  • bindings/objc/WebScriptObject.mm:
  • bindings/scripts/CodeGeneratorJS.pm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.cpp

    r20304 r20310  
    263263{
    264264    // Find the arguments from the closest context.
    265     if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier()) {
     265    if (propertyName == exec->propertyNames().arguments) {
    266266        slot.setCustom(this, argumentsGetter);
    267267        return true;
     
    269269
    270270    // Compute length of parameters.
    271     if (propertyName == lengthPropertyName) {
     271    if (propertyName == exec->propertyNames().length) {
    272272        slot.setCustom(this, lengthGetter);
    273273        return true;
    274274    }
    275275
    276     if (propertyName == callerPropertyName) {
     276    if (propertyName == exec->propertyNames().caller) {
    277277        slot.setCustom(this, callerGetter);
    278278        return true;
     
    284284void FunctionImp::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
    285285{
    286     if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier() || propertyName == lengthPropertyName)
     286    if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length)
    287287        return;
    288288    InternalFunctionImp::put(exec, propertyName, value, attr);
     
    291291bool FunctionImp::deleteProperty(ExecState* exec, const Identifier& propertyName)
    292292{
    293     if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier() || propertyName == lengthPropertyName)
     293    if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length)
    294294        return false;
    295295    return InternalFunctionImp::deleteProperty(exec, propertyName);
     
    306306{
    307307    if (!parameters)
    308         return Identifier::null();
     308        return CommonIdentifiers::shared()->nullIdentifier;
    309309
    310310    if (static_cast<size_t>(index) >= parameters->size())
    311         return Identifier::null();
     311        return CommonIdentifiers::shared()->nullIdentifier;
    312312 
    313313    Identifier name = parameters->at(index).name;
     
    316316    for (size_t i = index + 1; i < parameters->size(); ++i)
    317317        if (parameters->at(i).name == name)
    318             return Identifier::null();
     318            return CommonIdentifiers::shared()->nullIdentifier;
    319319
    320320    return name;
     
    342342{
    343343  JSObject* proto;
    344   JSValue* p = get(exec,prototypePropertyName);
     344  JSValue* p = get(exec, exec->propertyNames().prototype);
    345345  if (p->isObject())
    346346    proto = static_cast<JSObject*>(p);
     
    422422  assert(indexIsNumber && indexAsNumber < size);
    423423 
    424   _map[indexAsNumber] = Identifier::null();
     424  _map[indexAsNumber] = CommonIdentifiers::shared()->nullIdentifier;
    425425}
    426426
     
    450450indexToNameMap(func, args)
    451451{
    452   putDirect(calleePropertyName, func, DontEnum);
    453   putDirect(lengthPropertyName, args.size(), DontEnum);
     452  putDirect(exec->propertyNames().callee, func, DontEnum);
     453  putDirect(exec->propertyNames().length, args.size(), DontEnum);
    454454 
    455455  int i = 0;
     
    543543    }
    544544
    545     if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier()) {
     545    if (propertyName == exec->propertyNames().arguments) {
    546546        slot.setCustom(this, getArgumentsGetter());
    547547        return true;
     
    553553bool ActivationImp::deleteProperty(ExecState* exec, const Identifier& propertyName)
    554554{
    555     if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier())
     555    if (propertyName == exec->propertyNames().arguments)
    556556        return false;
    557557    return JSObject::deleteProperty(exec, propertyName);
     
    585585
    586586
    587 GlobalFuncImp::GlobalFuncImp(ExecState*, FunctionPrototype* funcProto, int i, int len, const Identifier& name)
     587GlobalFuncImp::GlobalFuncImp(ExecState* exec, FunctionPrototype* funcProto, int i, int len, const Identifier& name)
    588588  : InternalFunctionImp(funcProto, name)
    589589  , id(i)
    590590{
    591   putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
     591  putDirect(exec->propertyNames().length, len, DontDelete|ReadOnly|DontEnum);
    592592}
    593593
Note: See TracChangeset for help on using the changeset viewer.