Backed out changeset c115f0bb2bfb (bug 1465505) spidermonkey bustages. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-06-19 06:48:03 +03:00
parent 226317dc08
commit c3828af488
10 changed files with 27 additions and 47 deletions

View File

@ -7,8 +7,6 @@
#ifndef js_SliceBudget_h
#define js_SliceBudget_h
#include "mozilla/TimeStamp.h"
#include <stdint.h>
#include "jstypes.h"
@ -37,7 +35,7 @@ struct JS_PUBLIC_API(WorkBudget)
*/
class JS_PUBLIC_API(SliceBudget)
{
static const mozilla::TimeStamp unlimitedDeadline;
static const int64_t unlimitedDeadline = INT64_MAX;
static const intptr_t unlimitedStartCounter = INTPTR_MAX;
bool checkOverBudget();
@ -51,7 +49,7 @@ class JS_PUBLIC_API(SliceBudget)
TimeBudget timeBudget;
WorkBudget workBudget;
mozilla::TimeStamp deadline;
int64_t deadline; /* in microseconds */
intptr_t counter;
static const intptr_t CounterReset = 1000;
@ -83,8 +81,8 @@ class JS_PUBLIC_API(SliceBudget)
return checkOverBudget();
}
bool isWorkBudget() const { return deadline.IsNull(); }
bool isTimeBudget() const { return !deadline.IsNull() && !isUnlimited(); }
bool isWorkBudget() const { return deadline == 0; }
bool isTimeBudget() const { return deadline > 0 && !isUnlimited(); }
bool isUnlimited() const { return deadline == unlimitedDeadline; }
int describe(char* buffer, size_t maxlen) const;

View File

@ -303,7 +303,7 @@ namespace TuningDefaults {
static const bool DynamicHeapGrowthEnabled = false;
/* JSGC_HIGH_FREQUENCY_TIME_LIMIT */
static const auto HighFrequencyThresholdUsec = mozilla::TimeDuration::FromMicroseconds(1000000);
static const uint64_t HighFrequencyThresholdUsec = 1000000;
/* JSGC_HIGH_FREQUENCY_LOW_LIMIT */
static const uint64_t HighFrequencyLowLimitBytes = 100 * 1024 * 1024;
@ -344,8 +344,6 @@ namespace TuningDefaults {
}}} // namespace js::gc::TuningDefaults
static const auto ONE_SECOND = mozilla::TimeDuration::FromSeconds(1);
/*
* We start to incremental collection for a zone when a proportion of its
* threshold is reached. This is configured by the
@ -955,7 +953,7 @@ GCRuntime::GCRuntime(JSRuntime* rt) :
numArenasFreeCommitted(0),
verifyPreData(nullptr),
chunkAllocationSinceLastGC(false),
lastGCTime(mozilla::TimeStamp::Now()),
lastGCTime(PRMJ_Now()),
mode(TuningDefaults::Mode),
numActiveZoneIters(0),
cleanUpEverything(false),
@ -1416,7 +1414,7 @@ GCSchedulingTunables::setParameter(JSGCParamKey key, uint32_t value, const AutoL
gcMaxNurseryBytes_ = value;
break;
case JSGC_HIGH_FREQUENCY_TIME_LIMIT:
highFrequencyThresholdUsec_ = mozilla::TimeDuration::FromMilliseconds(value);
highFrequencyThresholdUsec_ = value * PRMJ_USEC_PER_MSEC;
break;
case JSGC_HIGH_FREQUENCY_LOW_LIMIT: {
uint64_t newLimit = (uint64_t)value * 1024 * 1024;
@ -1700,7 +1698,7 @@ GCRuntime::getParameter(JSGCParamKey key, const AutoLockGC& lock)
case JSGC_MARK_STACK_LIMIT:
return marker.maxCapacity();
case JSGC_HIGH_FREQUENCY_TIME_LIMIT:
return tunables.highFrequencyThresholdUsec().ToMilliseconds();
return tunables.highFrequencyThresholdUsec() / PRMJ_USEC_PER_MSEC;
case JSGC_HIGH_FREQUENCY_LOW_LIMIT:
return tunables.highFrequencyLowLimitBytes() / 1024 / 1024;
case JSGC_HIGH_FREQUENCY_HIGH_LIMIT:
@ -2144,7 +2142,7 @@ GCRuntime::shouldCompact()
return true;
}
return !isIncremental || rt->lastAnimationTime.ref() + ONE_SECOND < mozilla::TimeStamp::Now();
return !isIncremental || rt->lastAnimationTime + PRMJ_USEC_PER_SEC < PRMJ_Now();
}
bool
@ -3260,7 +3258,7 @@ SliceBudget::SliceBudget(TimeBudget time)
makeUnlimited();
} else {
// Note: TimeBudget(0) is equivalent to WorkBudget(CounterReset).
deadline = mozilla::TimeStamp::Now() + mozilla::TimeDuration::FromMilliseconds(time.budget);
deadline = PRMJ_Now() + time.budget * PRMJ_USEC_PER_MSEC;
counter = CounterReset;
}
}
@ -3271,7 +3269,7 @@ SliceBudget::SliceBudget(WorkBudget work)
if (work.budget < 0) {
makeUnlimited();
} else {
deadline = mozilla::TimeStamp();
deadline = 0;
counter = work.budget;
}
}
@ -3290,7 +3288,7 @@ SliceBudget::describe(char* buffer, size_t maxlen) const
bool
SliceBudget::checkOverBudget()
{
bool over = mozilla::TimeStamp::Now() >= deadline;
bool over = PRMJ_Now() >= deadline;
if (!over)
counter = CounterReset;
return over;
@ -4092,10 +4090,9 @@ GCRuntime::purgeRuntime()
}
bool
GCRuntime::shouldPreserveJITCode(Realm* realm, const mozilla::TimeStamp &currentTime,
GCRuntime::shouldPreserveJITCode(Realm* realm, int64_t currentTime,
JS::gcreason::Reason reason, bool canAllocateMoreCode)
{
if (cleanUpEverything)
return false;
if (!canAllocateMoreCode)
@ -4105,7 +4102,7 @@ GCRuntime::shouldPreserveJITCode(Realm* realm, const mozilla::TimeStamp &current
return true;
if (realm->preserveJitCode())
return true;
if (realm->lastAnimationTime.ref() + ONE_SECOND >= currentTime)
if (realm->lastAnimationTime + PRMJ_USEC_PER_SEC >= currentTime)
return true;
if (reason == JS::gcreason::DEBUG_GC)
return true;
@ -4281,7 +4278,7 @@ GCRuntime::prepareZonesForCollection(JS::gcreason::Reason reason, bool* isFullOu
*isFullOut = true;
bool any = false;
auto currentTime = mozilla::TimeStamp::Now();
int64_t currentTime = PRMJ_Now();
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
/* Set up which zones will be collected. */
@ -6836,7 +6833,7 @@ GCRuntime::finishCollection()
marker.stop();
clearBufferedGrayRoots();
auto currentTime = mozilla::TimeStamp::Now();
uint64_t currentTime = PRMJ_Now();
schedulingState.updateHighFrequencyMode(lastGCTime, currentTime, tunables);
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {

View File

@ -10,7 +10,6 @@
#include "mozilla/Atomics.h"
#include "mozilla/EnumSet.h"
#include "mozilla/Maybe.h"
#include "mozilla/TimeStamp.h"
#include "gc/ArenaList.h"
#include "gc/AtomMarking.h"
@ -568,7 +567,7 @@ class GCRuntime
MOZ_MUST_USE bool beginMarkPhase(JS::gcreason::Reason reason, AutoTraceSession& session);
bool prepareZonesForCollection(JS::gcreason::Reason reason, bool* isFullOut,
AutoLockForExclusiveAccess& lock);
bool shouldPreserveJITCode(JS::Realm* realm, const mozilla::TimeStamp &currentTime,
bool shouldPreserveJITCode(JS::Realm* realm, int64_t currentTime,
JS::gcreason::Reason reason, bool canAllocateMoreCode);
void traceRuntimeForMajorGC(JSTracer* trc, AutoTraceSession& session);
void traceRuntimeAtoms(JSTracer* trc, AutoLockForExclusiveAccess& lock);
@ -716,7 +715,7 @@ class GCRuntime
private:
UnprotectedData<bool> chunkAllocationSinceLastGC;
MainThreadData<mozilla::TimeStamp> lastGCTime;
MainThreadData<int64_t> lastGCTime;
/*
* JSGC_MODE

View File

@ -387,9 +387,9 @@ class GCSchedulingTunables
* JSGC_HIGH_FREQUENCY_TIME_LIMIT
*
* We enter high-frequency mode if we GC a twice within this many
* microseconds.
* microseconds. This value is stored directly in microseconds.
*/
MainThreadData<mozilla::TimeDuration> highFrequencyThresholdUsec_;
MainThreadData<uint64_t> highFrequencyThresholdUsec_;
/*
* JSGC_HIGH_FREQUENCY_LOW_LIMIT
@ -448,7 +448,7 @@ class GCSchedulingTunables
double allocThresholdFactorAvoidInterrupt() const { return allocThresholdFactorAvoidInterrupt_; }
size_t zoneAllocDelayBytes() const { return zoneAllocDelayBytes_; }
bool isDynamicHeapGrowthEnabled() const { return dynamicHeapGrowthEnabled_; }
const mozilla::TimeDuration &highFrequencyThresholdUsec() const { return highFrequencyThresholdUsec_; }
uint64_t highFrequencyThresholdUsec() const { return highFrequencyThresholdUsec_; }
uint64_t highFrequencyLowLimitBytes() const { return highFrequencyLowLimitBytes_; }
uint64_t highFrequencyHighLimitBytes() const { return highFrequencyHighLimitBytes_; }
double highFrequencyHeapGrowthMax() const { return highFrequencyHeapGrowthMax_; }
@ -493,10 +493,10 @@ class GCSchedulingState
bool inHighFrequencyGCMode() const { return inHighFrequencyGCMode_; }
void updateHighFrequencyMode(const mozilla::TimeStamp &lastGCTime, const mozilla::TimeStamp &currentTime,
void updateHighFrequencyMode(uint64_t lastGCTime, uint64_t currentTime,
const GCSchedulingTunables& tunables) {
inHighFrequencyGCMode_ =
tunables.isDynamicHeapGrowthEnabled() && !lastGCTime.IsNull() &&
tunables.isDynamicHeapGrowthEnabled() && lastGCTime &&
lastGCTime + tunables.highFrequencyThresholdUsec() > currentTime;
}
};

View File

@ -1,11 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "js/SliceBudget.h"
namespace js {
const mozilla::TimeStamp SliceBudget::unlimitedDeadline = mozilla::TimeStamp() + mozilla::TimeDuration::Forever();
}

View File

@ -8,7 +8,6 @@
#include "mozilla/Atomics.h"
#include "mozilla/PodOperations.h"
#include "mozilla/TimeStamp.h"
#include <stdint.h>
@ -419,7 +418,7 @@ js::AssertSameCompartment(JSObject* objA, JSObject* objB)
JS_FRIEND_API(void)
js::NotifyAnimationActivity(JSObject* obj)
{
auto timeNow = mozilla::TimeStamp::Now();
int64_t timeNow = PRMJ_Now();
obj->realm()->lastAnimationTime = timeNow;
obj->runtimeFromMainThread()->lastAnimationTime = timeNow;
}

View File

@ -223,7 +223,6 @@ UNIFIED_SOURCES += [
'gc/Nursery.cpp',
'gc/PublicIterators.cpp',
'gc/RootMarking.cpp',
'gc/SliceBudget.cpp',
'gc/Statistics.cpp',
'gc/Tracer.cpp',
'gc/Verifier.cpp',

View File

@ -10,7 +10,6 @@
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Tuple.h"
#include "mozilla/Variant.h"
#include "mozilla/XorShift128PlusRNG.h"
@ -421,7 +420,7 @@ class JS::Realm : public JS::shadow::Realm
js::ReadBarrieredScriptSourceObject selfHostingScriptSource { nullptr };
// Last time at which an animation was played for this realm.
js::MainThreadData<mozilla::TimeStamp> lastAnimationTime;
int64_t lastAnimationTime = 0;
/*
* For generational GC, record whether a write barrier has added this

View File

@ -169,6 +169,7 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
autoWritableJitCodeActive_(false),
oomCallback(nullptr),
debuggerMallocSizeOf(ReturnZeroSize),
lastAnimationTime(0),
performanceMonitoring_(),
stackFormat_(parentRuntime ? js::StackFormat::Default
: js::StackFormat::SpiderMonkey),

View File

@ -16,7 +16,6 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/Scoped.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Vector.h"
#include <algorithm>
@ -893,7 +892,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
js::MainThreadData<mozilla::MallocSizeOf> debuggerMallocSizeOf;
/* Last time at which an animation was played for this runtime. */
js::MainThreadData<mozilla::TimeStamp> lastAnimationTime;
mozilla::Atomic<int64_t> lastAnimationTime;
private:
js::MainThreadData<js::PerformanceMonitoring> performanceMonitoring_;