зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1231224 part 13 - Add OOM checks to Statistics::initialize. r=jonco
--HG-- extra : rebase_source : 23bd6ee9ae62707b01d13b928be9d09e7d2e7815
This commit is contained in:
Родитель
ab5c363f7d
Коммит
f549ff32f6
|
@ -782,7 +782,7 @@ Statistics::~Statistics()
|
|||
fclose(fp);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
/* static */ bool
|
||||
Statistics::initialize()
|
||||
{
|
||||
for (size_t i = 0; i < PHASE_LIMIT; i++) {
|
||||
|
@ -806,7 +806,8 @@ Statistics::initialize()
|
|||
MOZ_ASSERT(phases[child].parent == PHASE_MULTI_PARENTS);
|
||||
int j = child;
|
||||
do {
|
||||
dagDescendants[phaseExtra[parent].dagSlot].append(Phase(j));
|
||||
if (!dagDescendants[phaseExtra[parent].dagSlot].append(Phase(j)))
|
||||
return false;
|
||||
j++;
|
||||
} while (j != PHASE_LIMIT && phases[j].parent != PHASE_MULTI_PARENTS);
|
||||
}
|
||||
|
@ -815,7 +816,8 @@ Statistics::initialize()
|
|||
// Fill in the depth of each node in the tree. Multi-parented nodes
|
||||
// have depth 0.
|
||||
mozilla::Vector<Phase> stack;
|
||||
stack.append(PHASE_LIMIT); // Dummy entry to avoid special-casing the first node
|
||||
if (!stack.append(PHASE_LIMIT)) // Dummy entry to avoid special-casing the first node
|
||||
return false;
|
||||
for (int i = 0; i < PHASE_LIMIT; i++) {
|
||||
if (phases[i].parent == PHASE_NO_PARENT ||
|
||||
phases[i].parent == PHASE_MULTI_PARENTS)
|
||||
|
@ -826,9 +828,11 @@ Statistics::initialize()
|
|||
stack.popBack();
|
||||
}
|
||||
phaseExtra[i].depth = stack.length();
|
||||
stack.append(Phase(i));
|
||||
if (!stack.append(Phase(i)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
JS::GCSliceCallback
|
||||
|
|
|
@ -162,7 +162,7 @@ struct Statistics
|
|||
/* Create a convenient type for referring to tables of phase times. */
|
||||
using PhaseTimeTable = int64_t[NumTimingArrays][PHASE_LIMIT];
|
||||
|
||||
static void initialize();
|
||||
static bool initialize();
|
||||
|
||||
explicit Statistics(JSRuntime* rt);
|
||||
~Statistics();
|
||||
|
|
|
@ -104,7 +104,8 @@ JS_Init(void)
|
|||
if (!FutexRuntime::initialize())
|
||||
return false;
|
||||
|
||||
js::gcstats::Statistics::initialize();
|
||||
if (!js::gcstats::Statistics::initialize())
|
||||
return false;
|
||||
|
||||
libraryInitState = InitState::Running;
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче