зеркало из https://github.com/mozilla/gecko-dev.git
Bug 854564 - Fix SPS crash when running asm.js (r=sstangl)
--HG-- extra : rebase_source : 17be1e7c2425d9c821981bd3158f97da2d152f2a
This commit is contained in:
Родитель
2fa41bcf2d
Коммит
600cedf6d0
|
@ -74,14 +74,13 @@ class AsmJSActivation
|
|||
{
|
||||
JSContext *cx_;
|
||||
const AsmJSModule &module_;
|
||||
unsigned entryIndex_;
|
||||
AsmJSActivation *prev_;
|
||||
void *errorRejoinSP_;
|
||||
SPSProfiler *profiler_;
|
||||
void *resumePC_;
|
||||
|
||||
public:
|
||||
AsmJSActivation(JSContext *cx, const AsmJSModule &module, unsigned entryIndex);
|
||||
AsmJSActivation(JSContext *cx, const AsmJSModule &module);
|
||||
~AsmJSActivation();
|
||||
|
||||
const AsmJSModule &module() const { return module_; }
|
||||
|
|
|
@ -240,18 +240,16 @@ DynamicallyLinkModule(JSContext *cx, CallArgs args, AsmJSModule &module)
|
|||
return true;
|
||||
}
|
||||
|
||||
AsmJSActivation::AsmJSActivation(JSContext *cx, const AsmJSModule &module, unsigned entryIndex)
|
||||
AsmJSActivation::AsmJSActivation(JSContext *cx, const AsmJSModule &module)
|
||||
: cx_(cx),
|
||||
module_(module),
|
||||
entryIndex_(entryIndex),
|
||||
errorRejoinSP_(NULL),
|
||||
profiler_(NULL),
|
||||
resumePC_(NULL)
|
||||
{
|
||||
if (cx->runtime->spsProfiler.enabled()) {
|
||||
profiler_ = &cx->runtime->spsProfiler;
|
||||
JSFunction *fun = module_.exportedFunction(entryIndex_).unclonedFunObj();
|
||||
profiler_->enter(cx_, fun->nonLazyScript(), fun);
|
||||
profiler_->enterNative("asm.js code", this);
|
||||
}
|
||||
|
||||
prev_ = cx_->runtime->mainThread.asmJSActivationStack_;
|
||||
|
@ -264,10 +262,8 @@ AsmJSActivation::AsmJSActivation(JSContext *cx, const AsmJSModule &module, unsig
|
|||
|
||||
AsmJSActivation::~AsmJSActivation()
|
||||
{
|
||||
if (profiler_) {
|
||||
JSFunction *fun = module_.exportedFunction(entryIndex_).unclonedFunObj();
|
||||
profiler_->exit(cx_, fun->nonLazyScript(), fun);
|
||||
}
|
||||
if (profiler_)
|
||||
profiler_->exitNative();
|
||||
|
||||
JS_ASSERT(cx_->runtime->mainThread.asmJSActivationStack_ == this);
|
||||
|
||||
|
@ -324,7 +320,7 @@ CallAsmJS(JSContext *cx, unsigned argc, Value *vp)
|
|||
}
|
||||
|
||||
{
|
||||
AsmJSActivation activation(cx, module, exportIndex);
|
||||
AsmJSActivation activation(cx, module);
|
||||
|
||||
// Call into generated code.
|
||||
if (!func.code()(coercedArgs.begin()))
|
||||
|
|
|
@ -151,6 +151,24 @@ SPSProfiler::exit(JSContext *cx, RawScript script, RawFunction maybeFun)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SPSProfiler::enterNative(const char *string, void *sp)
|
||||
{
|
||||
/* these operations cannot be re-ordered, so volatile-ize operations */
|
||||
volatile ProfileEntry *stack = stack_;
|
||||
volatile uint32_t *size = size_;
|
||||
uint32_t current = *size;
|
||||
|
||||
JS_ASSERT(enabled());
|
||||
if (current < max_) {
|
||||
stack[current].setLabel(string);
|
||||
stack[current].setStackAddress(sp);
|
||||
stack[current].setScript(NULL);
|
||||
stack[current].setLine(0);
|
||||
}
|
||||
*size = current + 1;
|
||||
}
|
||||
|
||||
void
|
||||
SPSProfiler::push(const char *string, void *sp, RawScript script, jsbytecode *pc)
|
||||
{
|
||||
|
|
|
@ -175,6 +175,10 @@ class SPSProfiler
|
|||
}
|
||||
}
|
||||
|
||||
/* Enter a C++ function. */
|
||||
void enterNative(const char *string, void *sp);
|
||||
void exitNative() { pop(); }
|
||||
|
||||
#ifdef JS_METHODJIT
|
||||
struct ICInfo
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче