Bug 1212469 - Fix some OOM handling issues shown up by the previous patch r=jandem

This commit is contained in:
Jon Coppeard 2015-10-13 13:37:08 +01:00
Родитель 0bba2d39d5
Коммит a48bd42655
3 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@ -605,6 +605,9 @@ jit::LazyLink(JSContext* cx, HandleScript calleeScript)
// doesn't has code to handle it after linking happened. So it's
// not OK to throw a catchable exception from there.
cx->clearPendingException();
// Reset the TypeZone's compiler output for this script, if any.
InvalidateCompilerOutputsForScript(cx, calleeScript);
}
}
@ -2207,9 +2210,6 @@ IonCompile(JSContext* cx, JSScript* script,
// If possible, compile the script off thread.
if (options.offThreadCompilationAvailable()) {
if (!recompile)
builderScript->setIonScript(cx, ION_COMPILING_SCRIPT);
JitSpew(JitSpew_IonSyncLogs, "Can't log script %s:%" PRIuSIZE
". (Compiled on background thread.)",
builderScript->filename(), builderScript->lineno());
@ -2220,6 +2220,9 @@ IonCompile(JSContext* cx, JSScript* script,
return AbortReason_Alloc;
}
if (!recompile)
builderScript->setIonScript(cx, ION_COMPILING_SCRIPT);
// The allocator and associated data will be destroyed after being
// processed in the finishedOffThreadCompilations list.
autoDelete.forget();

Просмотреть файл

@ -1368,7 +1368,7 @@ class TypeConstraintFreezeStack : public TypeConstraint
bool
js::FinishCompilation(JSContext* cx, HandleScript script, CompilerConstraintList* constraints,
RecompileInfo* precompileInfo)
RecompileInfo* precompileInfo)
{
if (constraints->failed())
return false;
@ -1458,6 +1458,18 @@ js::FinishCompilation(JSContext* cx, HandleScript script, CompilerConstraintList
return true;
}
void
js::InvalidateCompilerOutputsForScript(JSContext* cx, HandleScript script)
{
TypeZone& types = cx->zone()->types;
if (types.compilerOutputs) {
for (auto& co : *types.compilerOutputs) {
if (co.script() == script)
co.invalidate();
}
}
}
static void
CheckDefinitePropertiesTypeSet(JSContext* cx, TemporaryTypeSet* frozen, StackTypeSet* actual)
{

Просмотреть файл

@ -1070,6 +1070,10 @@ bool
FinishCompilation(JSContext* cx, HandleScript script, CompilerConstraintList* constraints,
RecompileInfo* precompileInfo);
// Reset any CompilerOutput present for a script.
void
InvalidateCompilerOutputsForScript(JSContext* cx, HandleScript script);
// Update the actual types in any scripts queried by constraints with any
// speculative types added during the definite properties analysis.
void