diff --git a/js/src/jit-test/tests/jaeger/recompile/bug647183.js b/js/src/jit-test/tests/jaeger/recompile/bug647183.js new file mode 100644 index 00000000000..0405a548a45 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/recompile/bug647183.js @@ -0,0 +1,23 @@ +var SECTION = ""; +var VERSION = ""; +function test() {} +function writeTestCaseResult( expect, actual, string ) { + if (typeof document != "object" || +!document.location.href.match(/jsreftest.html/)) { + } +} +TIME_0000 = now = new Date; +TIME_NOW = now.valueOf(); +function DaysInYear( y ) { +function MakeDate( day, time ) { + +} +} +function TimeClip( t ) { + if ( isNaN ) { Number.NaN; } +} +function runDSTOffsetCachingTestsFraction(part, parts) { print; }; +test_times=( TIME_NOW, TIME_0000, ( SECTION, VERSION+".getUTCMinutes()", + TIME_NOW.test_times,VERSION.SECTION ) , TIME_0000, TIME_0000, + 0, 0 ); +try { j = 0( SECTION, TimeClip(1.1), 0 ); } catch (e) {} diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index fb81a7761b7..c306478f92f 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -1762,13 +1762,20 @@ ic::GetProp(VMFrame &f, ic::PICInfo *pic) atom = f.cx->runtime->atomState.lengthAtom; } + bool usePropCache = pic->usePropCache; + + /* + * ValueToObject can trigger recompilations if it lazily initializes any + * of the primitive classes (Boolean, Number, String). :XXX: if these + * classes are made eager then this monitoring is not necessary. + */ + RecompilationMonitor monitor(f.cx); + JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]); if (!obj) THROW(); - bool usePropCache = pic->usePropCache; - - if (pic->shouldUpdate(f.cx)) { + if (!monitor.recompiled() && pic->shouldUpdate(f.cx)) { VoidStubPIC stub = pic->usePropCache ? DisabledGetPropIC : DisabledGetPropICNoCache; @@ -1824,10 +1831,6 @@ DisabledSetPropICNoCache(VMFrame &f, ic::PICInfo *pic) void JS_FASTCALL ic::SetProp(VMFrame &f, ic::PICInfo *pic) { - JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-2]); - if (!obj) - THROW(); - JSScript *script = f.fp()->script(); JS_ASSERT(pic->isSet()); @@ -1841,15 +1844,15 @@ ic::SetProp(VMFrame &f, ic::PICInfo *pic) ? STRICT_VARIANT(stubs::SetName) : STRICT_VARIANT(stubs::SetPropNoCache); - // - // Important: We update the PIC before looking up the property so that the - // PIC is updated only if the property already exists. The PIC doesn't try - // to optimize adding new properties; that is for the slow case. - // - // Also note, we can't use SetName for PROPINC PICs because the property - // cache can't handle a GET and SET from the same scripted PC. - if (pic->shouldUpdate(f.cx)) { + RecompilationMonitor monitor(f.cx); + JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-2]); + if (!obj) + THROW(); + + // Note, we can't use SetName for PROPINC PICs because the property + // cache can't handle a GET and SET from the same scripted PC. + if (!monitor.recompiled() && pic->shouldUpdate(f.cx)) { SetPropCompiler cc(f, script, obj, *pic, atom, stub); LookupStatus status = cc.update(); if (status == Lookup_Error) @@ -2533,12 +2536,14 @@ ic::GetElement(VMFrame &f, ic::GetElementIC *ic) return; } + Value idval = f.regs.sp[-1]; + + RecompilationMonitor monitor(cx); + JSObject *obj = ValueToObject(cx, &f.regs.sp[-2]); if (!obj) THROW(); - Value idval = f.regs.sp[-1]; - jsid id; if (idval.isInt32() && INT_FITS_IN_JSID(idval.toInt32())) { id = INT_TO_JSID(idval.toInt32()); @@ -2547,7 +2552,7 @@ ic::GetElement(VMFrame &f, ic::GetElementIC *ic) THROW(); } - if (ic->shouldUpdate(cx)) { + if (!monitor.recompiled() && ic->shouldUpdate(cx)) { #ifdef DEBUG f.regs.sp[-2] = MagicValue(JS_GENERIC_MAGIC); #endif