Bug 1574180 - Part 3: Remove special-case for inferred empty name string. r=khyperia

An absent name and an empty string as the inferred name are now
indistinguishable, so we can remove the special case for empty strings in
ObjectEmitter.

Depends on D42154

Differential Revision: https://phabricator.services.mozilla.com/D42155

--HG--
extra : moz-landing-system : lando
This commit is contained in:
André Bargull 2019-08-16 20:19:21 +00:00
parent 5e05a4da7e
commit 2900da90f1
2 changed files with 0 additions and 26 deletions

View File

@ -685,15 +685,6 @@ bool ClassEmitter::emitInitDefaultConstructor(const Maybe<uint32_t>& classStart,
}
}
// The empty string is used as a placeholder, so if the inferred name for this
// anonymous class expression is also the empty string, we need to set it
// explicitly here.
if (nameForAnonymousClass_ == bce_->cx->names().empty) {
if (!emitSetEmptyClassConstructorNameForDefaultCtor()) {
return false;
}
}
if (!initProtoAndCtor()) {
// [stack] CTOR HOMEOBJ
return false;
@ -705,22 +696,6 @@ bool ClassEmitter::emitInitDefaultConstructor(const Maybe<uint32_t>& classStart,
return true;
}
bool ClassEmitter::emitSetEmptyClassConstructorNameForDefaultCtor() {
uint32_t nameIndex;
if (!bce_->makeAtomIndex(bce_->cx->names().empty, &nameIndex)) {
return false;
}
if (!bce_->emitIndexOp(JSOP_STRING, nameIndex)) {
// [stack] CTOR NAME
return false;
}
if (!bce_->emit2(JSOP_SETFUNNAME, uint8_t(FunctionPrefixKind::None))) {
// [stack] CTOR
return false;
}
return true;
}
bool ClassEmitter::initProtoAndCtor() {
// [stack] NAME? HOMEOBJ CTOR

View File

@ -776,7 +776,6 @@ class MOZ_STACK_CLASS ClassEmitter : public PropertyEmitter {
MOZ_MUST_USE bool emitEnd(Kind kind);
private:
MOZ_MUST_USE bool emitSetEmptyClassConstructorNameForDefaultCtor();
MOZ_MUST_USE bool initProtoAndCtor();
};