Bug 747066 - Add vtable assertion (r=bz)
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 06 Dec 2012 17:11:45 -0800
changeset 115264 7f8e7625b12e48e4309673f085edcff96988fe00
parent 115263 654265a8c3cedf8ed1ca199f33604182ab2e2f01
child 115265 3877e6934b5688928b5d54ee45b29e7b9a344b03
push id23991
push useremorley@mozilla.com
push dateFri, 07 Dec 2012 14:14:29 +0000
treeherdermozilla-central@8432562db685 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs747066
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 747066 - Add vtable assertion (r=bz)
js/src/jscompartment.cpp
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -80,16 +80,20 @@ JSCompartment::JSCompartment(JSRuntime *
     watchpointMap(NULL),
     scriptCountsMap(NULL),
     debugScriptMap(NULL),
     debugScopes(NULL)
 #ifdef JS_ION
     , ionCompartment_(NULL)
 #endif
 {
+    /* Ensure that there are no vtables to mess us up here. */
+    JS_ASSERT(reinterpret_cast<JS::shadow::Compartment *>(this) ==
+              static_cast<JS::shadow::Compartment *>(this));
+
     setGCMaxMallocBytes(rt->gcMaxMallocBytes * 0.9);
 }
 
 JSCompartment::~JSCompartment()
 {
 #ifdef JS_ION
     js_delete(ionCompartment_);
 #endif