Closed Bug 1011693 Opened 6 years ago Closed 6 years ago

Store dollar index instead of jschar* in ReplaceData

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(3 files)

We want this for both ASCII strings and nursery-allocated strings/chars.
dollarEnd is repstr->chars() + repstr->length(). There's no need to store it separately.
Attachment #8424129 - Flags: review?(terrence)
Rewrites two loops a bit to prepare for the next patch.
Attachment #8424132 - Flags: review?(terrence)
s/ReplaceData::dollar/ReplaceData::dollarIndex.

Also removed the ENSURE() macro for error handling while I was there. if (!x) return false; is an extra line but it's much clearer.
Attachment #8424134 - Flags: review?(terrence)
Comment on attachment 8424129 [details] [diff] [review]
Part 1 - rm ReplaceData::dollarEnd

Review of attachment 8424129 [details] [diff] [review]:
-----------------------------------------------------------------

I had forgotten how horrific the existing code here is. r=me
Attachment #8424129 - Flags: review?(terrence) → review+
Comment on attachment 8424132 [details] [diff] [review]
Part 2 - Refactor some loops

Review of attachment 8424132 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #8424132 - Flags: review?(terrence) → review+
Comment on attachment 8424134 [details] [diff] [review]
Part 3 - Store dollar position as index instead of jschar*

Review of attachment 8424134 [details] [diff] [review]:
-----------------------------------------------------------------

Nice! r=me
Attachment #8424134 - Flags: review?(terrence) → review+
You need to log in before you can comment on or make changes to this bug.