From 4d5a126c0f740e0c239efdd843cdab197557916e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 7 Apr 2022 11:12:54 +0000 Subject: [PATCH] Bug 1763103 - Part 4: Only initialise home object for private instance accessors when neeeded. r=arai Private instance accessors were always initialising the home object, even when `needsHomeObject()` was `false`. Depends on D142931 Differential Revision: https://phabricator.services.mozilla.com/D142932 --- js/src/frontend/BytecodeEmitter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 3ff9d0faef84..f0483c5e4037 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -9862,11 +9862,13 @@ bool BytecodeEmitter::emitPrivateMethodInitializers(ClassEmitter& ce, } // The private method body needs to access the home object, // and the CE knows where that is on the stack. - if (!ce.emitMemberInitializerHomeObject(false)) { - // [stack] HOMEOBJ HERITAGE? ARRAY METHOD - // or: - // [stack] CTOR HOMEOBJ ARRAY METHOD - return false; + if (classMethod->method().funbox()->needsHomeObject()) { + if (!ce.emitMemberInitializerHomeObject(false)) { + // [stack] HOMEOBJ HERITAGE? ARRAY METHOD + // or: + // [stack] CTOR HOMEOBJ ARRAY METHOD + return false; + } } if (!emitLexicalInitialization(storedMethodAtom)) { // [stack] HOMEOBJ HERITAGE? ARRAY METHOD