@@ -764,10 +764,10 @@ JSLinearString* JSRope::flattenInternal(JSRope* root) {
764
764
}
765
765
}
766
766
767
- JSString * str = root;
767
+ JSRope * str = root;
768
768
CharT* pos = wholeChars;
769
769
770
- JSString * parent = nullptr ;
770
+ JSRope * parent = nullptr ;
771
771
uint32_t parentFlag = 0 ;
772
772
773
773
first_visit_node : {
@@ -786,7 +786,7 @@ first_visit_node : {
786
786
/* Return to this node when 'left' done, then goto visit_right_child. */
787
787
parent = str;
788
788
parentFlag = FLATTEN_VISIT_RIGHT;
789
- str = &left;
789
+ str = &left. asRope () ;
790
790
goto first_visit_node;
791
791
}
792
792
if (!(reuseLeftmostBuffer && &left == leftmostChild)) {
@@ -801,7 +801,7 @@ visit_right_child : {
801
801
/* Return to this node when 'right' done, then goto finish_node. */
802
802
parent = str;
803
803
parentFlag = FLATTEN_FINISH_NODE;
804
- str = &right;
804
+ str = &right. asRope () ;
805
805
goto first_visit_node;
806
806
}
807
807
CopyChars (pos, right.asLinear ());
@@ -815,7 +815,7 @@ finish_node : {
815
815
816
816
MOZ_ASSERT (pos >= wholeChars);
817
817
CharT* chars = pos - str->length ();
818
- JSString * strParent = str->d .s .u2 .parent ;
818
+ JSRope * strParent = str->d .s .u2 .parent ;
819
819
str->setNonInlineChars (chars);
820
820
821
821
MOZ_ASSERT (str->asRope ().isBeingFlattened ());
@@ -826,7 +826,8 @@ finish_node : {
826
826
// This also clears the flags related to flattening.
827
827
str->setLengthAndFlags (str->length (),
828
828
StringFlagsForCharType<CharT>(INIT_DEPENDENT_FLAGS));
829
- str->d .s .u3 .base = (JSLinearString*)root; /* will be true on exit */
829
+ str->d .s .u3 .base =
830
+ reinterpret_cast <JSLinearString*>(root); /* will be true on exit */
830
831
831
832
// Every interior (rope) node in the rope's tree will be visited during
832
833
// the traversal and post-barriered here, so earlier additions of
@@ -887,14 +888,11 @@ finish_node : {
887
888
888
889
template <JSRope::UsingBarrier usingBarrier>
889
890
/* static */
890
- inline void JSRope::ropeBarrierDuringFlattening (JSString* str) {
891
- // |str| is a rope but its flags maybe have been overwritten by temporary data
892
- // at this point.
893
- MOZ_ASSERT (str->isRope ());
894
- MOZ_ASSERT (!str->asRope ().isBeingFlattened ());
891
+ inline void JSRope::ropeBarrierDuringFlattening (JSRope* rope) {
892
+ MOZ_ASSERT (!rope->isBeingFlattened ());
895
893
if constexpr (usingBarrier) {
896
- gc::PreWriteBarrierDuringFlattening (str-> d . s . u2 . left );
897
- gc::PreWriteBarrierDuringFlattening (str-> d . s . u3 . right );
894
+ gc::PreWriteBarrierDuringFlattening (rope-> leftChild () );
895
+ gc::PreWriteBarrierDuringFlattening (rope-> rightChild () );
898
896
}
899
897
}
900
898
0 commit comments