Bug 1147665 - Replace value marking functions with TraceEdge; r=jonco

This commit is contained in:
Terrence Cole 2015-03-26 10:23:27 -07:00
parent 20916f0bed
commit af2c73052c
25 changed files with 86 additions and 144 deletions

View File

@ -837,7 +837,7 @@ HashableValue::mark(JSTracer* trc) const
{
HashableValue hv(*this);
trc->setTracingLocation((void*)this);
gc::MarkValue(trc, &hv.value, "key");
TraceEdge(trc, &hv.value, "key");
return hv;
}
@ -1106,7 +1106,7 @@ MapObject::mark(JSTracer* trc, JSObject* obj)
if (ValueMap* map = obj->as<MapObject>().getData()) {
for (ValueMap::Range r = map->all(); !r.empty(); r.popFront()) {
MarkKey(r, r.front().key, trc);
gc::MarkValue(trc, &r.front().value, "value");
TraceEdge(trc, &r.front().value, "value");
}
}
}
@ -1132,7 +1132,7 @@ class OrderedHashTableRef : public gc::BufferableRef
MOZ_ASSERT(UnbarrieredHashPolicy::hash(key) ==
HashableValue::Hasher::hash(*reinterpret_cast<HashableValue*>(&key)));
Value prior = key;
gc::MarkValueUnbarriered(trc, &key, "ordered hash table key");
TraceManuallyBarrieredEdge(trc, &key, "ordered hash table key");
table->rekeyOneEntry(prior, key);
}
};

View File

@ -2937,15 +2937,14 @@ MemoryTracingVisitor::visitReference(ReferenceTypeDescr& descr, uint8_t* mem)
switch (descr.type()) {
case ReferenceTypeDescr::TYPE_ANY:
{
js::HeapValue* heapValue = reinterpret_cast<js::HeapValue*>(mem);
gc::MarkValue(trace_, heapValue, "reference-val");
HeapValue* heapValue = reinterpret_cast<js::HeapValue*>(mem);
TraceEdge(trace_, heapValue, "reference-val");
return;
}
case ReferenceTypeDescr::TYPE_OBJECT:
{
js::HeapPtrObject* objectPtr =
reinterpret_cast<js::HeapPtrObject*>(mem);
HeapPtrObject* objectPtr = reinterpret_cast<js::HeapPtrObject*>(mem);
if (*objectPtr)
gc::MarkObject(trace_, objectPtr, "reference-obj");
return;
@ -2953,8 +2952,7 @@ MemoryTracingVisitor::visitReference(ReferenceTypeDescr& descr, uint8_t* mem)
case ReferenceTypeDescr::TYPE_STRING:
{
js::HeapPtrString* stringPtr =
reinterpret_cast<js::HeapPtrString*>(mem);
HeapPtrString* stringPtr = reinterpret_cast<js::HeapPtrString*>(mem);
if (*stringPtr)
gc::MarkString(trace_, stringPtr, "reference-str");
return;

View File

@ -233,7 +233,7 @@ template <> struct MapTypeToTraceKind<ObjectGroup> { static const JSGCTrace
// Direct value access used by the write barriers and the jits.
void
MarkValueUnbarriered(JSTracer* trc, Value* v, const char* name);
MarkValueForBarrier(JSTracer* trc, Value* v, const char* name);
// These three declarations are also present in gc/Marking.h, via the DeclMarker
// macro. Not great, but hard to avoid.
@ -345,7 +345,7 @@ struct InternalGCMethods<Value>
if (shadowZone->needsIncrementalBarrier()) {
MOZ_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier());
Value tmp(v);
js::gc::MarkValueUnbarriered(shadowZone->barrierTracer(), &tmp, "write barrier");
js::gc::MarkValueForBarrier(shadowZone->barrierTracer(), &tmp, "write barrier");
MOZ_ASSERT(tmp == v);
}
}

View File

@ -1177,40 +1177,6 @@ MarkValueInternal(JSTracer* trc, Value* v)
}
}
void
gc::MarkValue(JSTracer* trc, BarrieredBase<Value>* v, const char* name)
{
trc->setTracingName(name);
MarkValueInternal(trc, v->unsafeGet());
}
void
gc::MarkValueRoot(JSTracer* trc, Value* v, const char* name)
{
JS_ROOT_MARKING_ASSERT(trc);
trc->setTracingName(name);
MarkValueInternal(trc, v);
}
void
gc::MarkValueRange(JSTracer* trc, size_t len, BarrieredBase<Value>* vec, const char* name)
{
for (size_t i = 0; i < len; ++i) {
trc->setTracingIndex(name, i);
MarkValueInternal(trc, vec[i].unsafeGet());
}
}
void
gc::MarkValueRootRange(JSTracer* trc, size_t len, Value* vec, const char* name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
trc->setTracingIndex(name, i);
MarkValueInternal(trc, &vec[i]);
}
}
bool
gc::IsValueMarked(Value* v)
{
@ -1372,10 +1338,10 @@ ShouldMarkCrossCompartment(JSTracer* trc, JSObject* src, Value val)
/*** Special Marking ***/
void
gc::MarkValueUnbarriered(JSTracer* trc, Value* v, const char* name)
gc::MarkValueForBarrier(JSTracer* trc, Value* v, const char* name)
{
trc->setTracingName(name);
MarkValueInternal(trc, v);
MOZ_ASSERT(!trc->runtime()->isHeapBusy());
TraceManuallyBarrieredEdge(trc, v, name);
}
/*** Push Mark Stack ***/

View File

@ -228,33 +228,6 @@ MarkIdRootRange(JSTracer* trc, size_t len, jsid* vec, const char* name);
/*** Value Marking ***/
void
MarkValue(JSTracer* trc, BarrieredBase<Value>* v, const char* name);
void
MarkValueRange(JSTracer* trc, size_t len, BarrieredBase<Value>* vec, const char* name);
inline void
MarkValueRange(JSTracer* trc, HeapValue* begin, HeapValue* end, const char* name)
{
return MarkValueRange(trc, end - begin, begin, name);
}
void
MarkValueRoot(JSTracer* trc, Value* v, const char* name);
void
MarkThingOrValueUnbarriered(JSTracer* trc, uintptr_t* word, const char* name);
void
MarkValueRootRange(JSTracer* trc, size_t len, Value* vec, const char* name);
inline void
MarkValueRootRange(JSTracer* trc, Value* begin, Value* end, const char* name)
{
MarkValueRootRange(trc, end - begin, begin, name);
}
bool
IsValueMarked(Value* v);

View File

@ -105,7 +105,7 @@ MarkExactStackRootsAcrossTypes(T context, JSTracer* trc)
MarkExactStackRootList<JSScript*, MarkScriptRoot>(trc, context, "exact-script");
MarkExactStackRootList<LazyScript*, MarkLazyScriptRoot>(trc, context, "exact-lazy-script");
MarkExactStackRootList<jsid, MarkIdRoot>(trc, context, "exact-id");
MarkExactStackRootList<Value, MarkValueRoot>(trc, context, "exact-value");
MarkExactStackRootList<Value, TraceRoot>(trc, context, "exact-value");
MarkExactStackRootList<TypeSet::Type, TypeSet::MarkTypeRoot>(trc, context, "TypeSet::Type");
MarkExactStackRootList<Bindings, MarkBindingsRoot>(trc, context, "Bindings");
MarkExactStackRootList<JSPropertyDescriptor, MarkPropertyDescriptorRoot>(
@ -151,7 +151,7 @@ AutoGCRooter::trace(JSTracer* trc)
case VALVECTOR: {
AutoValueVector::VectorImpl& vector = static_cast<AutoValueVector*>(this)->vector;
MarkValueRootRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector");
TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector");
return;
}
@ -165,7 +165,7 @@ AutoGCRooter::trace(JSTracer* trc)
AutoIdValueVector::VectorImpl& vector = static_cast<AutoIdValueVector*>(this)->vector;
for (size_t i = 0; i < vector.length(); i++) {
MarkIdRoot(trc, &vector[i].id, "js::AutoIdValueVector id");
MarkValueRoot(trc, &vector[i].value, "js::AutoIdValueVector value");
TraceRoot(trc, &vector[i].value, "js::AutoIdValueVector value");
}
return;
}
@ -207,7 +207,7 @@ AutoGCRooter::trace(JSTracer* trc)
* as an AutoValueArray<1> because the length is stored separately.
*/
AutoValueArray<1>* array = static_cast<AutoValueArray<1>*>(this);
MarkValueRootRange(trc, array->length(), array->begin(), "js::AutoValueArray");
TraceRootRange(trc, array->length(), array->begin(), "js::AutoValueArray");
return;
}
@ -267,24 +267,24 @@ AutoGCRooter::trace(JSTracer* trc)
case WRAPPER: {
/*
* We need to use MarkValueUnbarriered here because we mark wrapper
* roots in every slice. This is because of some rule-breaking in
* RemapAllWrappersForObject; see comment there.
* We need to use TraceManuallyBarrieredEdge here because we mark
* wrapper roots in every slice. This is because of some rule-breaking
* in RemapAllWrappersForObject; see comment there.
*/
MarkValueUnbarriered(trc, &static_cast<AutoWrapperRooter*>(this)->value.get(),
"JS::AutoWrapperRooter.value");
TraceManuallyBarrieredEdge(trc, &static_cast<AutoWrapperRooter*>(this)->value.get(),
"JS::AutoWrapperRooter.value");
return;
}
case WRAPVECTOR: {
AutoWrapperVector::VectorImpl& vector = static_cast<AutoWrapperVector*>(this)->vector;
/*
* We need to use MarkValueUnbarriered here because we mark wrapper
* roots in every slice. This is because of some rule-breaking in
* RemapAllWrappersForObject; see comment there.
* We need to use TraceManuallyBarrieredEdge here because we mark
* wrapper roots in every slice. This is because of some rule-breaking
* in RemapAllWrappersForObject; see comment there.
*/
for (WrapperValue* p = vector.begin(); p < vector.end(); p++)
MarkValueUnbarriered(trc, &p->get(), "js::AutoWrapperVector.vector");
TraceManuallyBarrieredEdge(trc, &p->get(), "js::AutoWrapperVector.vector");
return;
}
@ -299,7 +299,7 @@ AutoGCRooter::trace(JSTracer* trc)
MOZ_ASSERT(tag_ >= 0);
if (Value* vp = static_cast<AutoArrayRooter*>(this)->array)
MarkValueRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array");
TraceRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array");
}
/* static */ void
@ -323,7 +323,7 @@ AutoGCRooter::traceAllWrappers(JSTracer* trc)
void
AutoHashableValueRooter::trace(JSTracer* trc)
{
MarkValueRoot(trc, reinterpret_cast<Value*>(&value), "AutoHashableValueRooter");
TraceRoot(trc, reinterpret_cast<Value*>(&value), "AutoHashableValueRooter");
}
void
@ -346,7 +346,7 @@ JSPropertyDescriptor::trace(JSTracer* trc)
{
if (obj)
MarkObjectRoot(trc, &obj, "Descriptor::obj");
MarkValueRoot(trc, &value, "Descriptor::value");
TraceRoot(trc, &value, "Descriptor::value");
if ((attrs & JSPROP_GETTER) && getter) {
JSObject* tmp = JS_FUNC_TO_DATA_PTR(JSObject*, getter);
MarkObjectRoot(trc, &tmp, "Descriptor::get");
@ -408,8 +408,8 @@ js::gc::MarkPersistentRootedChains(JSTracer* trc)
// Mark the PersistentRooted chains of types that are never null.
PersistentRootedMarker<jsid>::markChain<MarkIdRoot>(trc, rt->idPersistentRooteds,
"PersistentRooted<jsid>");
PersistentRootedMarker<Value>::markChain<MarkValueRoot>(trc, rt->valuePersistentRooteds,
"PersistentRooted<Value>");
PersistentRootedMarker<Value>::markChain<TraceRoot>(trc, rt->valuePersistentRooteds,
"PersistentRooted<Value>");
}
void
@ -446,7 +446,7 @@ js::gc::GCRuntime::markRuntime(JSTracer* trc,
for (RootRange r = rootsHash.all(); !r.empty(); r.popFront()) {
const RootEntry& entry = r.front();
MarkValueRoot(trc, entry.key(), entry.value());
TraceRoot(trc, entry.key(), entry.value());
}
MarkPersistentRootedChains(trc);

View File

@ -78,7 +78,7 @@ StoreBuffer::ValueEdge::mark(JSTracer* trc) const
if (!deref())
return;
MarkValueRoot(trc, edge, "store buffer edge");
TraceRoot(trc, edge, "store buffer edge");
}
/*** MonoTypeBuffer ***/

View File

@ -32,7 +32,7 @@ using mozilla::DebugOnly;
JS_PUBLIC_API(void)
JS_CallUnbarrieredValueTracer(JSTracer* trc, Value* valuep, const char* name)
{
MarkValueUnbarriered(trc, valuep, name);
TraceManuallyBarrieredEdge(trc, valuep, name);
}
JS_PUBLIC_API(void)
@ -62,7 +62,7 @@ JS_CallUnbarrieredScriptTracer(JSTracer* trc, JSScript** scriptp, const char* na
JS_PUBLIC_API(void)
JS_CallValueTracer(JSTracer* trc, JS::Heap<JS::Value>* valuep, const char* name)
{
MarkValueUnbarriered(trc, valuep->unsafeGet(), name);
TraceManuallyBarrieredEdge(trc, valuep->unsafeGet(), name);
}
JS_PUBLIC_API(void)

View File

@ -23,7 +23,7 @@ MarkLocals(BaselineFrame* frame, JSTracer* trc, unsigned start, unsigned end)
if (start < end) {
// Stack grows down.
Value* last = frame->valueSlot(end - 1);
gc::MarkValueRootRange(trc, end - start, last, "baseline-stack");
TraceRootRange(trc, end - start, last, "baseline-stack");
}
}
@ -32,12 +32,12 @@ BaselineFrame::trace(JSTracer* trc, JitFrameIterator& frameIterator)
{
replaceCalleeToken(MarkCalleeToken(trc, calleeToken()));
gc::MarkValueRoot(trc, &thisValue(), "baseline-this");
TraceRoot(trc, &thisValue(), "baseline-this");
// Mark actual and formal args.
if (isNonEvalFunctionFrame()) {
unsigned numArgs = js::Max(numActualArgs(), numFormalArgs());
gc::MarkValueRootRange(trc, numArgs, argv(), "baseline-args");
TraceRootRange(trc, numArgs, argv(), "baseline-args");
}
// Mark scope chain, if it exists.
@ -46,7 +46,7 @@ BaselineFrame::trace(JSTracer* trc, JitFrameIterator& frameIterator)
// Mark return value.
if (hasReturnValue())
gc::MarkValueRoot(trc, returnValue().address(), "baseline-rval");
TraceRoot(trc, returnValue().address(), "baseline-rval");
if (isEvalFrame())
gc::MarkScriptRoot(trc, &evalScript_, "baseline-evalscript");

View File

@ -336,7 +336,7 @@ ICStub::trace(JSTracer* trc)
break;
case ICStub::GetIntrinsic_Constant: {
ICGetIntrinsic_Constant* constantStub = toGetIntrinsic_Constant();
gc::MarkValue(trc, &constantStub->value(), "baseline-getintrinsic-constant-value");
TraceEdge(trc, &constantStub->value(), "baseline-getintrinsic-constant-value");
break;
}
case ICStub::GetProp_Primitive: {

View File

@ -866,7 +866,7 @@ IonScript::trace(JSTracer* trc)
MarkJitCode(trc, &deoptTable_, "deoptimizationTable");
for (size_t i = 0; i < numConstants(); i++)
gc::MarkValue(trc, &getConstant(i), "constant");
TraceEdge(trc, &getConstant(i), "constant");
}
/* static */ void

View File

@ -1007,11 +1007,11 @@ MarkThisAndArguments(JSTracer* trc, JitFrameLayout* layout)
Value* argv = layout->argv();
// Trace |this|.
gc::MarkValueRoot(trc, argv, "ion-thisv");
TraceRoot(trc, argv, "ion-thisv");
// Trace actual arguments beyond the formals. Note + 1 for thisv.
for (size_t i = nformals + 1; i < nargs + 1; i++)
gc::MarkValueRoot(trc, &argv[i], "ion-argv");
TraceRoot(trc, &argv[i], "ion-argv");
}
static void
@ -1068,7 +1068,7 @@ MarkIonJSFrame(JSTracer* trc, const JitFrameIterator& frame)
while (safepoint.getValueSlot(&entry)) {
Value* v = (Value*)layout->slotRef(entry);
gc::MarkValueRoot(trc, v, "ion-gc-slot");
TraceRoot(trc, v, "ion-gc-slot");
}
uintptr_t* spill = frame.spillBase();
@ -1079,7 +1079,7 @@ MarkIonJSFrame(JSTracer* trc, const JitFrameIterator& frame)
if (gcRegs.has(*iter))
gc::MarkGCThingRoot(trc, reinterpret_cast<void**>(spill), "ion-gc-spill");
else if (valueRegs.has(*iter))
gc::MarkValueRoot(trc, reinterpret_cast<Value*>(spill), "ion-value-spill");
TraceRoot(trc, reinterpret_cast<Value*>(spill), "ion-value-spill");
}
#ifdef JS_NUNBOX32
@ -1090,7 +1090,7 @@ MarkIonJSFrame(JSTracer* trc, const JitFrameIterator& frame)
layout.s.payload.uintptr = ReadAllocation(frame, &payload);
Value v = IMPL_TO_JSVAL(layout);
gc::MarkValueRoot(trc, &v, "ion-torn-value");
TraceRoot(trc, &v, "ion-torn-value");
if (v != IMPL_TO_JSVAL(layout)) {
// GC moved the value, replace the stored payload.
@ -1265,7 +1265,7 @@ MarkJitExitFrameCopiedArguments(JSTracer* trc, const VMFunction* f, ExitFooterFr
if (f->argProperties(explicitArg) == VMFunction::DoubleByRef) {
// Arguments with double size can only have RootValue type.
if (f->argRootType(explicitArg) == VMFunction::RootValue)
gc::MarkValueRoot(trc, reinterpret_cast<Value*>(doubleArgs), "ion-vm-args");
TraceRoot(trc, reinterpret_cast<Value*>(doubleArgs), "ion-vm-args");
else
MOZ_ASSERT(f->argRootType(explicitArg) == VMFunction::RootNone);
doubleArgs += sizeof(double);
@ -1303,7 +1303,7 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
NativeExitFrameLayout* native = frame.exitFrame()->as<NativeExitFrameLayout>();
size_t len = native->argc() + 2;
Value* vp = native->vp();
gc::MarkValueRootRange(trc, len, vp, "ion-native-args");
TraceRootRange(trc, len, vp, "ion-native-args");
return;
}
@ -1311,9 +1311,9 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
IonOOLNativeExitFrameLayout* oolnative =
frame.exitFrame()->as<IonOOLNativeExitFrameLayout>();
gc::MarkJitCodeRoot(trc, oolnative->stubCode(), "ion-ool-native-code");
gc::MarkValueRoot(trc, oolnative->vp(), "iol-ool-native-vp");
TraceRoot(trc, oolnative->vp(), "iol-ool-native-vp");
size_t len = oolnative->argc() + 1;
gc::MarkValueRootRange(trc, len, oolnative->thisp(), "ion-ool-native-thisargs");
TraceRootRange(trc, len, oolnative->thisp(), "ion-ool-native-thisargs");
return;
}
@ -1328,7 +1328,7 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
? frame.exitFrame()->as<IonOOLPropertyOpExitFrameLayout>()
: frame.exitFrame()->as<IonOOLSetterOpExitFrameLayout>();
gc::MarkJitCodeRoot(trc, oolgetter->stubCode(), "ion-ool-property-op-code");
gc::MarkValueRoot(trc, oolgetter->vp(), "ion-ool-property-op-vp");
TraceRoot(trc, oolgetter->vp(), "ion-ool-property-op-vp");
gc::MarkIdRoot(trc, oolgetter->id(), "ion-ool-property-op-id");
gc::MarkObjectRoot(trc, oolgetter->obj(), "ion-ool-property-op-obj");
return;
@ -1337,7 +1337,7 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
if (frame.isExitFrameLayout<IonOOLProxyExitFrameLayout>()) {
IonOOLProxyExitFrameLayout* oolproxy = frame.exitFrame()->as<IonOOLProxyExitFrameLayout>();
gc::MarkJitCodeRoot(trc, oolproxy->stubCode(), "ion-ool-proxy-code");
gc::MarkValueRoot(trc, oolproxy->vp(), "ion-ool-proxy-vp");
TraceRoot(trc, oolproxy->vp(), "ion-ool-proxy-vp");
gc::MarkIdRoot(trc, oolproxy->id(), "ion-ool-proxy-id");
gc::MarkObjectRoot(trc, oolproxy->proxy(), "ion-ool-proxy-proxy");
gc::MarkObjectRoot(trc, oolproxy->receiver(), "ion-ool-proxy-receiver");
@ -1352,9 +1352,9 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
reinterpret_cast<IonDOMMethodExitFrameLayout*>(dom);
size_t len = method->argc() + 2;
Value* vp = method->vp();
gc::MarkValueRootRange(trc, len, vp, "ion-dom-args");
TraceRootRange(trc, len, vp, "ion-dom-args");
} else {
gc::MarkValueRoot(trc, dom->vp(), "ion-dom-args");
TraceRoot(trc, dom->vp(), "ion-dom-args");
}
return;
}
@ -1402,7 +1402,7 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
gc::MarkObjectRoot(trc, reinterpret_cast<JSFunction**>(argBase), "ion-vm-args");
break;
case VMFunction::RootValue:
gc::MarkValueRoot(trc, reinterpret_cast<Value*>(argBase), "ion-vm-args");
TraceRoot(trc, reinterpret_cast<Value*>(argBase), "ion-vm-args");
break;
case VMFunction::RootCell:
gc::MarkGCThingRoot(trc, reinterpret_cast<void**>(argBase), "ion-vm-args");
@ -1436,7 +1436,7 @@ MarkJitExitFrame(JSTracer* trc, const JitFrameIterator& frame)
gc::MarkObjectRoot(trc, footer->outParam<JSFunction*>(), "ion-vm-out");
break;
case VMFunction::RootValue:
gc::MarkValueRoot(trc, footer->outParam<Value>(), "ion-vm-outvp");
TraceRoot(trc, footer->outParam<Value>(), "ion-vm-outvp");
break;
case VMFunction::RootCell:
gc::MarkGCThingRoot(trc, footer->outParam<void*>(), "ion-vm-out");
@ -1455,7 +1455,7 @@ MarkRectifierFrame(JSTracer* trc, const JitFrameIterator& frame)
// Baseline JIT code generated as part of the ICCall_Fallback stub may use
// it if we're calling a constructor that returns a primitive value.
RectifierFrameLayout* layout = (RectifierFrameLayout*)frame.fp();
gc::MarkValueRoot(trc, &layout->argv()[0], "ion-thisv");
TraceRoot(trc, &layout->argv()[0], "ion-thisv");
}
static void
@ -1705,7 +1705,7 @@ RInstructionResults::trace(JSTracer* trc)
{
// Note: The vector necessary exists, otherwise this object would not have
// been stored on the activation from where the trace function is called.
gc::MarkValueRange(trc, results_->length(), results_->begin(), "ion-recover-results");
TraceRange(trc, results_->length(), results_->begin(), "ion-recover-results");
}
@ -2083,7 +2083,7 @@ SnapshotIterator::traceAllocation(JSTracer* trc)
return;
Value copy = v;
gc::MarkValueRoot(trc, &v, "ion-typed-reg");
TraceRoot(trc, &v, "ion-typed-reg");
if (v != copy) {
MOZ_ASSERT(SameType(v, copy));
writeAllocationValuePayload(alloc, v);

View File

@ -149,10 +149,9 @@ RematerializedFrame::mark(JSTracer* trc)
{
gc::MarkScriptRoot(trc, &script_, "remat ion frame script");
gc::MarkObjectRoot(trc, &scopeChain_, "remat ion frame scope chain");
gc::MarkValueRoot(trc, &returnValue_, "remat ion frame return value");
gc::MarkValueRoot(trc, &thisValue_, "remat ion frame this");
gc::MarkValueRootRange(trc, slots_, slots_ + numActualArgs_ + script_->nfixed(),
"remat ion frame stack");
TraceRoot(trc, &returnValue_, "remat ion frame return value");
TraceRoot(trc, &thisValue_, "remat ion frame this");
TraceRootRange(trc, numActualArgs_ + script_->nfixed(), slots_, "remat ion frame stack");
}
void

View File

@ -1243,7 +1243,7 @@ ObjectIsCallable(JSObject* obj)
void
MarkValueFromIon(JSRuntime* rt, Value* vp)
{
gc::MarkValueUnbarriered(&rt->gc.marker, vp, "write barrier");
TraceManuallyBarrieredEdge(&rt->gc.marker, vp, "write barrier");
}
void

View File

@ -61,7 +61,7 @@ TraceDataRelocations(JSTracer* trc, uint8_t* buffer, CompactBufferReader& reader
jsval_layout layout;
layout.asBits = *word;
Value v = IMPL_TO_JSVAL(layout);
gc::MarkValueUnbarriered(trc, &v, "ion-masm-value");
TraceManuallyBarrieredEdge(trc, &v, "ion-masm-value");
*word = JSVAL_TO_IMPL(v).asBits;
continue;
}

View File

@ -1113,7 +1113,7 @@ JSContext::mark(JSTracer* trc)
/* Mark other roots-by-definition in the JSContext. */
if (isExceptionPending())
MarkValueRoot(trc, &unwrappedException_, "unwrapped exception");
TraceRoot(trc, &unwrappedException_, "unwrapped exception");
TraceCycleDetectionSet(trc, cycleDetectorSet);

View File

@ -492,7 +492,7 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer* trc)
* We have a cross-compartment wrapper. Its private pointer may
* point into the compartment being collected, so we should mark it.
*/
MarkValue(trc, wrapper->slotOfPrivate(), "cross-compartment wrapper");
TraceEdge(trc, wrapper->slotOfPrivate(), "cross-compartment wrapper");
}
}
}

View File

@ -721,8 +721,8 @@ inline void
JSFunction::trace(JSTracer* trc)
{
if (isExtended()) {
MarkValueRange(trc, ArrayLength(toExtended()->extendedSlots),
toExtended()->extendedSlots, "nativeReserved");
TraceRange(trc, ArrayLength(toExtended()->extendedSlots),
(HeapValue*)toExtended()->extendedSlots, "nativeReserved");
}
if (atom_)

View File

@ -3434,7 +3434,7 @@ JSScript::markChildren(JSTracer* trc)
if (hasConsts()) {
ConstArray* constarray = consts();
MarkValueRange(trc, constarray->length, constarray->vector, "consts");
TraceRange(trc, constarray->length, constarray->vector, "consts");
}
if (sourceObject()) {

View File

@ -634,14 +634,14 @@ ProxyObject::trace(JSTracer* trc, JSObject* obj)
// Note: If you add new slots here, make sure to change
// nuke() to cope.
TraceCrossCompartmentEdge(trc, obj, proxy->slotOfPrivate(), "private");
MarkValue(trc, proxy->slotOfExtra(0), "extra0");
TraceEdge(trc, proxy->slotOfExtra(0), "extra0");
/*
* The GC can use the second reserved slot to link the cross compartment
* wrappers into a linked list, in which case we don't want to trace it.
*/
if (!proxy->is<CrossCompartmentWrapperObject>())
MarkValue(trc, proxy->slotOfExtra(1), "extra1");
TraceEdge(trc, proxy->slotOfExtra(1), "extra1");
Proxy::trace(trc, obj);
}

View File

@ -543,8 +543,8 @@ ArgumentsObject::trace(JSTracer* trc, JSObject* obj)
{
ArgumentsObject& argsobj = obj->as<ArgumentsObject>();
ArgumentsData* data = argsobj.data();
MarkValue(trc, &data->callee, js_callee_str);
MarkValueRange(trc, data->numArgs, data->args, js_arguments_str);
TraceEdge(trc, &data->callee, js_callee_str);
TraceRange(trc, data->numArgs, data->begin(), js_arguments_str);
MarkScriptUnbarriered(trc, &data->script, "script");
}

View File

@ -62,6 +62,12 @@ struct ArgumentsData
/* For jit use: */
static ptrdiff_t offsetOfArgs() { return offsetof(ArgumentsData, args); }
/* Iterate args. */
HeapValue* begin() { return args; }
const HeapValue* begin() const { return args; }
HeapValue* end() { return args + numArgs; }
const HeapValue* end() const { return args + numArgs; }
};
// Maximum supported value of arguments.length. This bounds the maximum

View File

@ -47,11 +47,11 @@ JSONParserBase::trace(JSTracer* trc)
if (stack[i].state == FinishArrayElement) {
ElementVector& elements = stack[i].elements();
for (size_t j = 0; j < elements.length(); j++)
gc::MarkValueRoot(trc, &elements[j], "JSONParser element");
TraceRoot(trc, &elements[j], "JSONParser element");
} else {
PropertyVector& properties = stack[i].properties();
for (size_t j = 0; j < properties.length(); j++) {
gc::MarkValueRoot(trc, &properties[j].value, "JSONParser property value");
TraceRoot(trc, &properties[j].value, "JSONParser property value");
gc::MarkIdRoot(trc, &properties[j].id, "JSONParser property id");
}
}

View File

@ -260,8 +260,8 @@ js::ForOfPIC::Chain::mark(JSTracer* trc)
gc::MarkShape(trc, &arrayProtoShape_, "ForOfPIC Array.prototype shape.");
gc::MarkShape(trc, &arrayIteratorProtoShape_, "ForOfPIC ArrayIterator.prototype shape.");
gc::MarkValue(trc, &canonicalIteratorFunc_, "ForOfPIC ArrayValues builtin.");
gc::MarkValue(trc, &canonicalNextFunc_, "ForOfPIC ArrayIterator.prototype.next builtin.");
TraceEdge(trc, &canonicalIteratorFunc_, "ForOfPIC ArrayValues builtin.");
TraceEdge(trc, &canonicalNextFunc_, "ForOfPIC ArrayIterator.prototype.next builtin.");
// Free all the stubs in the chain.
while (stubs_)

View File

@ -345,14 +345,14 @@ InterpreterFrame::mark(JSTracer* trc)
if (trc->isMarkingTracer())
script()->compartment()->zone()->active = true;
if (hasReturnValue())
gc::MarkValueUnbarriered(trc, &rval_, "rval");
TraceManuallyBarrieredEdge(trc, &rval_, "rval");
}
void
InterpreterFrame::markValues(JSTracer* trc, unsigned start, unsigned end)
{
if (start < end)
gc::MarkValueRootRange(trc, end - start, slots() + start, "vm_stack");
TraceRootRange(trc, end - start, slots() + start, "vm_stack");
}
void
@ -396,10 +396,10 @@ InterpreterFrame::markValues(JSTracer* trc, Value* sp, jsbytecode* pc)
if (hasArgs()) {
// Mark callee, |this| and arguments.
unsigned argc = Max(numActualArgs(), numFormalArgs());
gc::MarkValueRootRange(trc, argc + 2, argv_ - 2, "fp argv");
TraceRootRange(trc, argc + 2, argv_ - 2, "fp argv");
} else {
// Mark callee and |this|
gc::MarkValueRootRange(trc, 2, ((Value*)this) - 2, "stack callee and this");
TraceRootRange(trc, 2, ((Value*)this) - 2, "stack callee and this");
}
}