diff --git a/js/src/vm/String-inl.h b/js/src/vm/String-inl.h index 771e6929cbe..4c8f4907be0 100644 --- a/js/src/vm/String-inl.h +++ b/js/src/vm/String-inl.h @@ -93,6 +93,8 @@ JSRope::init(JSString *left, JSString *right, size_t length) d.lengthAndFlags = buildLengthAndFlags(length, ROPE_BIT); d.u1.left = left; d.s.u2.right = right; + JSString::writeBarrierPost(d.u1.left, &d.u1.left); + JSString::writeBarrierPost(d.s.u2.right, &d.s.u2.right); } JS_ALWAYS_INLINE JSRope * @@ -113,6 +115,7 @@ JSDependentString::init(JSLinearString *base, const jschar *chars, size_t length d.lengthAndFlags = buildLengthAndFlags(length, DEPENDENT_BIT); d.u1.chars = chars; d.s.u2.base = base; + JSString::writeBarrierPost(d.s.u2.base, &d.s.u2.base); } JS_ALWAYS_INLINE JSDependentString * diff --git a/js/src/vm/String.cpp b/js/src/vm/String.cpp index ef7ad5076e7..1e832644798 100644 --- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -187,7 +187,7 @@ JSRope::flattenInternal(JSContext *maybecx) JSExtensibleString &left = this->leftChild()->asExtensible(); size_t capacity = left.capacity(); if (capacity >= wholeLength) { - if (b == WithBarrier) { + if (b == WithIncrementalBarrier) { JSString::writeBarrierPre(d.u1.left); JSString::writeBarrierPre(d.s.u2.right); } @@ -198,8 +198,7 @@ JSRope::flattenInternal(JSContext *maybecx) pos = wholeChars + (bits >> LENGTH_SHIFT); left.d.lengthAndFlags = bits ^ (EXTENSIBLE_FLAGS | DEPENDENT_BIT); left.d.s.u2.base = (JSLinearString *)this; /* will be true on exit */ - if (b == WithBarrier) - JSString::writeBarrierPost(this, &left.d.s.u2.base); + JSString::writeBarrierPost(left.d.s.u2.base, &left.d.s.u2.base); goto visit_right_child; } } @@ -209,7 +208,7 @@ JSRope::flattenInternal(JSContext *maybecx) pos = wholeChars; first_visit_node: { - if (b == WithBarrier) { + if (b == WithIncrementalBarrier) { JSString::writeBarrierPre(str->d.u1.left); JSString::writeBarrierPre(str->d.s.u2.right); } @@ -250,8 +249,7 @@ JSRope::flattenInternal(JSContext *maybecx) size_t progress = str->d.lengthAndFlags; str->d.lengthAndFlags = buildLengthAndFlags(pos - str->d.u1.chars, DEPENDENT_BIT); str->d.s.u2.base = (JSLinearString *)this; /* will be true on exit */ - if (b == WithBarrier) - JSString::writeBarrierPost(this, &str->d.s.u2.base); + JSString::writeBarrierPost(str->d.s.u2.base, &str->d.s.u2.base); str = str->d.s.u3.parent; if (progress == 0x200) goto visit_right_child; @@ -265,7 +263,7 @@ JSRope::flatten(JSContext *maybecx) { #if JSGC_INCREMENTAL if (compartment()->needsBarrier()) - return flattenInternal(maybecx); + return flattenInternal(maybecx); else return flattenInternal(maybecx); #else diff --git a/js/src/vm/String.h b/js/src/vm/String.h index 3511d455ea1..6dc4cb8cd93 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -426,7 +426,7 @@ class JSString : public js::gc::Cell class JSRope : public JSString { - enum UsingBarrier { WithBarrier, NoBarrier }; + enum UsingBarrier { WithIncrementalBarrier, NoBarrier }; template JSFlatString *flattenInternal(JSContext *cx);