mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1503170 part 3 - Remove unused CGResumeOffsetList::numAwaits, move numYields to BytecodeEmitter. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D10686 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8f3823c37a
commit
7d9c159b47
@ -116,6 +116,7 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
|
||||
tryNoteList(cx),
|
||||
scopeNoteList(cx),
|
||||
resumeOffsetList(cx),
|
||||
numYields(0),
|
||||
typesetCount(0),
|
||||
hasSingletons(false),
|
||||
hasTryFinally(false),
|
||||
@ -2219,11 +2220,8 @@ BytecodeEmitter::emitYieldOp(JSOp op)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (op == JSOP_AWAIT) {
|
||||
resumeOffsetList.numAwaits++;
|
||||
} else {
|
||||
resumeOffsetList.numYields++;
|
||||
if (op == JSOP_INITIALYIELD || op == JSOP_YIELD) {
|
||||
numYields++;
|
||||
}
|
||||
|
||||
uint32_t resumeIndex;
|
||||
|
@ -100,9 +100,7 @@ struct CGScopeNoteList {
|
||||
|
||||
struct CGResumeOffsetList {
|
||||
Vector<uint32_t> list;
|
||||
uint32_t numYields;
|
||||
uint32_t numAwaits;
|
||||
explicit CGResumeOffsetList(JSContext* cx) : list(cx), numYields(0), numAwaits(0) {}
|
||||
explicit CGResumeOffsetList(JSContext* cx) : list(cx) {}
|
||||
|
||||
MOZ_MUST_USE bool append(uint32_t offset) { return list.append(offset); }
|
||||
size_t length() const { return list.length(); }
|
||||
@ -209,6 +207,9 @@ struct MOZ_STACK_CLASS BytecodeEmitter
|
||||
// code array).
|
||||
CGResumeOffsetList resumeOffsetList;
|
||||
|
||||
// Number of yield instructions emitted. Does not include JSOP_AWAIT.
|
||||
uint32_t numYields;
|
||||
|
||||
uint16_t typesetCount; /* Number of JOF_TYPESET opcodes generated */
|
||||
|
||||
bool hasSingletons:1; /* script contains singleton initializer JSOP_OBJECT */
|
||||
|
@ -32,7 +32,7 @@ ForOfLoopControl::emitBeginCodeNeedingIteratorClose(BytecodeEmitter* bce)
|
||||
}
|
||||
|
||||
MOZ_ASSERT(numYieldsAtBeginCodeNeedingIterClose_ == UINT32_MAX);
|
||||
numYieldsAtBeginCodeNeedingIterClose_ = bce->resumeOffsetList.numYields;
|
||||
numYieldsAtBeginCodeNeedingIterClose_ = bce->numYields;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -86,7 +86,7 @@ ForOfLoopControl::emitEndCodeNeedingIteratorClose(BytecodeEmitter* bce)
|
||||
// If any yields were emitted, then this for-of loop is inside a star
|
||||
// generator and must handle the case of Generator.return. Like in
|
||||
// yield*, it is handled with a finally block.
|
||||
uint32_t numYieldsEmitted = bce->resumeOffsetList.numYields;
|
||||
uint32_t numYieldsEmitted = bce->numYields;
|
||||
if (numYieldsEmitted > numYieldsAtBeginCodeNeedingIterClose_) {
|
||||
if (!tryCatch_->emitFinally()) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user