Skip to content

Commit

Permalink
Backout bug 774859 and bug 782337 for bustage; a=sparky
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Aug 27, 2012
1 parent 1b4d25e commit 084cbe8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
9 changes: 1 addition & 8 deletions js/src/jsgc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,7 @@ MarkRuntime(JSTracer *trc, bool useSavedRoots = false)
mjit::ExpandInlineFrames(c);
#endif

rt->stackSpace.markAndClobber(trc);
rt->stackSpace.mark(trc);
rt->debugScopes->mark(trc);

/* The embedding can register additional roots here. */
Expand Down Expand Up @@ -3436,13 +3436,6 @@ SweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool *startBackgroundSweep)
{
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_COMPARTMENTS);

/*
* Eliminate any garbage values from the VM stack that may have been
* left by the JIT in between incremental GC slices. We need to do this
* before discarding analysis data during JSCompartment::sweep.
*/
rt->stackSpace.markAndClobber(NULL);

bool releaseTypes = ReleaseObservedTypes(rt);
for (CompartmentsIter c(rt); !c.done(); c.next()) {
if (c->isCollecting())
Expand Down
2 changes: 1 addition & 1 deletion js/src/methodjit/FastOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,7 @@ mjit::Compiler::jsop_initprop()

RootedObject baseobj(cx, frame.extra(obj).initObject);

if (!baseobj || monitored(PC) || cx->compartment->compileBarriers()) {
if (!baseobj || monitored(PC)) {
prepareStubCall(Uses(2));
masm.move(ImmPtr(name), Registers::ArgReg1);
INLINE_STUBCALL(stubs::InitProp, REJOIN_FALLTHROUGH);
Expand Down
34 changes: 16 additions & 18 deletions js/src/vm/Stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,13 @@ StackSpace::containingSegment(const StackFrame *target) const
}

void
StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd, jsbytecode *pc)
StackSpace::markFrameValues(JSTracer *trc, StackFrame *fp, Value *slotsEnd, jsbytecode *pc)
{
Value *slotsBegin = fp->slots();

if (!fp->isScriptFrame()) {
JS_ASSERT(fp->isDummyFrame());
if (trc)
gc::MarkValueRootRange(trc, slotsBegin, slotsEnd, "vm_stack");
gc::MarkValueRootRange(trc, slotsBegin, slotsEnd, "vm_stack");
return;
}

Expand All @@ -630,8 +629,7 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,

JSScript *script = fp->script();
if (!script->hasAnalysis() || !script->analysis()->ranLifetimes()) {
if (trc)
gc::MarkValueRootRange(trc, slotsBegin, slotsEnd, "vm_stack");
gc::MarkValueRootRange(trc, slotsBegin, slotsEnd, "vm_stack");
return;
}

Expand All @@ -643,7 +641,6 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,
* results are thrown away during the sweeping phase, so we always have at
* least one GC to do this.
*/
JSRuntime *rt = script->compartment()->rt;
analyze::AutoEnterAnalysis aea(script->compartment());
analyze::ScriptAnalysis *analysis = script->analysis();
uint32_t offset = pc - script->code;
Expand All @@ -653,9 +650,8 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,

/* Will this slot be synced by the JIT? */
if (!analysis->trackSlot(slot) || analysis->liveness(slot).live(offset)) {
if (trc)
gc::MarkValueRoot(trc, vp, "vm_stack");
} else if (!trc || script->compartment()->isDiscardingJitCode(trc)) {
gc::MarkValueRoot(trc, vp, "vm_stack");
} else if (script->compartment()->isDiscardingJitCode(trc)) {
/*
* If we're throwing away analysis information, we need to replace
* non-live Values with ones that can safely be marked in later
Expand All @@ -680,7 +676,7 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,
else if (type == JSVAL_TYPE_BOOLEAN)
*vp = BooleanValue(false);
else if (type == JSVAL_TYPE_STRING)
*vp = StringValue(rt->atomState.nullAtom);
*vp = StringValue(trc->runtime->atomState.nullAtom);
else if (type == JSVAL_TYPE_NULL)
*vp = NullValue();
else if (type == JSVAL_TYPE_OBJECT)
Expand All @@ -689,13 +685,17 @@ StackSpace::markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd,
}
}

if (trc)
gc::MarkValueRootRange(trc, fixedEnd, slotsEnd, "vm_stack");
gc::MarkValueRootRange(trc, fixedEnd, slotsEnd, "vm_stack");
}

void
StackSpace::markAndClobber(JSTracer *trc)
StackSpace::mark(JSTracer *trc)
{
/*
* JIT code can leave values in an incoherent (i.e., unsafe for precise
* marking) state, hence MarkStackRangeConservatively.
*/

/* NB: this depends on the continuity of segments in memory. */
Value *nextSegEnd = firstUnused();
for (StackSegment *seg = seg_; seg; seg = seg->prevInMemory()) {
Expand All @@ -713,18 +713,16 @@ StackSpace::markAndClobber(JSTracer *trc)
jsbytecode *pc = seg->maybepc();
for (StackFrame *fp = seg->maybefp(); (Value *)fp > (Value *)seg; fp = fp->prev()) {
/* Mark from fp->slots() to slotsEnd. */
markAndClobberFrame(trc, fp, slotsEnd, pc);
markFrameValues(trc, fp, slotsEnd, pc);

if (trc)
fp->mark(trc);
fp->mark(trc);
slotsEnd = (Value *)fp;

InlinedSite *site;
pc = fp->prevpc(&site);
JS_ASSERT_IF(fp->prev(), !site);
}
if (trc)
gc::MarkValueRootRange(trc, seg->slotsBegin(), slotsEnd, "vm_stack");
gc::MarkValueRootRange(trc, seg->slotsBegin(), slotsEnd, "vm_stack");
nextSegEnd = (Value *)seg;
}
}
Expand Down
5 changes: 2 additions & 3 deletions js/src/vm/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,6 @@ class StackSpace
return (Value *)fp >= base_ && (Value *)fp <= trustedEnd_;
}

void markAndClobberFrame(JSTracer *trc, StackFrame *fp, Value *slotsEnd, jsbytecode *pc);

public:
StackSpace();
bool init();
Expand Down Expand Up @@ -1413,7 +1411,8 @@ class StackSpace
bool tryBumpLimit(JSContext *cx, Value *from, unsigned nvals, Value **limit);

/* Called during GC: mark segments, frames, and slots under firstUnused. */
void markAndClobber(JSTracer *trc);
void mark(JSTracer *trc);
void markFrameValues(JSTracer *trc, StackFrame *fp, Value *slotsEnd, jsbytecode *pc);

/* Called during GC: sets active flag on compartments with active frames. */
void markActiveCompartments();
Expand Down

0 comments on commit 084cbe8

Please sign in to comment.