[webkit-changes] cvs commit: JavaScriptCore/kjs object.cpp
Anders
andersca at opensource.apple.com
Fri Dec 30 01:44:51 PST 2005
andersca 05/12/30 01:44:50
Modified: . ChangeLog
kjs object.cpp
Log:
2005-12-30 Anders Carlsson <andersca at mac.com>
Reviewed by Maciej.
- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
Getter setter test is failing
* kjs/object.cpp:
(KJS::JSObject::put):
Rework the getter setter part. We now walk the prototype chain, checking for
getter/setter properties and only take the slow path if any are found.
Revision Changes Path
1.944 +12 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.943
retrieving revision 1.944
diff -u -r1.943 -r1.944
--- ChangeLog 30 Dec 2005 08:14:10 -0000 1.943
+++ ChangeLog 30 Dec 2005 09:44:47 -0000 1.944
@@ -1,3 +1,15 @@
+2005-12-30 Anders Carlsson <andersca at mac.com>
+
+ Reviewed by Maciej.
+
+ - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6298
+ Getter setter test is failing
+
+ * kjs/object.cpp:
+ (KJS::JSObject::put):
+ Rework the getter setter part. We now walk the prototype chain, checking for
+ getter/setter properties and only take the slow path if any are found.
+
2005-12-30 Maks Orlovich <maksim at kde.org>
Reviewed and committed by Maciej.
1.62 +38 -22 JavaScriptCore/kjs/object.cpp
Index: object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- object.cpp 27 Dec 2005 10:35:55 -0000 1.61
+++ object.cpp 30 Dec 2005 09:44:50 -0000 1.62
@@ -218,37 +218,53 @@
return;
}
+ // Check if there are any setters or getters in the prototype chain
JSObject *obj = this;
+ bool hasGettersOrSetters = false;
while (true) {
- JSValue *gs;
- int attributes;
- if (obj->_prop.hasGetterSetterProperties() && (gs = obj->_prop.get(propertyName, attributes))) {
- if (attributes & GetterSetter) {
- JSObject *setterFunc = static_cast<GetterSetterImp *>(gs)->getSetter();
+ if (obj->_prop.hasGetterSetterProperties()) {
+ hasGettersOrSetters = true;
+ break;
+ }
+
+ if (!obj->_proto->isObject())
+ break;
+
+ obj = static_cast<JSObject *>(obj->_proto);
+ }
+
+ if (hasGettersOrSetters) {
+ obj = this;
+ while (true) {
+ int attributes;
+ if (JSValue *gs = obj->_prop.get(propertyName, attributes)) {
+ if (attributes & GetterSetter) {
+ JSObject *setterFunc = static_cast<GetterSetterImp *>(gs)->getSetter();
+
+ if (!setterFunc) {
+ throwSetterError(exec);
+ return;
+ }
- if (!setterFunc) {
- throwSetterError(exec);
+ List args;
+ args.append(value);
+
+ setterFunc->call(exec, this, args);
return;
+ } else {
+ // If there's an existing property on the object or one of its
+ // prototype it should be replaced, so we just break here.
+ break;
}
-
- List args;
- args.append(value);
-
- setterFunc->call(exec, this, args);
- return;
- } else {
- // If there's an existing property on the object or one of its
- // prototype it should be replaced, so we just break here.
- break;
}
- }
- if (!obj->_proto->isObject())
- break;
+ if (!obj->_proto->isObject())
+ break;
- obj = static_cast<JSObject *>(obj->_proto);
+ obj = static_cast<JSObject *>(obj->_proto);
+ }
}
-
+
_prop.put(propertyName,value,attr);
}
More information about the webkit-changes
mailing list