From 2900da90f18fb9233b9d151954165a3bcfcd9b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Fri, 16 Aug 2019 20:19:21 +0000 Subject: [PATCH] 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 --- js/src/frontend/ObjectEmitter.cpp | 25 ------------------------- js/src/frontend/ObjectEmitter.h | 1 - 2 files changed, 26 deletions(-) diff --git a/js/src/frontend/ObjectEmitter.cpp b/js/src/frontend/ObjectEmitter.cpp index 73240dab78ad..7c9165982158 100644 --- a/js/src/frontend/ObjectEmitter.cpp +++ b/js/src/frontend/ObjectEmitter.cpp @@ -685,15 +685,6 @@ bool ClassEmitter::emitInitDefaultConstructor(const Maybe& 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& 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 diff --git a/js/src/frontend/ObjectEmitter.h b/js/src/frontend/ObjectEmitter.h index f416b645d681..f3bda702f4df 100644 --- a/js/src/frontend/ObjectEmitter.h +++ b/js/src/frontend/ObjectEmitter.h @@ -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(); };