Loading js/src/jsapi.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -7107,17 +7107,25 @@ JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency) frequency = p ? atoi(p + 1) : JS_DEFAULT_ZEAL_FREQ; } JSRuntime *rt = cx->runtime; if (zeal == 0) { if (cx->runtime->gcVerifyPreData) VerifyBarriers(cx->runtime, PreBarrierVerifier); if (cx->runtime->gcVerifyPostData) VerifyBarriers(cx->runtime, PostBarrierVerifier); if (rt->gcVerifyPreData) VerifyBarriers(rt, PreBarrierVerifier); if (rt->gcVerifyPostData) VerifyBarriers(rt, PostBarrierVerifier); } bool schedule = zeal >= js::gc::ZealAllocValue; cx->runtime->gcZeal_ = zeal; cx->runtime->gcZealFrequency = frequency; cx->runtime->gcNextScheduled = schedule ? frequency : 0; rt->gcZeal_ = zeal; rt->gcZealFrequency = frequency; rt->gcNextScheduled = schedule ? frequency : 0; #ifdef JS_METHODJIT /* In case JSCompartment::compileBarriers() changed... */ for (CompartmentsIter c(rt); !c.done(); c.next()) mjit::ClearAllFrames(c); #endif } JS_PUBLIC_API(void) Loading js/src/jscompartment.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ void JSCompartment::setNeedsBarrier(bool needs) { #ifdef JS_METHODJIT if (needsBarrier_ != needs) /* ClearAllFrames calls compileBarriers() and needs the old value. */ bool old = compileBarriers(); if (compileBarriers(needs) != old) mjit::ClearAllFrames(this); #endif needsBarrier_ = needs; Loading js/src/jscompartment.h +8 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,14 @@ struct JSCompartment return needsBarrier_; } bool compileBarriers(bool needsBarrier) const { return needsBarrier || rt->gcZeal() == js::gc::ZealVerifierPreValue; } bool compileBarriers() const { return compileBarriers(needsBarrier()); } void setNeedsBarrier(bool needs); js::GCMarker *barrierTracer() { Loading js/src/jsinferinlines.h +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ struct AutoEnterCompilation CompilerOutput co; co.script = script; co.constructing = constructing; co.barriers = cx->compartment->needsBarrier(); co.barriers = cx->compartment->compileBarriers(); co.chunkIndex = chunkIndex; // This flag is used to prevent adding the current compiled script in Loading js/src/methodjit/Compiler.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ mjit::Compiler::compile() if (status != Compile_Okay && status != Compile_Retry) { if (!outerScript->ensureHasMJITInfo(cx)) return Compile_Error; JSScript::JITScriptHandle *jith = outerScript->jitHandle(isConstructing, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = outerScript->jitHandle(isConstructing, cx->compartment->compileBarriers()); JSScript::ReleaseCode(cx->runtime->defaultFreeOp(), jith); jith->setUnjittable(); Loading Loading @@ -942,7 +942,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, return Compile_Skipped; if (script->hasMJITInfo()) { JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->compileBarriers()); if (jith->isUnjittable()) return Compile_Abort; } Loading @@ -967,7 +967,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, if (!script->ensureHasMJITInfo(cx)) return Compile_Error; JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->compileBarriers()); JITScript *jit; if (jith->isEmpty()) { Loading @@ -975,7 +975,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, if (!jit) return Compile_Error; // Script analysis can trigger GC, watch in case needsBarrier() changed. // Script analysis can trigger GC, watch in case compileBarriers() changed. if (gcNumber != cx->runtime->gcNumber) { FreeOp *fop = cx->runtime->defaultFreeOp(); jit->destroy(fop); Loading Loading @@ -5444,7 +5444,7 @@ mjit::Compiler::jsop_setprop(PropertyName *name, bool popGuaranteed) if (!isObject) notObject = frame.testObject(Assembler::NotEqual, lhs); #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier() && propertyTypes->needsBarrier(cx)) { if (cx->compartment->compileBarriers() && propertyTypes->needsBarrier(cx)) { /* Write barrier. */ Jump j = masm.testGCThing(Address(reg, JSObject::getFixedSlotOffset(slot))); stubcc.linkExit(j, Uses(0)); Loading Loading @@ -5477,7 +5477,7 @@ mjit::Compiler::jsop_setprop(PropertyName *name, bool popGuaranteed) #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. We don't have type information for JSOP_SETNAME. */ if (cx->compartment->needsBarrier() && if (cx->compartment->compileBarriers() && (!types || JSOp(*PC) == JSOP_SETNAME || types->propertyNeedsBarrier(cx, id))) { jsop_setprop_slow(name); Loading Loading @@ -5845,7 +5845,7 @@ mjit::Compiler::jsop_aliasedArg(unsigned arg, bool get, bool poppedAfter) frame.push(Address(reg), type, true /* = reuseBase */); } else { #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { /* Write barrier. */ stubcc.linkExit(masm.testGCThing(Address(reg)), Uses(0)); stubcc.leave(); Loading Loading @@ -5888,7 +5888,7 @@ mjit::Compiler::jsop_aliasedVar(ScopeCoordinate sc, bool get, bool poppedAfter) finishBarrier(barrier, REJOIN_FALLTHROUGH, 0); } else { #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { /* Write barrier. */ stubcc.linkExit(masm.testGCThing(addr), Uses(0)); stubcc.leave(); Loading Loading @@ -6035,7 +6035,7 @@ mjit::Compiler::iter(unsigned flags) * Write barrier for stores to the iterator. We only need to take a write * barrier if NativeIterator::obj is actually going to change. */ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { Jump j = masm.branchPtr(Assembler::NotEqual, Address(nireg, offsetof(NativeIterator, obj)), reg); stubcc.linkExit(j, Uses(1)); Loading Loading @@ -6418,7 +6418,7 @@ mjit::Compiler::jsop_setgname(PropertyName *name, bool popGuaranteed) RegisterID reg = frame.allocReg(); #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. */ if (cx->compartment->needsBarrier() && types->needsBarrier(cx)) { if (cx->compartment->compileBarriers() && types->needsBarrier(cx)) { stubcc.linkExit(masm.jump(), Uses(0)); stubcc.leave(); stubcc.masm.move(ImmPtr(value), Registers::ArgReg1); Loading @@ -6436,7 +6436,7 @@ mjit::Compiler::jsop_setgname(PropertyName *name, bool popGuaranteed) #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. */ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { jsop_setgname_slow(name); return true; } Loading Loading
js/src/jsapi.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -7107,17 +7107,25 @@ JS_SetGCZeal(JSContext *cx, uint8_t zeal, uint32_t frequency) frequency = p ? atoi(p + 1) : JS_DEFAULT_ZEAL_FREQ; } JSRuntime *rt = cx->runtime; if (zeal == 0) { if (cx->runtime->gcVerifyPreData) VerifyBarriers(cx->runtime, PreBarrierVerifier); if (cx->runtime->gcVerifyPostData) VerifyBarriers(cx->runtime, PostBarrierVerifier); if (rt->gcVerifyPreData) VerifyBarriers(rt, PreBarrierVerifier); if (rt->gcVerifyPostData) VerifyBarriers(rt, PostBarrierVerifier); } bool schedule = zeal >= js::gc::ZealAllocValue; cx->runtime->gcZeal_ = zeal; cx->runtime->gcZealFrequency = frequency; cx->runtime->gcNextScheduled = schedule ? frequency : 0; rt->gcZeal_ = zeal; rt->gcZealFrequency = frequency; rt->gcNextScheduled = schedule ? frequency : 0; #ifdef JS_METHODJIT /* In case JSCompartment::compileBarriers() changed... */ for (CompartmentsIter c(rt); !c.done(); c.next()) mjit::ClearAllFrames(c); #endif } JS_PUBLIC_API(void) Loading
js/src/jscompartment.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ void JSCompartment::setNeedsBarrier(bool needs) { #ifdef JS_METHODJIT if (needsBarrier_ != needs) /* ClearAllFrames calls compileBarriers() and needs the old value. */ bool old = compileBarriers(); if (compileBarriers(needs) != old) mjit::ClearAllFrames(this); #endif needsBarrier_ = needs; Loading
js/src/jscompartment.h +8 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,14 @@ struct JSCompartment return needsBarrier_; } bool compileBarriers(bool needsBarrier) const { return needsBarrier || rt->gcZeal() == js::gc::ZealVerifierPreValue; } bool compileBarriers() const { return compileBarriers(needsBarrier()); } void setNeedsBarrier(bool needs); js::GCMarker *barrierTracer() { Loading
js/src/jsinferinlines.h +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ struct AutoEnterCompilation CompilerOutput co; co.script = script; co.constructing = constructing; co.barriers = cx->compartment->needsBarrier(); co.barriers = cx->compartment->compileBarriers(); co.chunkIndex = chunkIndex; // This flag is used to prevent adding the current compiled script in Loading
js/src/methodjit/Compiler.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ mjit::Compiler::compile() if (status != Compile_Okay && status != Compile_Retry) { if (!outerScript->ensureHasMJITInfo(cx)) return Compile_Error; JSScript::JITScriptHandle *jith = outerScript->jitHandle(isConstructing, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = outerScript->jitHandle(isConstructing, cx->compartment->compileBarriers()); JSScript::ReleaseCode(cx->runtime->defaultFreeOp(), jith); jith->setUnjittable(); Loading Loading @@ -942,7 +942,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, return Compile_Skipped; if (script->hasMJITInfo()) { JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->compileBarriers()); if (jith->isUnjittable()) return Compile_Abort; } Loading @@ -967,7 +967,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, if (!script->ensureHasMJITInfo(cx)) return Compile_Error; JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->needsBarrier()); JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->compileBarriers()); JITScript *jit; if (jith->isEmpty()) { Loading @@ -975,7 +975,7 @@ mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc, if (!jit) return Compile_Error; // Script analysis can trigger GC, watch in case needsBarrier() changed. // Script analysis can trigger GC, watch in case compileBarriers() changed. if (gcNumber != cx->runtime->gcNumber) { FreeOp *fop = cx->runtime->defaultFreeOp(); jit->destroy(fop); Loading Loading @@ -5444,7 +5444,7 @@ mjit::Compiler::jsop_setprop(PropertyName *name, bool popGuaranteed) if (!isObject) notObject = frame.testObject(Assembler::NotEqual, lhs); #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier() && propertyTypes->needsBarrier(cx)) { if (cx->compartment->compileBarriers() && propertyTypes->needsBarrier(cx)) { /* Write barrier. */ Jump j = masm.testGCThing(Address(reg, JSObject::getFixedSlotOffset(slot))); stubcc.linkExit(j, Uses(0)); Loading Loading @@ -5477,7 +5477,7 @@ mjit::Compiler::jsop_setprop(PropertyName *name, bool popGuaranteed) #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. We don't have type information for JSOP_SETNAME. */ if (cx->compartment->needsBarrier() && if (cx->compartment->compileBarriers() && (!types || JSOp(*PC) == JSOP_SETNAME || types->propertyNeedsBarrier(cx, id))) { jsop_setprop_slow(name); Loading Loading @@ -5845,7 +5845,7 @@ mjit::Compiler::jsop_aliasedArg(unsigned arg, bool get, bool poppedAfter) frame.push(Address(reg), type, true /* = reuseBase */); } else { #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { /* Write barrier. */ stubcc.linkExit(masm.testGCThing(Address(reg)), Uses(0)); stubcc.leave(); Loading Loading @@ -5888,7 +5888,7 @@ mjit::Compiler::jsop_aliasedVar(ScopeCoordinate sc, bool get, bool poppedAfter) finishBarrier(barrier, REJOIN_FALLTHROUGH, 0); } else { #ifdef JSGC_INCREMENTAL_MJ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { /* Write barrier. */ stubcc.linkExit(masm.testGCThing(addr), Uses(0)); stubcc.leave(); Loading Loading @@ -6035,7 +6035,7 @@ mjit::Compiler::iter(unsigned flags) * Write barrier for stores to the iterator. We only need to take a write * barrier if NativeIterator::obj is actually going to change. */ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { Jump j = masm.branchPtr(Assembler::NotEqual, Address(nireg, offsetof(NativeIterator, obj)), reg); stubcc.linkExit(j, Uses(1)); Loading Loading @@ -6418,7 +6418,7 @@ mjit::Compiler::jsop_setgname(PropertyName *name, bool popGuaranteed) RegisterID reg = frame.allocReg(); #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. */ if (cx->compartment->needsBarrier() && types->needsBarrier(cx)) { if (cx->compartment->compileBarriers() && types->needsBarrier(cx)) { stubcc.linkExit(masm.jump(), Uses(0)); stubcc.leave(); stubcc.masm.move(ImmPtr(value), Registers::ArgReg1); Loading @@ -6436,7 +6436,7 @@ mjit::Compiler::jsop_setgname(PropertyName *name, bool popGuaranteed) #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. */ if (cx->compartment->needsBarrier()) { if (cx->compartment->compileBarriers()) { jsop_setgname_slow(name); return true; } Loading