Title: [141190] trunk/Source/_javascript_Core
- Revision
- 141190
- Author
- [email protected]
- Date
- 2013-01-29 17:31:37 -0800 (Tue, 29 Jan 2013)
Log Message
Add some hardening to methodTable()
https://bugs.webkit.org/show_bug.cgi?id=108253
Reviewed by Mark Hahnenberg.
When accessing methodTable() we now always make sure that our
structure _could_ be valid. Added a separate method to get a
classes methodTable during destruction as it's not possible to
validate the structure at that point. This separation might
also make it possible to improve the performance of methodTable
access more generally in future.
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::callDestructor):
* runtime/JSCell.h:
(JSCell):
* runtime/JSCellInlines.h:
(JSC::JSCell::methodTableForDestruction):
(JSC):
(JSC::JSCell::methodTable):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (141189 => 141190)
--- trunk/Source/_javascript_Core/ChangeLog 2013-01-30 01:18:28 UTC (rev 141189)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-01-30 01:31:37 UTC (rev 141190)
@@ -1,3 +1,26 @@
+2013-01-29 Oliver Hunt <[email protected]>
+
+ Add some hardening to methodTable()
+ https://bugs.webkit.org/show_bug.cgi?id=108253
+
+ Reviewed by Mark Hahnenberg.
+
+ When accessing methodTable() we now always make sure that our
+ structure _could_ be valid. Added a separate method to get a
+ classes methodTable during destruction as it's not possible to
+ validate the structure at that point. This separation might
+ also make it possible to improve the performance of methodTable
+ access more generally in future.
+
+ * heap/MarkedBlock.cpp:
+ (JSC::MarkedBlock::callDestructor):
+ * runtime/JSCell.h:
+ (JSCell):
+ * runtime/JSCellInlines.h:
+ (JSC::JSCell::methodTableForDestruction):
+ (JSC):
+ (JSC::JSCell::methodTable):
+
2013-01-29 Filip Pizlo <[email protected]>
offlineasm BaseIndex handling is broken on ARM due to MIPS changes
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.cpp (141189 => 141190)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2013-01-30 01:18:28 UTC (rev 141189)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2013-01-30 01:31:37 UTC (rev 141190)
@@ -62,7 +62,7 @@
m_heap->m_destroyedTypeCounts.countVPtr(vptr);
#endif
- cell->methodTable()->destroy(cell);
+ cell->methodTableForDestruction()->destroy(cell);
cell->zap();
}
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (141189 => 141190)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2013-01-30 01:18:28 UTC (rev 141189)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2013-01-30 01:31:37 UTC (rev 141190)
@@ -105,6 +105,7 @@
// Object operations, with the toObject operation included.
const ClassInfo* classInfo() const;
const MethodTable* methodTable() const;
+ const MethodTable* methodTableForDestruction() const;
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (141189 => 141190)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2013-01-30 01:18:28 UTC (rev 141189)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2013-01-30 01:31:37 UTC (rev 141190)
@@ -137,8 +137,16 @@
m_structure.set(globalData, this, structure);
}
+inline const MethodTable* JSCell::methodTableForDestruction() const
+{
+ return &classInfo()->methodTable;
+}
+
inline const MethodTable* JSCell::methodTable() const
{
+ if (Structure* rootStructure = m_structure->structure())
+ RELEASE_ASSERT(rootStructure == rootStructure->structure());
+
return &classInfo()->methodTable;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes