From 970ae9ee4f0ec40f26f0ec5d70be51f9a0750527 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Fri, 22 Mar 2013 11:23:10 +0100 Subject: [PATCH] Bug 853394 - Enable ParallelArray tests, fix test failures. r=djvj --- js/src/ion/BaselineIC.cpp | 28 ++++++++++++++++++++++++++++ js/src/jsinfer.cpp | 4 +++- js/src/vm/SelfHosting.cpp | 4 ---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/js/src/ion/BaselineIC.cpp b/js/src/ion/BaselineIC.cpp index e2fbfd0e1fa..0587291abfe 100644 --- a/js/src/ion/BaselineIC.cpp +++ b/js/src/ion/BaselineIC.cpp @@ -5351,6 +5351,9 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, JSO if (!calleeScript->hasBaselineScript() && !calleeScript->hasIonScript()) return true; + if (calleeScript->shouldCloneAtCallsite) + return true; + // Check if this stub chain has already generalized scripted calls. if (stub->scriptedStubsAreGeneralized()) { IonSpew(IonSpew_BaselineIC, " Chain already has generalized scripted call stub!"); @@ -5415,6 +5418,28 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, JSO return true; } +static bool +MaybeCloneFunctionAtCallsite(JSContext *cx, MutableHandleValue callee, HandleScript script, + jsbytecode *pc) +{ + RootedFunction fun(cx); + if (!IsFunctionObject(callee, fun.address())) + return true; + + if (!fun->hasScript() || !fun->nonLazyScript()->shouldCloneAtCallsite) + return true; + + if (!cx->typeInferenceEnabled()) + return true; + + fun = CloneFunctionAtCallsite(cx, fun, script, pc); + if (!fun) + return false; + + callee.setObject(*fun); + return true; +} + static bool DoCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub, uint32_t argc, Value *vp, MutableHandleValue res) @@ -5450,6 +5475,9 @@ DoCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub, uint3 if (!TryAttachCallStub(cx, stub, script, op, argc, vp, constructing, newType)) return false; + if (!MaybeCloneFunctionAtCallsite(cx, &callee, script, pc)) + return false; + if (op == JSOP_NEW) { if (!InvokeConstructor(cx, callee, argc, args, res.address())) return false; diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 2d9e0dfee67..cbeb66d0a55 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -25,6 +25,7 @@ #include "jsworkers.h" #ifdef JS_ION +#include "ion/BaselineJIT.h" #include "ion/Ion.h" #include "ion/IonCompartment.h" #endif @@ -2910,7 +2911,8 @@ TypeCompartment::addPendingRecompile(JSContext *cx, RawScript script, jsbytecode CancelOffThreadIonCompile(cx->compartment, script); // Let the script warm up again before attempting another compile. - script->resetUseCount(); + if (ion::IsBaselineEnabled(cx)) + script->resetUseCount(); if (script->hasIonScript()) addPendingRecompile(cx, script->ionScript()->recompileInfo()); diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index bbdb9274206..78c9c26d449 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -402,11 +402,7 @@ js::intrinsic_UnsafeSetElement(JSContext *cx, unsigned argc, Value *vp) static JSBool intrinsic_ParallelTestsShouldPass(JSContext *cx, unsigned argc, Value *vp) { - //XXX: FIXME: disable parallel array tests for now on the BC branch. CallArgs args = CallArgsFromVp(argc, vp); - args.rval().setBoolean(false); - return true; - #if defined(JS_THREADSAFE) && defined(JS_ION) args.rval().setBoolean(ion::IsEnabled(cx) && !ion::js_IonOptions.eagerCompilation);