Closed Bug 780765 Opened 13 years ago Closed 13 years ago

Do not allow DependentStrings to depend on InlineStrings

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: terrence, Assigned: terrence)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch v0 (obsolete) — Splinter Review
These should just store the chars inline anyway, and we can avoid a nasty moving GC hazard by doing so.
Attachment #649451 - Flags: review?(luke)
Comment on attachment 649451 [details] [diff] [review] v0 Review of attachment 649451 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/vm/String-inl.h @@ +132,3 @@ > */ > + if (base->isInline()) { > + JS::SkipRoot charsRoot(cx, &chars); Instead of this whole block. Can you use NewShortString?
Comment on attachment 649451 [details] [diff] [review] v0 Review of attachment 649451 [details] [diff] [review]: ----------------------------------------------------------------- Could you also add a JS_ASSERT(!d.s.u2.base->isInlineString()) to JSString::base()? ::: js/src/vm/String-inl.h @@ +132,2 @@ > */ > + if (base->isInline()) { As the String.h comment points out: isInline() isn't a very fast query, since it ends up looking at the arena kind in the case of short strings. Could we instead just write: if (JSShortString::lengthFits(base->length())) @@ +145,5 @@ > + if (!str) > + return NULL; > + str->initAtOffsetInBuffer(str->inlineStorageBeforeInit(), length); > + js::PodCopy((jschar *)str->chars(), chars, length); > + return str; I think you can just write: if (base->isInline()) return NewShortString(cx, chars, length);
Attachment #649451 - Flags: review?(luke) → review+
(In reply to Benjamin Peterson from comment #1) > Instead of this whole block. Can you use NewShortString? Doh!
Attached patch v1 (obsolete) — Splinter Review
Well, I had to forward-declare NewShortString, but it's still less gross than accidentally inlining it. :-) https://tbpl.mozilla.org/?tree=Try&rev=6c198f4d9e9a
Attachment #649451 - Attachment is obsolete: true
Attachment #649471 - Flags: review+
Another option would be to dump JSDependentString::new_ in String-inl.h.
Well, it's all already in vm/String-inl.h. I have moved NewShortString fully to the top of the file rather than forward declaring it. It doesn't seem to have depended on anything above it. https://tbpl.mozilla.org/?tree=Try&rev=45022f50a4f8
Attachment #649471 - Attachment is obsolete: true
Attachment #649703 - Flags: review+
The last try run seems broken on windows and mac for unrelated reasons: https://tbpl.mozilla.org/?tree=Try&rev=e28a7f56bbdb
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Depends on: 808834
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: