+2007-12-25 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - Remove unnecessary redundant check from property setting
+ http://bugs.webkit.org/show_bug.cgi?id=16602
+
+ 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.
+
2007-12-24 Alp Toker <alp@atoker.com>
Fix builds that don't use AllInOneFile.cpp following breakage
// putValue() is used for JS assignemnts. It passes no attribute.
// Assume that a C++ implementation knows what it is doing
// and let it override the canPut() check.
- if ((attr == None || attr == DontDelete) && !canPut(exec,propertyName)) {
- return;
- }
-
+ bool checkReadOnly = !(attr & (ReadOnly | DontEnum | Internal | Function | GetterSetter));
// Check if there are any setters or getters in the prototype chain
JSObject *obj = this;
bool hasGettersOrSetters = false;
}
if (hasGettersOrSetters) {
+ if (checkReadOnly && !canPut(exec,propertyName)) {
+ return;
+ }
+
obj = this;
while (true) {
unsigned attributes;
}
}
- _prop.put(propertyName,value,attr);
+ _prop.put(propertyName, value, attr, checkReadOnly);
}
void JSObject::put(ExecState *exec, unsigned propertyName,
// Don't look in the prototype here. We can always put an override
// in the object, even if the prototype has a ReadOnly property.
+ // Also, there is no need to check the static property table, as this
+ // would have been done by the subclass already.
- if (!getPropertyAttributes(propertyName, attributes))
+ if (!_prop.get(propertyName, attributes))
return true;
- else
- return !(attributes & ReadOnly);
+
+ return !(attributes & ReadOnly);
}
// ECMA 8.6.2.4