+2004-12-07 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3908017> REGRESSION (172-173): assertion in ObjectImp::construct trying to create JS error (24hourfitness.com)
+
+ The fix was to implement copy constructor and assignment operator,
+ the ones that worked on the base class did not replace the
+ defaults apparently!
+
+ * kjs/protect.h:
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+
+ Also fixed a bug in the GC test mode that compares the results of
+ the old collector and the new collector.
+
+ * kjs/value.cpp:
+ (ValueImp::mark):
+
=== Safari-173 ===
2004-11-23 Richard Williamson <rjw@apple.com>
public:
ProtectedValue() : Value() {}
ProtectedValue(const Value&v) : Value(v) { gcProtectNullTolerant(v.imp()); };
+ ProtectedValue(const ProtectedValue&v) : Value(v) { gcProtectNullTolerant(v.imp()); };
~ProtectedValue() { gcUnprotectNullTolerant(imp());}
ProtectedValue& operator=(const Value &v)
{
gcUnprotectNullTolerant(old);
return *this;
}
+ ProtectedValue& operator=(const ProtectedValue &v)
+ {
+ ValueImp *old = imp();
+ Value::operator=(v);
+ gcProtectNullTolerant(v.imp());
+ gcUnprotectNullTolerant(old);
+ return *this;
+ }
private:
explicit ProtectedValue(ValueImp *v);
};
class ProtectedObject : public Object {
public:
ProtectedObject() : Object() {}
- ProtectedObject(const Object&o) : Object(o) { gcProtectNullTolerant(o.imp()); };
+ ProtectedObject(const Object &o) : Object(o) { gcProtectNullTolerant(o.imp()); };
+ ProtectedObject(const ProtectedObject &o) : Object(o) { gcProtectNullTolerant(o.imp()); };
~ProtectedObject() { gcUnprotectNullTolerant(imp());}
ProtectedObject& operator=(const Object &o)
{
gcUnprotectNullTolerant(old);
return *this;
}
+ ProtectedObject& operator=(const ProtectedObject &o)
+ {
+ ValueImp *old = imp();
+ Object::operator=(o);
+ gcProtectNullTolerant(o.imp());
+ gcUnprotectNullTolerant(old);
+ return *this;
+ }
private:
explicit ProtectedObject(ObjectImp *o);
};
if (conservativeMark) {
_flags |= VI_CONSERVATIVE_MARKED;
} else {
- if (!(_flags | VI_CONSERVATIVE_MARKED)) {
- printf("Conservative collector missed ValueImp 0x%x.\n", (int)this);
+ if (!(_flags & VI_CONSERVATIVE_MARKED)) {
+ printf("Conservative collector missed ValueImp 0x%x. refcount %d, protect count %d\n", (int)this, refcount, ProtectedValues::getProtectCount(this));
}
_flags |= VI_MARKED;
}