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


Ignore:
Timestamp:
Dec 25, 2007, 2:54:10 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Oliver.



1.3% speedup on SunSpider.


  • kjs/object.cpp: (KJS::JSObject::put): Don't do canPut check when not needed; let the PropertyMap handle it. (KJS::JSObject::canPut): Don't check the static property table. lookupPut does that already.
File:
1 edited

Legend:

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

    r28884 r28980  
    227227  // Assume that a C++ implementation knows what it is doing
    228228  // and let it override the canPut() check.
    229   if ((attr == None || attr == DontDelete) && !canPut(exec,propertyName)) {
    230     return;
    231   }
    232 
     229  bool checkReadOnly = !(attr & (ReadOnly | DontEnum | Internal | Function | GetterSetter));
    233230  // Check if there are any setters or getters in the prototype chain
    234231  JSObject *obj = this;
     
    247244 
    248245  if (hasGettersOrSetters) {
     246    if (checkReadOnly && !canPut(exec,propertyName)) {
     247      return;
     248    }
     249
    249250    obj = this;
    250251    while (true) {
     
    278279  }
    279280 
    280   _prop.put(propertyName,value,attr);
     281  _prop.put(propertyName, value, attr, checkReadOnly);
    281282}
    282283
     
    294295  // Don't look in the prototype here. We can always put an override
    295296  // in the object, even if the prototype has a ReadOnly property.
    296 
    297   if (!getPropertyAttributes(propertyName, attributes))
     297  // Also, there is no need to check the static property table, as this
     298  // would have been done by the subclass already.
     299
     300  if (!_prop.get(propertyName, attributes))
    298301    return true;
    299   else
    300     return !(attributes & ReadOnly);
     302
     303  return !(attributes & ReadOnly);
    301304}
    302305
Note: See TracChangeset for help on using the changeset viewer.