Fix AssertValidPropertyCacheHit when called from JIT stubs, bug 717251. r=dvander
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 12 Jan 2012 08:41:09 -0800
changeset 85577 d7abb1f2efc8f9a84f83b609020b5ca8c61928dd
parent 85576 c75c08fdf2c3f2132b0d4cce7f92f895de9b749c
child 85578 b3b6bca8a02a3d34dd02491e2b5e84c73ce8f8b2
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)
reviewersdvander
bugs717251
milestone12.0a1
Fix AssertValidPropertyCacheHit when called from JIT stubs, bug 717251. r=dvander
js/src/jsinterp.cpp
js/src/jsopcodeinlines.h
js/src/jspropertycache.cpp
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -78,16 +78,17 @@
 #include "methodjit/Logging.h"
 #endif
 #include "vm/Debugger.h"
 
 #include "jsatominlines.h"
 #include "jsinferinlines.h"
 #include "jsinterpinlines.h"
 #include "jsobjinlines.h"
+#include "jsopcodeinlines.h"
 #include "jsprobes.h"
 #include "jspropertycacheinlines.h"
 #include "jsscopeinlines.h"
 #include "jsscriptinlines.h"
 #include "jstypedarrayinlines.h"
 
 #include "vm/Stack-inl.h"
 #include "vm/String-inl.h"
@@ -1260,31 +1261,30 @@ inline InterpreterFrames::~InterpreterFr
 }
 
 #if defined(DEBUG) && !defined(JS_THREADSAFE)
 void
 js::AssertValidPropertyCacheHit(JSContext *cx,
                                 JSObject *start, JSObject *found,
                                 PropertyCacheEntry *entry)
 {
-    JSScript *script = cx->fp()->script();
-    FrameRegs& regs = cx->regs();
+    jsbytecode *pc;
+    cx->stack.currentScript(&pc);
 
     uint32_t sample = cx->runtime->gcNumber;
     PropertyCacheEntry savedEntry = *entry;
 
-    PropertyName *name;
-    GET_NAME_FROM_BYTECODE(script, regs.pc, 0, name);
+    PropertyName *name = GetNameFromBytecode(cx, pc, JSOp(*pc), js_CodeSpec[*pc]);
 
     JSObject *obj, *pobj;
     JSProperty *prop;
     JSBool ok;
 
-    if (JOF_OPMODE(*regs.pc) == JOF_NAME) {
-        bool global = js_CodeSpec[*regs.pc].format & JOF_GNAME;
+    if (JOF_OPMODE(*pc) == JOF_NAME) {
+        bool global = js_CodeSpec[*pc].format & JOF_GNAME;
         ok = FindProperty(cx, name, global, &obj, &pobj, &prop);
     } else {
         obj = start;
         ok = LookupProperty(cx, obj, name, &pobj, &prop);
     }
     JS_ASSERT(ok);
 
     if (cx->runtime->gcNumber != sample)
--- a/js/src/jsopcodeinlines.h
+++ b/js/src/jsopcodeinlines.h
@@ -37,16 +37,34 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "jsautooplen.h"
 
 #include "frontend/BytecodeEmitter.h"
 
 namespace js {
 
+static inline PropertyName *
+GetNameFromBytecode(JSContext *cx, jsbytecode *pc, JSOp op, const JSCodeSpec &cs)
+{
+    if (op == JSOP_LENGTH)
+        return cx->runtime->atomState.lengthAtom;
+
+    // The method JIT's implementation of instanceof contains an internal lookup
+    // of the prototype property.
+    if (op == JSOP_INSTANCEOF)
+        return cx->runtime->atomState.classPrototypeAtom;
+
+    JSScript *script = cx->stack.currentScript();
+    ptrdiff_t pcoff = (JOF_TYPE(cs.format) == JOF_SLOTATOM) ? SLOTNO_LEN : 0;
+    PropertyName *name;
+    GET_NAME_FROM_BYTECODE(script, pc, pcoff, name);
+    return name;
+}
+
 class BytecodeRange {
   public:
     BytecodeRange(JSScript *script)
       : script(script), pc(script->code), end(pc + script->length) {}
     bool empty() const { return pc == end; }
     jsbytecode *frontPC() const { return pc; }
     JSOp frontOpcode() const { return JSOp(*pc); }
     size_t frontOffset() const { return pc - script->code; }
--- a/js/src/jspropertycache.cpp
+++ b/js/src/jspropertycache.cpp
@@ -37,16 +37,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "jspropertycache.h"
 #include "jscntxt.h"
 #include "jsnum.h"
 #include "jsobjinlines.h"
+#include "jsopcodeinlines.h"
 #include "jspropertycacheinlines.h"
 
 using namespace js;
 
 PropertyCacheEntry *
 PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, JSObject *pobj,
                     const Shape *shape)
 {
@@ -153,34 +154,16 @@ PropertyCache::fill(JSContext *cx, JSObj
      * The modfills counter is not exact. It increases if a getter or setter
      * recurse into the interpreter.
      */
     PCMETER(entry == pctestentry || modfills++);
     PCMETER(pctestentry = NULL);
     return entry;
 }
 
-static inline PropertyName *
-GetNameFromBytecode(JSContext *cx, jsbytecode *pc, JSOp op, const JSCodeSpec &cs)
-{
-    if (op == JSOP_LENGTH)
-        return cx->runtime->atomState.lengthAtom;
-
-    // The method JIT's implementation of instanceof contains an internal lookup
-    // of the prototype property.
-    if (op == JSOP_INSTANCEOF)
-        return cx->runtime->atomState.classPrototypeAtom;
-
-    JSScript *script = cx->stack.currentScript();
-    ptrdiff_t pcoff = (JOF_TYPE(cs.format) == JOF_SLOTATOM) ? SLOTNO_LEN : 0;
-    PropertyName *name;
-    GET_NAME_FROM_BYTECODE(script, pc, pcoff, name);
-    return name;
-}
-
 PropertyName *
 PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject **pobjp,
                         PropertyCacheEntry *entry)
 {
     JSObject *obj, *pobj, *tmp;
 #ifdef DEBUG
     JSScript *script = cx->stack.currentScript();
 #endif