Skip to content

Commit

Permalink
Backed out changeset 88c4af1d92d0 (bug 1409441) for crashing devtools…
Browse files Browse the repository at this point in the history
…' devtools/client/performance/test/browser_perf-console-record-08.js on Linux x64 pgo. r=backout on a CLOSED TREE
  • Loading branch information
Archaeopteryx committed Oct 18, 2017
1 parent d75c13b commit 1c4d626
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 52 deletions.
20 changes: 0 additions & 20 deletions js/src/vm/Stack-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -879,26 +879,6 @@ AbstractFramePtr::debuggerNeedsCheckPrimitiveReturn() const
return script()->isDerivedClassConstructor();
}

ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx)
: cx_(cx), entryMonitor_(cx->entryMonitor)
{
cx->entryMonitor = nullptr;
}

ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx, InterpreterFrame* entryFrame)
: ActivationEntryMonitor(cx)
{
if (MOZ_UNLIKELY(entryMonitor_))
init(cx, entryFrame);
}

ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx, jit::CalleeToken entryToken)
: ActivationEntryMonitor(cx)
{
if (MOZ_UNLIKELY(entryMonitor_))
init(cx, entryToken);
}

ActivationEntryMonitor::~ActivationEntryMonitor()
{
if (entryMonitor_)
Expand Down
58 changes: 32 additions & 26 deletions js/src/vm/Stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,12 @@ NonBuiltinScriptFrameIter::settle()
}
}

ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx)
: cx_(cx), entryMonitor_(cx->entryMonitor)
{
cx->entryMonitor = nullptr;
}

Value
ActivationEntryMonitor::asyncStack(JSContext* cx)
{
Expand All @@ -1463,36 +1469,36 @@ ActivationEntryMonitor::asyncStack(JSContext* cx)
return stack;
}

void
ActivationEntryMonitor::init(JSContext* cx, InterpreterFrame* entryFrame)
ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx, InterpreterFrame* entryFrame)
: ActivationEntryMonitor(cx)
{
MOZ_ASSERT(entryMonitor_);

// The InterpreterFrame is not yet part of an Activation, so it won't
// be traced if we trigger GC here. Suppress GC to avoid this.
gc::AutoSuppressGC suppressGC(cx);
RootedValue stack(cx, asyncStack(cx));
const char* asyncCause = cx->asyncCauseForNewActivations;
if (entryFrame->isFunctionFrame())
entryMonitor_->Entry(cx, &entryFrame->callee(), stack, asyncCause);
else
entryMonitor_->Entry(cx, entryFrame->script(), stack, asyncCause);
if (entryMonitor_) {
// The InterpreterFrame is not yet part of an Activation, so it won't
// be traced if we trigger GC here. Suppress GC to avoid this.
gc::AutoSuppressGC suppressGC(cx);
RootedValue stack(cx, asyncStack(cx));
const char* asyncCause = cx->asyncCauseForNewActivations;
if (entryFrame->isFunctionFrame())
entryMonitor_->Entry(cx, &entryFrame->callee(), stack, asyncCause);
else
entryMonitor_->Entry(cx, entryFrame->script(), stack, asyncCause);
}
}

void
ActivationEntryMonitor::init(JSContext* cx, jit::CalleeToken entryToken)
ActivationEntryMonitor::ActivationEntryMonitor(JSContext* cx, jit::CalleeToken entryToken)
: ActivationEntryMonitor(cx)
{
MOZ_ASSERT(entryMonitor_);

// The CalleeToken is not traced at this point and we also don't want
// a GC to discard the code we're about to enter, so we suppress GC.
gc::AutoSuppressGC suppressGC(cx);
RootedValue stack(cx, asyncStack(cx));
const char* asyncCause = cx->asyncCauseForNewActivations;
if (jit::CalleeTokenIsFunction(entryToken))
entryMonitor_->Entry(cx_, jit::CalleeTokenToFunction(entryToken), stack, asyncCause);
else
entryMonitor_->Entry(cx_, jit::CalleeTokenToScript(entryToken), stack, asyncCause);
if (entryMonitor_) {
// The CalleeToken is not traced at this point and we also don't want
// a GC to discard the code we're about to enter, so we suppress GC.
gc::AutoSuppressGC suppressGC(cx);
RootedValue stack(cx, asyncStack(cx));
const char* asyncCause = cx->asyncCauseForNewActivations;
if (jit::CalleeTokenIsFunction(entryToken))
entryMonitor_->Entry(cx_, jit::CalleeTokenToFunction(entryToken), stack, asyncCause);
else
entryMonitor_->Entry(cx_, jit::CalleeTokenToScript(entryToken), stack, asyncCause);
}
}

/*****************************************************************************/
Expand Down
9 changes: 3 additions & 6 deletions js/src/vm/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -1244,19 +1244,16 @@ class MOZ_RAII ActivationEntryMonitor
// ActivationEntryMonitor was created.
JS::dbg::AutoEntryMonitor* entryMonitor_;

explicit inline ActivationEntryMonitor(JSContext* cx);
explicit ActivationEntryMonitor(JSContext* cx);

ActivationEntryMonitor(const ActivationEntryMonitor& other) = delete;
void operator=(const ActivationEntryMonitor& other) = delete;

void init(JSContext* cx, jit::CalleeToken entryToken);
void init(JSContext* cx, InterpreterFrame* entryFrame);

Value asyncStack(JSContext* cx);

public:
inline ActivationEntryMonitor(JSContext* cx, InterpreterFrame* entryFrame);
inline ActivationEntryMonitor(JSContext* cx, jit::CalleeToken entryToken);
ActivationEntryMonitor(JSContext* cx, InterpreterFrame* entryFrame);
ActivationEntryMonitor(JSContext* cx, jit::CalleeToken entryToken);
inline ~ActivationEntryMonitor();
};

Expand Down

0 comments on commit 1c4d626

Please sign in to comment.