Changeset 30534 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
Feb 23, 2008, 9:01:27 PM (17 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

Reviewed by Anders.

  • API/JSCallbackObject.h: Removed attribute arguments.
  • API/JSCallbackObjectFunctions.h: (KJS::JSCallbackObject<Base>::put): Ditto.
  • API/JSObjectRef.cpp: (JSObjectSetProperty): Use initializeVariable or putDirect when necessary to set attribute values.
  • JavaScriptCore.exp: Updated.
  • bindings/objc/objc_runtime.h: Removed attribute arguments.
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::put): Ditto.
  • bindings/runtime_array.cpp: (RuntimeArray::put): Ditto.
  • bindings/runtime_array.h: Ditto.
  • bindings/runtime_object.cpp: (RuntimeObjectImp::put): Ditto.
  • bindings/runtime_object.h: Ditto. Also removed canPut which was only called from one place in WebCore that can use hasProperty instead.
  • kjs/Activation.h: Removed attribute argument from put and added the new initializeVariable function that's used to put variables in variable objects. Also made isActivationObject a const member.
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::put): Removed attribute argument. (KJS::JSGlobalObject::initializeVariable): Added. Used to give variables their initial values, which can include the read-only property. (KJS::JSGlobalObject::reset): Removed obsolete comments about flags. Removed Internal flag, which is no longer needed.
  • kjs/JSGlobalObject.h: More of the same.
  • kjs/JSVariableObject.h: Added pure virtual initializeVariable function. (KJS::JSVariableObject::symbolTablePut): Removed checkReadOnly flag; we always check read-only. (KJS::JSVariableObject::symbolTableInitializeVariable): Added.
  • kjs/array_instance.cpp: (KJS::ArrayInstance::put): Removed attribute argument.
  • kjs/array_instance.h: Ditto.
  • kjs/function.cpp: (KJS::FunctionImp::put): Ditto. (KJS::Arguments::put): Ditto. (KJS::ActivationImp::put): Ditto. (KJS::ActivationImp::initializeVariable): Added.
  • kjs/function.h: Removed attribute arguments.
  • kjs/function_object.cpp: (KJS::FunctionObjectImp::construct): Removed Internal flag.
  • kjs/lookup.h: (KJS::lookupPut): Removed attributes argument. Also changed to use putDirect instead of calling JSObject::put. (KJS::cacheGlobalObject): Ditto.
  • kjs/nodes.cpp: (KJS::ConstDeclNode::handleSlowCase): Call initializeVariable to initialize the constant. (KJS::ConstDeclNode::evaluateSingle): Ditto. (KJS::TryNode::execute): Use putDirect to set up the new object. (KJS::FunctionBodyNode::processDeclarations): Removed Internal. (KJS::ProgramNode::processDeclarations): Ditto. (KJS::EvalNode::processDeclarations): Call initializeVariable to initialize the variables and functions. (KJS::FuncDeclNode::makeFunction): Removed Internal. (KJS::FuncExprNode::evaluate): Ditto.
  • kjs/object.cpp: Removed canPut, which was only being used in one code path, not the normal high speed one. (KJS::JSObject::put): Removed attribute argument. Moved the logic from canPut here, in the one code ath that was still using it.
  • kjs/object.h: Removed Internal attribute, ad canPut function. Removed the attributes argument to the put function. Made isActivationObject const.
  • kjs/regexp_object.cpp: (KJS::RegExpImp::put): Removed attributes argument. (KJS::RegExpImp::putValueProperty): Ditto. (KJS::RegExpObjectImp::put): Ditto. (KJS::RegExpObjectImp::putValueProperty): Ditto.
  • kjs/regexp_object.h: Ditto.
  • kjs/string_object.cpp: (KJS::StringInstance::put): Removed attributes argument.
  • kjs/string_object.h: Ditto.

WebCore:

Reviewed by Anders.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::customPut): Remove attributes argument.
  • bindings/js/JSCanvasPixelArrayCustom.cpp: (WebCore::JSCanvasPixelArray::indexGetter): Use early exit idiom. (WebCore::JSCanvasPixelArray::indexSetter): Moved length check into the CanvasPixelArray object, for consistency with the getter. Removed attributes argument.
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::customPut): Removed special case for variable initialization, which is not needed since that does use put any more. Removed attributes argument.
  • bindings/js/JSEventTargetBase.h: (WebCore::JSEventTargetBase::putValueProperty): Removed attributes argument. (WebCore::JSEventTargetBase::put): Ditto. (WebCore::JSEventTargetPrototype::self): Removed Internal flag.
  • bindings/js/JSEventTargetNode.cpp: (WebCore::JSEventTargetNode::put): Removed attributes argument. (WebCore::JSEventTargetNode::putValueProperty): Ditto.
  • bindings/js/JSEventTargetNode.h: Ditto.
  • bindings/js/JSHTMLAppletElementCustom.cpp: (WebCore::JSHTMLAppletElement::customPut): Ditto.
  • bindings/js/JSHTMLEmbedElementCustom.cpp: (WebCore::JSHTMLEmbedElement::customPut): Ditto.
  • bindings/js/JSHTMLInputElementBase.cpp: (WebCore::JSHTMLInputElementBase::put): Ditto. (WebCore::JSHTMLInputElementBase::putValueProperty): Ditto.
  • bindings/js/JSHTMLInputElementBase.h: Ditto.
  • bindings/js/JSHTMLObjectElementCustom.cpp: (WebCore::JSHTMLObjectElement::customPut): Ditto.
  • bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::indexSetter): Ditto.
  • bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::JSHTMLSelectElement::indexSetter): Ditto.
  • bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::customPut): Ditto.
  • bindings/js/JSLocation.cpp: (WebCore::JSLocation::put): Ditto.
  • bindings/js/JSLocation.h: Ditto.
  • bindings/js/JSXMLHttpRequest.cpp: (WebCore::JSXMLHttpRequest::put): Ditto. (WebCore::JSXMLHttpRequest::putValueProperty): Ditto.
  • bindings/js/JSXMLHttpRequest.h: Ditto.
  • bindings/js/kjs_dom.cpp: (WebCore::getRuntimeObject): Changed return type to JSObject*.
  • bindings/js/kjs_dom.h: Ditto.
  • bindings/js/kjs_events.cpp: (WebCore::JSClipboard::put): Removed attributes argument. (WebCore::JSClipboard::putValueProperty): Ditto.
  • bindings/js/kjs_events.h: Ditto.
  • bindings/js/kjs_html.cpp: (WebCore::runtimeObjectGetter): Updated for change to getRuntimeObject to return a JSObject. Used early exit idiom. (WebCore::runtimeObjectPropertyGetter): Ditto. (WebCore::runtimeObjectCustomGetOwnPropertySlot): Ditto. (WebCore::runtimeObjectCustomPut): Use hasProperty to check for properties that we should put with the property syntax instead of canPut. (WebCore::runtimeObjectImplementsCall): Ditto. (WebCore::runtimeObjectCallAsFunction): Ditto.
  • bindings/js/kjs_html.h: Removed attributes argument to runtimeObjectCustomPut.
  • bindings/js/kjs_window.cpp: (KJS::Window::put): Removed attributes argument.
  • bindings/js/kjs_window.h: Ditto.
  • bindings/scripts/CodeGeneratorJS.pm: Removed attributes argument from put, putValueProperty, customPut, and indexSetter.
  • html/CanvasPixelArray.h: (WebCore::CanvasPixelArray::set): Added index checking here, as in the get function. Before, the checking was done in the JavaScript bindings for set.
File:
1 edited

Legend:

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

    r29818 r30534  
    205205
    206206// ECMA 8.6.2.2
    207 void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *value, int attr)
     207void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *value)
    208208{
    209209  ASSERT(value);
     
    220220    return;
    221221  }
    222 
    223   // The put calls from JavaScript execution either have no attributes set, or in some cases
    224   // have DontDelete set. For those calls, respect the ReadOnly flag.
    225   bool checkReadOnly = !(attr & ~DontDelete);
    226222
    227223  // Check if there are any setters or getters in the prototype chain
     
    241237 
    242238  if (hasGettersOrSetters) {
    243     if (checkReadOnly && !canPut(exec, propertyName))
    244       return;
     239    unsigned attributes;
     240    if (_prop.get(propertyName, attributes) && attributes & ReadOnly)
     241        return;
    245242
    246243    obj = this;
    247244    while (true) {
    248       unsigned attributes;
    249245      if (JSValue *gs = obj->_prop.get(propertyName, attributes)) {
    250246        if (attributes & GetterSetter) {
     
    275271  }
    276272 
    277   _prop.put(propertyName, value, attr, checkReadOnly);
    278 }
    279 
    280 void JSObject::put(ExecState *exec, unsigned propertyName,
    281                      JSValue *value, int attr)
    282 {
    283   put(exec, Identifier::from(propertyName), value, attr);
    284 }
    285 
    286 // ECMA 8.6.2.3
    287 bool JSObject::canPut(ExecState *, const Identifier &propertyName) const
    288 {
    289   unsigned attributes;
    290    
    291   // Don't look in the prototype here. We can always put an override
    292   // in the object, even if the prototype has a ReadOnly property.
    293   // Also, there is no need to check the static property table, as this
    294   // would have been done by the subclass already.
    295 
    296   if (!_prop.get(propertyName, attributes))
    297     return true;
    298 
    299   return !(attributes & ReadOnly);
     273  _prop.put(propertyName, value, 0, true);
     274}
     275
     276void JSObject::put(ExecState* exec, unsigned propertyName, JSValue* value)
     277{
     278    put(exec, Identifier::from(propertyName), value);
    300279}
    301280
Note: See TracChangeset for help on using the changeset viewer.