Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 731837 - Fix GC mark time regression from IGC (r=igor,a=lsblakk)

  • Loading branch information...
commit 61c118a654f522751d4aae1f4b1bd315262ef809 1 parent 154c7a3
Bill McCloskey authored
Showing with 27 additions and 26 deletions.
  1. +2 −1  js/src/jsgc.cpp
  2. +1 −3 js/src/jsgc.h
  3. +24 −22 js/src/jsgcmark.cpp
View
3  js/src/jsgc.cpp
@@ -2468,7 +2468,8 @@ MaybeGC(JSContext *cx)
comp->gcBytes >= 3 * (comp->gcTriggerBytes / 4) &&
rt->gcIncrementalState == NO_INCREMENTAL)
{
- GCSlice(cx, NULL, GC_NORMAL, gcreason::MAYBEGC);
+ GCSlice(cx, (rt->gcMode == JSGC_MODE_COMPARTMENT) ? comp : NULL,
+ GC_NORMAL, gcreason::MAYBEGC);
return;
}
View
4 js/src/jsgc.h
@@ -1857,9 +1857,6 @@ struct GCMarker : public JSTracer {
void pushValueArray(JSObject *obj, void *start, void *end) {
checkCompartment(obj);
- if (start == end)
- return;
-
JS_ASSERT(start <= end);
uintptr_t tagged = reinterpret_cast<uintptr_t>(obj) | GCMarker::ValueArrayTag;
uintptr_t startAddr = reinterpret_cast<uintptr_t>(start);
@@ -1880,6 +1877,7 @@ struct GCMarker : public JSTracer {
bool restoreValueArray(JSObject *obj, void **vpp, void **endp);
void saveValueRanges();
inline void processMarkStackTop(SliceBudget &budget);
+ void processMarkStackOther(uintptr_t tag, uintptr_t addr);
void appendGrayRoot(void *thing, JSGCTraceKind kind);
View
46 js/src/jsgcmark.cpp
@@ -901,7 +901,9 @@ GCMarker::saveValueRanges()
} else {
HeapSlot *vp = obj->fixedSlots();
unsigned nfixed = obj->numFixedSlots();
- if (arr->start >= vp && arr->start < vp + nfixed) {
+ if (arr->start == arr->end) {
+ arr->index = obj->slotSpan();
+ } if (arr->start >= vp && arr->start < vp + nfixed) {
JS_ASSERT(arr->end == vp + Min(nfixed, obj->slotSpan()));
arr->index = arr->start - vp;
} else {
@@ -918,7 +920,7 @@ GCMarker::saveValueRanges()
}
}
-bool
+JS_NEVER_INLINE bool
GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp)
{
uintptr_t start = stack.pop();
@@ -960,6 +962,25 @@ GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp)
return true;
}
+void
+GCMarker::processMarkStackOther(uintptr_t tag, uintptr_t addr)
+{
+ if (tag == TypeTag) {
+ ScanTypeObject(this, reinterpret_cast<types::TypeObject *>(addr));
+ } else if (tag == SavedValueArrayTag) {
+ JS_ASSERT(!(addr & Cell::CellMask));
+ JSObject *obj = reinterpret_cast<JSObject *>(addr);
+ HeapValue *vp, *end;
+ if (restoreValueArray(obj, (void **)&vp, (void **)&end))
+ pushValueArray(obj, vp, end);
+ else
+ pushObject(obj);
+ } else {
+ JS_ASSERT(tag == XmlTag);
+ MarkChildren(this, reinterpret_cast<JSXML *>(addr));
+ }
+}
+
inline void
GCMarker::processMarkStackTop(SliceBudget &budget)
{
@@ -994,31 +1015,12 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
goto scan_obj;
}
- if (tag == TypeTag) {
- ScanTypeObject(this, reinterpret_cast<types::TypeObject *>(addr));
- } else if (tag == SavedValueArrayTag) {
- JS_ASSERT(!(addr & Cell::CellMask));
- obj = reinterpret_cast<JSObject *>(addr);
- if (restoreValueArray(obj, (void **)&vp, (void **)&end))
- goto scan_value_array;
- else
- goto scan_obj;
- } else {
- JS_ASSERT(tag == XmlTag);
- MarkChildren(this, reinterpret_cast<JSXML *>(addr));
- }
- budget.step();
+ processMarkStackOther(tag, addr);
return;
scan_value_array:
JS_ASSERT(vp <= end);
while (vp != end) {
- budget.step();
- if (budget.isOverBudget()) {
- pushValueArray(obj, vp, end);
- return;
- }
-
const Value &v = *vp++;
if (v.isString()) {
JSString *str = v.toString();
Please sign in to comment.
Something went wrong with that request. Please try again.