Bug 1054538 - Store the IonScript in AsmJSModule::ExitDatum for direct access in ~AsmJSModule (r=hannes)

--HG--
extra : rebase_source : e4afb40b979f98a1195163ef3728386a88cd7266
This commit is contained in:
Luke Wagner 2014-09-02 09:21:42 -05:00
parent bc7cc3893c
commit 3081f6ca91
2 changed files with 13 additions and 13 deletions

View File

@ -121,18 +121,11 @@ AsmJSModule::~AsmJSModule()
if (code_) {
for (unsigned i = 0; i < numExits(); i++) {
AsmJSModule::ExitDatum &exitDatum = exitIndexToGlobalDatum(i);
if (!exitDatum.fun)
continue;
if (!exitDatum.fun->hasScript())
continue;
JSScript *script = exitDatum.fun->nonLazyScript();
if (!script->hasIonScript())
if (!exitDatum.ionScript)
continue;
jit::DependentAsmJSModuleExit exit(this, i);
script->ionScript()->removeDependentAsmJSModule(exit);
exitDatum.ionScript->removeDependentAsmJSModule(exit);
}
DeallocateExecutableMemory(code_, pod.totalBytes_);
@ -536,7 +529,9 @@ TryEnablingIon(JSContext *cx, AsmJSModule &module, HandleFunction fun, uint32_t
if (!ionScript->addDependentAsmJSModule(cx, DependentAsmJSModuleExit(&module, exitIndex)))
return false;
module.exitIndexToGlobalDatum(exitIndex).exit = module.ionExitTrampoline(module.exit(exitIndex));
AsmJSModule::ExitDatum &exitDatum = module.exitIndexToGlobalDatum(exitIndex);
exitDatum.exit = module.ionExitTrampoline(module.exit(exitIndex));
exitDatum.ionScript = ionScript;
return true;
}
@ -737,8 +732,10 @@ AsmJSModule::staticallyLink(ExclusiveContext *cx)
// Initialize global data segment
for (size_t i = 0; i < exits_.length(); i++) {
exitIndexToGlobalDatum(i).exit = interpExitTrampoline(exits_[i]);
exitIndexToGlobalDatum(i).fun = nullptr;
AsmJSModule::ExitDatum &exitDatum = exitIndexToGlobalDatum(i);
exitDatum.exit = interpExitTrampoline(exits_[i]);
exitDatum.fun = nullptr;
exitDatum.ionScript = nullptr;
}
JS_ASSERT(isStaticallyLinked());

View File

@ -402,6 +402,7 @@ class AsmJSModule
struct ExitDatum
{
uint8_t *exit;
jit::IonScript *ionScript;
HeapPtrFunction fun;
};
@ -1339,7 +1340,9 @@ class AsmJSModule
}
void detachIonCompilation(size_t exitIndex) const {
JS_ASSERT(isFinished());
exitIndexToGlobalDatum(exitIndex).exit = interpExitTrampoline(exit(exitIndex));
ExitDatum &exitDatum = exitIndexToGlobalDatum(exitIndex);
exitDatum.exit = interpExitTrampoline(exit(exitIndex));
exitDatum.ionScript = nullptr;
}
/*************************************************************************/