Closed Bug 1452818 Opened 5 years ago Closed 5 years ago

Eliminate the need for BytecodeCompiler::startPosition to be default-constructable


(Core :: JavaScript Engine, enhancement)

Not set



Tracking Status
firefox61 --- fixed


(Reporter: Waldo, Assigned: Waldo)



(2 files)

Some of the Unicode character-type work wants to be able to create character iterators that have Rust-like borrow-checking semantics.  Part of this requires that iterators always be initialized, which means they should never be default-constructed.

Unfortunately, TokenStreamCharsBase::Position *is* default-constructed now.  This can be fixed: move the single Position where this is necessary to a location where it can be constructed fully initialized, and then initialize those positions by directly constructing them from a |tokenStream|.
This doesn't really change anything, but it does get rid of a very small amount of useless code-execution when not compiling things that don't have handleParseFailure failure modes.
Attachment #8966427 - Flags: review?(arai.unmht)
Attachment #8966427 - Flags: review?(arai.unmht) → review+
Attachment #8966428 - Flags: review?(arai.unmht) → review+
Pushed by
Move BytecodeCompiler::startPosition into more locally-scoped stack-frame variables.  r=arai
Make tokenstream positions be created by constructor-call so that their members don't have to be default-constructible.  r=arai
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Oh, for anyone wondering -- we have to have a |Position foo(...)| local declared that way, not a function that returns a Position, because returning a Position that way pre-C++17 is not guaranteed to not need to invoke a copy constructor or similar, and I may need to have that requirement for the work that motivated this.
You need to log in before you can comment on or make changes to this bug.