Bug 718541 - Work around an MSVC compiler bug with inlining JSObject::nativeLookup. r=Waldo
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Thu, 26 Jan 2012 21:47:10 +0530
changeset 86710 40f3a8423c893a41232f9c88af2c33482444f837
parent 86709 8d39654512d58e9990035f3e7e60f2a4c9bbfb70
child 86711 3950aa85276d1e7f55ca445d03cf4059ada39725
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs718541
milestone12.0a1
Bug 718541 - Work around an MSVC compiler bug with inlining JSObject::nativeLookup. r=Waldo
js/src/jsobj.cpp
js/src/jsobjinlines.h
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -4069,16 +4069,30 @@ JSObject::setSlotSpan(JSContext *cx, uin
 
     if (!updateSlotsForSpan(cx, oldSpan, span))
         return false;
 
     base->setSlotSpan(span);
     return true;
 }
 
+#if defined(_MSC_VER) && _MSC_VER >= 1500
+/* Work around a compiler bug in MSVC9 and above, where inlining this function
+   causes stack pointer offsets to go awry and spp to refer to something higher
+   up the stack. */
+MOZ_NEVER_INLINE
+#endif
+const js::Shape *
+JSObject::nativeLookup(JSContext *cx, jsid id)
+{
+    JS_ASSERT(isNative());
+    js::Shape **spp;
+    return js::Shape::search(cx, lastProperty(), id, &spp);
+}
+
 bool
 JSObject::growSlots(JSContext *cx, uint32_t oldCount, uint32_t newCount)
 {
     JS_ASSERT(newCount > oldCount);
     JS_ASSERT(newCount >= SLOT_CAPACITY_MIN);
     JS_ASSERT(!isDenseArray());
 
     /*
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -1149,24 +1149,16 @@ JSObject::nativeSetSlotWithType(JSContex
 }
 
 inline bool
 JSObject::isNative() const
 {
     return lastProperty()->isNative();
 }
 
-inline const js::Shape *
-JSObject::nativeLookup(JSContext *cx, jsid id)
-{
-    JS_ASSERT(isNative());
-    js::Shape **spp;
-    return js::Shape::search(cx, lastProperty(), id, &spp);
-}
-
 inline bool
 JSObject::nativeContains(JSContext *cx, jsid id)
 {
     return nativeLookup(cx, id) != NULL;
 }
 
 inline bool
 JSObject::nativeContains(JSContext *cx, const js::Shape &shape)