зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 903519) for frequent assertion failures on js/src/gc/Cell.h:182 a=backout
Backed out changeset e8978f3fcfbe (bug 903519) Backed out changeset 0f4234c21322 (bug 903519) Backed out changeset 741225b427a8 (bug 903519)
This commit is contained in:
Родитель
6e2787f9c5
Коммит
056a405757
|
@ -182,11 +182,7 @@ js::AllocateString(JSContext* cx, InitialHeap heap)
|
||||||
if (!rt->gc.checkAllocatorState<allowGC>(cx, kind))
|
if (!rt->gc.checkAllocatorState<allowGC>(cx, kind))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (cx->nursery().isEnabled() &&
|
if (cx->nursery().isEnabled() && heap != TenuredHeap && cx->nursery().canAllocateStrings()) {
|
||||||
heap != TenuredHeap &&
|
|
||||||
cx->nursery().canAllocateStrings() &&
|
|
||||||
cx->zone()->allocNurseryStrings)
|
|
||||||
{
|
|
||||||
auto str = static_cast<StringAllocT*>(rt->gc.tryNewNurseryString<allowGC>(cx, size, kind));
|
auto str = static_cast<StringAllocT*>(rt->gc.tryNewNurseryString<allowGC>(cx, size, kind));
|
||||||
if (str)
|
if (str)
|
||||||
return str;
|
return str;
|
||||||
|
|
|
@ -123,7 +123,7 @@ js::Nursery::Nursery(JSRuntime* rt)
|
||||||
, previousPromotionRate_(0)
|
, previousPromotionRate_(0)
|
||||||
, profileThreshold_(0)
|
, profileThreshold_(0)
|
||||||
, enableProfiling_(false)
|
, enableProfiling_(false)
|
||||||
, canAllocateStrings_(true)
|
, canAllocateStrings_(false)
|
||||||
, reportTenurings_(0)
|
, reportTenurings_(0)
|
||||||
, minorGCTriggerReason_(JS::gcreason::NO_REASON)
|
, minorGCTriggerReason_(JS::gcreason::NO_REASON)
|
||||||
, minorGcCount_(0)
|
, minorGcCount_(0)
|
||||||
|
@ -132,9 +132,9 @@ js::Nursery::Nursery(JSRuntime* rt)
|
||||||
, lastCanary_(nullptr)
|
, lastCanary_(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const char* env = getenv("MOZ_DISABLE_NURSERY_STRINGS");
|
const char* env = getenv("MOZ_ENABLE_NURSERY_STRINGS");
|
||||||
if (env && *env)
|
if (env && *env)
|
||||||
canAllocateStrings_ = false;
|
canAllocateStrings_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -738,40 +738,21 @@ js::Nursery::collect(JS::gcreason::Reason reason)
|
||||||
bool validPromotionRate;
|
bool validPromotionRate;
|
||||||
const float promotionRate = calcPromotionRate(&validPromotionRate);
|
const float promotionRate = calcPromotionRate(&validPromotionRate);
|
||||||
uint32_t pretenureCount = 0;
|
uint32_t pretenureCount = 0;
|
||||||
bool shouldPretenure = (validPromotionRate && promotionRate > 0.6) ||
|
if (validPromotionRate) {
|
||||||
IsFullStoreBufferReason(reason);
|
if (promotionRate > 0.8 || IsFullStoreBufferReason(reason)) {
|
||||||
|
JSContext* cx = TlsContext.get();
|
||||||
if (shouldPretenure) {
|
for (auto& entry : tenureCounts.entries) {
|
||||||
JSContext* cx = TlsContext.get();
|
if (entry.count >= 3000) {
|
||||||
for (auto& entry : tenureCounts.entries) {
|
ObjectGroup* group = entry.group;
|
||||||
if (entry.count >= 3000) {
|
if (group->canPreTenure() && group->zone()->group()->canEnterWithoutYielding(cx)) {
|
||||||
ObjectGroup* group = entry.group;
|
AutoCompartment ac(cx, group);
|
||||||
if (group->canPreTenure() && group->zone()->group()->canEnterWithoutYielding(cx)) {
|
group->setShouldPreTenure(cx);
|
||||||
AutoCompartment ac(cx, group);
|
pretenureCount++;
|
||||||
group->setShouldPreTenure(cx);
|
}
|
||||||
pretenureCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next()) {
|
|
||||||
if (shouldPretenure && zone->allocNurseryStrings && zone->tenuredStrings >= 30 * 1000) {
|
|
||||||
JSRuntime::AutoProhibitActiveContextChange apacc(rt);
|
|
||||||
CancelOffThreadIonCompile(zone);
|
|
||||||
bool preserving = zone->isPreservingCode();
|
|
||||||
zone->setPreservingCode(false);
|
|
||||||
zone->discardJitCode(rt->defaultFreeOp());
|
|
||||||
zone->setPreservingCode(preserving);
|
|
||||||
for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) {
|
|
||||||
if (jit::JitCompartment* jitComp = c->jitCompartment()) {
|
|
||||||
jitComp->discardStubs();
|
|
||||||
jitComp->stringsCanBeInNursery = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
zone->allocNurseryStrings = false;
|
|
||||||
}
|
|
||||||
zone->tenuredStrings = 0;
|
|
||||||
}
|
|
||||||
endProfile(ProfileKey::Pretenure);
|
endProfile(ProfileKey::Pretenure);
|
||||||
|
|
||||||
// We ignore gcMaxBytes when allocating for minor collection. However, if we
|
// We ignore gcMaxBytes when allocating for minor collection. However, if we
|
||||||
|
@ -1105,7 +1086,7 @@ js::Nursery::setStartPosition()
|
||||||
void
|
void
|
||||||
js::Nursery::maybeResizeNursery(JS::gcreason::Reason reason)
|
js::Nursery::maybeResizeNursery(JS::gcreason::Reason reason)
|
||||||
{
|
{
|
||||||
static const double GrowThreshold = 0.03;
|
static const double GrowThreshold = 0.05;
|
||||||
static const double ShrinkThreshold = 0.01;
|
static const double ShrinkThreshold = 0.01;
|
||||||
unsigned newMaxNurseryChunks;
|
unsigned newMaxNurseryChunks;
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ JS::Zone::Zone(JSRuntime* rt, ZoneGroup* group)
|
||||||
usage(&rt->gc.usage),
|
usage(&rt->gc.usage),
|
||||||
threshold(),
|
threshold(),
|
||||||
gcDelayBytes(0),
|
gcDelayBytes(0),
|
||||||
tenuredStrings(group, 0),
|
|
||||||
allocNurseryStrings(group, true),
|
|
||||||
propertyTree_(group, this),
|
propertyTree_(group, this),
|
||||||
baseShapes_(group, this),
|
baseShapes_(group, this),
|
||||||
initialShapes_(group, this),
|
initialShapes_(group, this),
|
||||||
|
|
|
@ -482,9 +482,6 @@ struct Zone : public JS::shadow::Zone,
|
||||||
// the current GC.
|
// the current GC.
|
||||||
js::UnprotectedData<size_t> gcDelayBytes;
|
js::UnprotectedData<size_t> gcDelayBytes;
|
||||||
|
|
||||||
js::ZoneGroupData<uint32_t> tenuredStrings;
|
|
||||||
js::ZoneGroupData<bool> allocNurseryStrings;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Shared Shape property tree.
|
// Shared Shape property tree.
|
||||||
js::ZoneGroupData<js::PropertyTree> propertyTree_;
|
js::ZoneGroupData<js::PropertyTree> propertyTree_;
|
||||||
|
|
|
@ -13,10 +13,8 @@ function f() {
|
||||||
{
|
{
|
||||||
for (var len of [ 3, 30, 300, 3000, 30000 ]) {
|
for (var len of [ 3, 30, 300, 3000, 30000 ]) {
|
||||||
var arr = new ctor(len);
|
var arr = new ctor(len);
|
||||||
for (var i = 0; i < arr.length; i++) {
|
for (var i = 0; i < arr.length; i++)
|
||||||
if (arr[i] != 0)
|
assertEq(arr[i], 0, "index " + i + " of " + ctor.name + " len " + len);
|
||||||
assertEq(arr[i], 0, "index " + i + " of " + ctor.name + " len " + len);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,9 +205,7 @@ CompileZone::addressOfStringNurseryCurrentEnd()
|
||||||
bool
|
bool
|
||||||
CompileZone::canNurseryAllocateStrings()
|
CompileZone::canNurseryAllocateStrings()
|
||||||
{
|
{
|
||||||
return nurseryExists() &&
|
return nurseryExists() && zone()->group()->nursery().canAllocateStrings();
|
||||||
zone()->group()->nursery().canAllocateStrings() &&
|
|
||||||
zone()->allocNurseryStrings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -610,13 +610,6 @@ class JitCompartment
|
||||||
return stringConcatStub_;
|
return stringConcatStub_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void discardStubs() {
|
|
||||||
stringConcatStub_ = nullptr;
|
|
||||||
regExpMatcherStub_ = nullptr;
|
|
||||||
regExpSearcherStub_ = nullptr;
|
|
||||||
regExpTesterStub_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
JitCode* regExpMatcherStubNoBarrier() const {
|
JitCode* regExpMatcherStubNoBarrier() const {
|
||||||
return regExpMatcherStub_;
|
return regExpMatcherStub_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9083,7 +9083,7 @@ main(int argc, char** argv, char** envp)
|
||||||
|| !op.addBoolOption('\0', "no-ggc", "Disable Generational GC")
|
|| !op.addBoolOption('\0', "no-ggc", "Disable Generational GC")
|
||||||
|| !op.addBoolOption('\0', "no-cgc", "Disable Compacting GC")
|
|| !op.addBoolOption('\0', "no-cgc", "Disable Compacting GC")
|
||||||
|| !op.addBoolOption('\0', "no-incremental-gc", "Disable Incremental GC")
|
|| !op.addBoolOption('\0', "no-incremental-gc", "Disable Incremental GC")
|
||||||
|| !op.addBoolOption('\0', "no-nursery-strings", "Do not allocate strings in the nursery")
|
|| !op.addBoolOption('\0', "nursery-strings", "Allocate strings in the nursery")
|
||||||
|| !op.addIntOption('\0', "available-memory", "SIZE",
|
|| !op.addIntOption('\0', "available-memory", "SIZE",
|
||||||
"Select GC settings based on available memory (MB)", 0)
|
"Select GC settings based on available memory (MB)", 0)
|
||||||
|| !op.addStringOption('\0', "arm-hwcap", "[features]",
|
|| !op.addStringOption('\0', "arm-hwcap", "[features]",
|
||||||
|
@ -9231,8 +9231,8 @@ main(int argc, char** argv, char** envp)
|
||||||
|
|
||||||
js::UseInternalJobQueues(cx);
|
js::UseInternalJobQueues(cx);
|
||||||
|
|
||||||
if (op.getBoolOption("no-nursery-strings"))
|
if (op.getBoolOption("nursery-strings"))
|
||||||
cx->runtime()->gc.nursery().disableStrings();
|
cx->runtime()->gc.nursery().enableStrings();
|
||||||
|
|
||||||
if (!JS::InitSelfHostedCode(cx))
|
if (!JS::InitSelfHostedCode(cx))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -219,7 +219,6 @@ GetSelectorRuntime(const CompilationSelector& selector)
|
||||||
{
|
{
|
||||||
JSRuntime* match(JSScript* script) { return script->runtimeFromActiveCooperatingThread(); }
|
JSRuntime* match(JSScript* script) { return script->runtimeFromActiveCooperatingThread(); }
|
||||||
JSRuntime* match(JSCompartment* comp) { return comp->runtimeFromActiveCooperatingThread(); }
|
JSRuntime* match(JSCompartment* comp) { return comp->runtimeFromActiveCooperatingThread(); }
|
||||||
JSRuntime* match(Zone* zone) { return zone->runtimeFromActiveCooperatingThread(); }
|
|
||||||
JSRuntime* match(ZonesInState zbs) { return zbs.runtime; }
|
JSRuntime* match(ZonesInState zbs) { return zbs.runtime; }
|
||||||
JSRuntime* match(JSRuntime* runtime) { return runtime; }
|
JSRuntime* match(JSRuntime* runtime) { return runtime; }
|
||||||
JSRuntime* match(AllCompilations all) { return nullptr; }
|
JSRuntime* match(AllCompilations all) { return nullptr; }
|
||||||
|
@ -236,7 +235,6 @@ JitDataStructuresExist(const CompilationSelector& selector)
|
||||||
{
|
{
|
||||||
bool match(JSScript* script) { return !!script->compartment()->jitCompartment(); }
|
bool match(JSScript* script) { return !!script->compartment()->jitCompartment(); }
|
||||||
bool match(JSCompartment* comp) { return !!comp->jitCompartment(); }
|
bool match(JSCompartment* comp) { return !!comp->jitCompartment(); }
|
||||||
bool match(Zone* zone) { return !!zone->jitZone(); }
|
|
||||||
bool match(ZonesInState zbs) { return zbs.runtime->hasJitRuntime(); }
|
bool match(ZonesInState zbs) { return zbs.runtime->hasJitRuntime(); }
|
||||||
bool match(JSRuntime* runtime) { return runtime->hasJitRuntime(); }
|
bool match(JSRuntime* runtime) { return runtime->hasJitRuntime(); }
|
||||||
bool match(AllCompilations all) { return true; }
|
bool match(AllCompilations all) { return true; }
|
||||||
|
@ -255,7 +253,6 @@ IonBuilderMatches(const CompilationSelector& selector, jit::IonBuilder* builder)
|
||||||
|
|
||||||
bool match(JSScript* script) { return script == builder_->script(); }
|
bool match(JSScript* script) { return script == builder_->script(); }
|
||||||
bool match(JSCompartment* comp) { return comp == builder_->script()->compartment(); }
|
bool match(JSCompartment* comp) { return comp == builder_->script()->compartment(); }
|
||||||
bool match(Zone* zone) { return zone == builder_->script()->zone(); }
|
|
||||||
bool match(JSRuntime* runtime) { return runtime == builder_->script()->runtimeFromAnyThread(); }
|
bool match(JSRuntime* runtime) { return runtime == builder_->script()->runtimeFromAnyThread(); }
|
||||||
bool match(AllCompilations all) { return true; }
|
bool match(AllCompilations all) { return true; }
|
||||||
bool match(ZonesInState zbs) {
|
bool match(ZonesInState zbs) {
|
||||||
|
|
|
@ -519,7 +519,6 @@ struct CompilationsUsingNursery { JSRuntime* runtime; };
|
||||||
|
|
||||||
using CompilationSelector = mozilla::Variant<JSScript*,
|
using CompilationSelector = mozilla::Variant<JSScript*,
|
||||||
JSCompartment*,
|
JSCompartment*,
|
||||||
Zone*,
|
|
||||||
ZonesInState,
|
ZonesInState,
|
||||||
JSRuntime*,
|
JSRuntime*,
|
||||||
CompilationsUsingNursery,
|
CompilationsUsingNursery,
|
||||||
|
@ -543,12 +542,6 @@ CancelOffThreadIonCompile(JSCompartment* comp)
|
||||||
CancelOffThreadIonCompile(CompilationSelector(comp), true);
|
CancelOffThreadIonCompile(CompilationSelector(comp), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
CancelOffThreadIonCompile(Zone* zone)
|
|
||||||
{
|
|
||||||
CancelOffThreadIonCompile(CompilationSelector(zone), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
CancelOffThreadIonCompile(JSRuntime* runtime, JS::Zone::GCState state)
|
CancelOffThreadIonCompile(JSRuntime* runtime, JS::Zone::GCState state)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче