RESOLVED FIXED 69390
JSC objects need to know their own cell size at runtime.
https://bugs.webkit.org/show_bug.cgi?id=69390
Summary JSC objects need to know their own cell size at runtime.
Mark Hahnenberg
Reported 2011-10-04 18:17:20 PDT
This information is necessary for the GC work that Oliver is doing. We'll add the relevant information to the ClassInfo struct.
Attachments
Patch (79.00 KB, patch)
2011-10-05 11:28 PDT, Mark Hahnenberg
no flags
Patch (3.66 KB, patch)
2011-10-05 12:07 PDT, Mark Hahnenberg
no flags
Patch (12.65 KB, patch)
2011-10-05 13:52 PDT, Mark Hahnenberg
no flags
Patch (11.94 KB, patch)
2011-10-05 14:17 PDT, Mark Hahnenberg
no flags
Fixing windows (12.92 KB, patch)
2011-10-05 19:05 PDT, Mark Hahnenberg
no flags
Mark Hahnenberg
Comment 1 2011-10-05 11:28:48 PDT
Oliver Hunt
Comment 2 2011-10-05 11:30:00 PDT
Comment on attachment 109828 [details] Patch I think a simpler approach would just be to make the method table contain this information, as CREATE_METHOD_TABLE already has the class name
Mark Hahnenberg
Comment 3 2011-10-05 11:31:26 PDT
> I think a simpler approach would just be to make the method table contain this information, as CREATE_METHOD_TABLE already has the class name :-(
Mark Hahnenberg
Comment 4 2011-10-05 12:07:28 PDT
Oliver Hunt
Comment 5 2011-10-05 12:11:01 PDT
Comment on attachment 109834 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109834&action=review > Source/JavaScriptCore/runtime/WriteBarrier.h:50 > + ASSERT(WTF::RemovePointer<T>::Type::s_info.cellSize == sizeof(typename WTF::RemovePointer<T>::Type)); This isn't a safe assertion class A { ... } class B : A { int aNewField; } validateCell<A*>(&someB) would fail this assertion as B's classinfo will (correctly) report a larger cell size than A's.
Geoffrey Garen
Comment 6 2011-10-05 12:38:27 PDT
Comment on attachment 109834 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109834&action=review > Source/JavaScriptCore/runtime/JSCell.h:66 > + size_t cellSize() const; I don't think JSCell needs this helper function. We can write classInfo()->cellSize at the call site. >> Source/JavaScriptCore/runtime/WriteBarrier.h:50 >> + ASSERT(WTF::RemovePointer<T>::Type::s_info.cellSize == sizeof(typename WTF::RemovePointer<T>::Type)); > > This isn't a safe assertion > > class A { > ... > } > > class B : A { > int aNewField; > } > > validateCell<A*>(&someB) > > would fail this assertion as B's classinfo will (correctly) report a larger cell size than A's. Maybe you can turn this ASSERT into >=? That would still catch some bugs. A better place for an ASSERT might be allocateCell<T>: ASSERT(T::s_info.cellSize == sizeof(T)).
Oliver Hunt
Comment 7 2011-10-05 12:41:50 PDT
(In reply to comment #6) > (From update of attachment 109834 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=109834&action=review > > > Source/JavaScriptCore/runtime/JSCell.h:66 > > + size_t cellSize() const; > > I don't think JSCell needs this helper function. We can write classInfo()->cellSize at the call site. > > >> Source/JavaScriptCore/runtime/WriteBarrier.h:50 > >> + ASSERT(WTF::RemovePointer<T>::Type::s_info.cellSize == sizeof(typename WTF::RemovePointer<T>::Type)); > > > > This isn't a safe assertion > > > > class A { > > ... > > } > > > > class B : A { > > int aNewField; > > } > > > > validateCell<A*>(&someB) > > > > would fail this assertion as B's classinfo will (correctly) report a larger cell size than A's. > > Maybe you can turn this ASSERT into >=? That would still catch some bugs. > > A better place for an ASSERT might be allocateCell<T>: ASSERT(T::s_info.cellSize == sizeof(T)). Yeah i spoke to mark and that's what he's doing :D
Mark Hahnenberg
Comment 8 2011-10-05 13:52:10 PDT
Geoffrey Garen
Comment 9 2011-10-05 13:56:25 PDT
Comment on attachment 109855 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=109855&action=review > Source/JavaScriptCore/runtime/JSObject.h:494 > +inline size_t JSCell::cellSize() const > +{ > + return classInfo()->cellSize; > +} This function is unused. I still think it can be inlined at the call site when used.
Mark Hahnenberg
Comment 10 2011-10-05 14:17:18 PDT
Geoffrey Garen
Comment 11 2011-10-05 14:22:06 PDT
Comment on attachment 109860 [details] Patch r=me
Mark Hahnenberg
Comment 12 2011-10-05 19:05:00 PDT
Created attachment 109904 [details] Fixing windows
Geoffrey Garen
Comment 13 2011-10-05 19:06:38 PDT
Comment on attachment 109904 [details] Fixing windows r=me
WebKit Review Bot
Comment 14 2011-10-06 10:41:58 PDT
Comment on attachment 109904 [details] Fixing windows Clearing flags on attachment: 109904 Committed r96831: <http://trac.webkit.org/changeset/96831>
WebKit Review Bot
Comment 15 2011-10-06 10:42:02 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.