Changeset 278591 in webkit


Ignore:
Timestamp:
Jun 7, 2021, 8:22:27 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Use ResolvedClosureVar to get brand from scope
https://bugs.webkit.org/show_bug.cgi?id=226677
rdar://78802869

Reviewed by Saam Barati.

JSTests:

  • stress/private-access-nested-eval.js: Added.

(shouldThrow):
(shouldThrow.prototype.x):
(shouldThrow.prototype.m.C.prototype.z):
(shouldThrow.prototype.m.C.prototype.a):
(shouldThrow.prototype.m.C):
(shouldThrow.prototype.m):

  • stress/private-access-nested.js: Added.

(shouldThrow):
(shouldThrow.prototype.x):
(shouldThrow.prototype.m.C.prototype.z):
(shouldThrow.prototype.m.C.prototype.a):
(shouldThrow.prototype.m.C):
(shouldThrow.prototype.m):

Source/JavaScriptCore:

Private brand lookup is doing wrong way to get scope.

  1. op_resolve_scope with private name (e.g. #x)
  2. then, doing op_get_from_scope with (1)'s scope with different name (e.g. @privateBrand)

This is wrong in JSC. We resolve scope at link-time in CodeBlock. So we need to ensure that both op_resolve_scope and op_get_from_scope
starts with the current scope-register. As a result, private-brand lookup is broken right now. Let's see the buggy case.

class D {

#x() {}
m() {

class C {

#yy;
#z() { }
a() {

this.#x(); <===== This point.

}

}
let c = new C();
c.a();

}

}

In the above point, we first lookup the scope with #x, and we get the D's class-scope. But our get_from_scope is using privateBrand, and
privateBrand property exists too in C's class-scope too since C also has #yy and #z. As a result, CodeBlock linking configures the offset for
C's class-scope in get_from_scope. And this offset is different from D's class-scope's privateBrand.

Only allowed case for the above usage is ResolvedClosureVar. And generatorification uses it too. In this patch,

  1. We ensure that class-scope (with private name) must have @privateBrand and @privateClassBrand with offset 1 and 0.
  2. Use ResolvedClosureVar with the above pre-defined offset

Since CodeBlock's linking does not resolve the scope for get_from_scope if it is ResolvedClosureVar, we can just perform the desired ResolvedClosureVar lookup
with the given scope with the compiled offset.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::instantiateLexicalVariables):
(JSC::BytecodeGenerator::pushLexicalScope):
(JSC::BytecodeGenerator::pushLexicalScopeInternal):
(JSC::BytecodeGenerator::emitCreatePrivateBrand):
(JSC::BytecodeGenerator::emitGetPrivateBrand):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::BaseDotNode::emitGetPropertyValue):
(JSC::BaseDotNode::emitPutProperty):
(JSC::PostfixNode::emitDot):
(JSC::PrefixNode::emitDot):
(JSC::InNode::emitBytecode):
(JSC::BlockNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ForOfNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
(JSC::ClassExprNode::emitBytecode):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseClass):

  • parser/VariableEnvironment.h:
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r278589 r278591  
     12021-06-06  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Use ResolvedClosureVar to get brand from scope
     4        https://bugs.webkit.org/show_bug.cgi?id=226677
     5        rdar://78802869
     6
     7        Reviewed by Saam Barati.
     8
     9        * stress/private-access-nested-eval.js: Added.
     10        (shouldThrow):
     11        (shouldThrow.prototype.x):
     12        (shouldThrow.prototype.m.C.prototype.z):
     13        (shouldThrow.prototype.m.C.prototype.a):
     14        (shouldThrow.prototype.m.C):
     15        (shouldThrow.prototype.m):
     16        * stress/private-access-nested.js: Added.
     17        (shouldThrow):
     18        (shouldThrow.prototype.x):
     19        (shouldThrow.prototype.m.C.prototype.z):
     20        (shouldThrow.prototype.m.C.prototype.a):
     21        (shouldThrow.prototype.m.C):
     22        (shouldThrow.prototype.m):
     23
    1242021-06-07  Alexey Shvayka  <shvaikalesh@gmail.com>
    225
  • trunk/Source/JavaScriptCore/ChangeLog

    r278589 r278591  
     12021-06-06  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Use ResolvedClosureVar to get brand from scope
     4        https://bugs.webkit.org/show_bug.cgi?id=226677
     5        rdar://78802869
     6
     7        Reviewed by Saam Barati.
     8
     9        Private brand lookup is doing wrong way to get scope.
     10
     11            1. op_resolve_scope with private name (e.g. #x)
     12            2. then, doing op_get_from_scope with (1)'s scope with different name (e.g. @privateBrand)
     13
     14        This is wrong in JSC. We resolve scope at link-time in CodeBlock. So we need to ensure that both op_resolve_scope and op_get_from_scope
     15        starts with the current scope-register. As a result, private-brand lookup is broken right now. Let's see the buggy case.
     16
     17            class D {
     18              #x() {}
     19              m() {
     20                class C {
     21                  #yy;
     22                  #z() { }
     23                  a() {
     24                    this.#x(); // <===== This point.
     25                  }
     26                }
     27                let c = new C();
     28                c.a();
     29              }
     30            }
     31
     32        In the above point, we first lookup the scope with #x, and we get the D's class-scope. But our get_from_scope is using privateBrand, and
     33        privateBrand property exists too in C's class-scope too since C also has #yy and #z. As a result, CodeBlock linking configures the offset for
     34        C's class-scope in get_from_scope. And this offset is different from D's class-scope's privateBrand.
     35
     36        Only allowed case for the above usage is ResolvedClosureVar. And generatorification uses it too. In this patch,
     37
     38        1. We ensure that class-scope (with private name) must have @privateBrand and @privateClassBrand with offset 1 and 0.
     39        2. Use ResolvedClosureVar with the above pre-defined offset
     40
     41        Since CodeBlock's linking does not resolve the scope for get_from_scope if it is ResolvedClosureVar, we can just perform the desired ResolvedClosureVar lookup
     42        with the given scope with the compiled offset.
     43
     44        * bytecompiler/BytecodeGenerator.cpp:
     45        (JSC::BytecodeGenerator::BytecodeGenerator):
     46        (JSC::BytecodeGenerator::instantiateLexicalVariables):
     47        (JSC::BytecodeGenerator::pushLexicalScope):
     48        (JSC::BytecodeGenerator::pushLexicalScopeInternal):
     49        (JSC::BytecodeGenerator::emitCreatePrivateBrand):
     50        (JSC::BytecodeGenerator::emitGetPrivateBrand):
     51        * bytecompiler/BytecodeGenerator.h:
     52        * bytecompiler/NodesCodegen.cpp:
     53        (JSC::BaseDotNode::emitGetPropertyValue):
     54        (JSC::BaseDotNode::emitPutProperty):
     55        (JSC::PostfixNode::emitDot):
     56        (JSC::PrefixNode::emitDot):
     57        (JSC::InNode::emitBytecode):
     58        (JSC::BlockNode::emitBytecode):
     59        (JSC::ForNode::emitBytecode):
     60        (JSC::ForInNode::emitBytecode):
     61        (JSC::ForOfNode::emitBytecode):
     62        (JSC::SwitchNode::emitBytecode):
     63        (JSC::ClassExprNode::emitBytecode):
     64        * parser/Parser.cpp:
     65        (JSC::Parser<LexerType>::parseClass):
     66        * parser/VariableEnvironment.h:
     67
    1682021-06-07  Alexey Shvayka  <shvaikalesh@gmail.com>
    269
  • trunk/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp

    r278340 r278591  
    245245                    storage.identifierIndex, // identifier
    246246                    operand, // value
    247                     GetPutInfo(DoNotThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization, m_bytecodeGenerator.ecmaMode()), // info
     247                    GetPutInfo(DoNotThrowIfNotFound, ResolvedClosureVar, InitializationMode::NotInitialization, m_bytecodeGenerator.ecmaMode()), // info
    248248                    SymbolTableOrScopeDepth::symbolTable(VirtualRegister { m_generatorFrameSymbolTableIndex }), // symbol table constant index
    249249                    storage.scopeOffset.offset() // scope offset
     
    265265                    scope, // scope
    266266                    storage.identifierIndex, // identifier
    267                     GetPutInfo(DoNotThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization, m_bytecodeGenerator.ecmaMode()), // info
     267                    GetPutInfo(DoNotThrowIfNotFound, ResolvedClosureVar, InitializationMode::NotInitialization, m_bytecodeGenerator.ecmaMode()), // info
    268268                    0, // local scope depth
    269269                    storage.scopeOffset.offset() // scope offset
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r278425 r278591  
    560560
    561561            const Identifier& ident = identifier(bytecode.m_var);
    562             RELEASE_ASSERT(bytecode.m_resolveType != LocalClosureVar);
     562            RELEASE_ASSERT(bytecode.m_resolveType != ResolvedClosureVar);
    563563
    564564            ResolveOp op = JSScope::abstractResolve(m_globalObject.get(), bytecode.m_localScopeDepth, scope, ident, Get, bytecode.m_resolveType, InitializationMode::NotInitialization);
     
    591591
    592592            ASSERT(!isInitialization(bytecode.m_getPutInfo.initializationMode()));
    593             if (bytecode.m_getPutInfo.resolveType() == LocalClosureVar) {
     593            if (bytecode.m_getPutInfo.resolveType() == ResolvedClosureVar) {
    594594                metadata.m_getPutInfo = GetPutInfo(bytecode.m_getPutInfo.resolveMode(), ClosureVar, bytecode.m_getPutInfo.initializationMode(), bytecode.m_getPutInfo.ecmaMode());
    595595                break;
     
    614614            INITIALIZE_METADATA(OpPutToScope)
    615615
    616             if (bytecode.m_getPutInfo.resolveType() == LocalClosureVar) {
     616            if (bytecode.m_getPutInfo.resolveType() == ResolvedClosureVar) {
    617617                // Only do watching if the property we're putting to is not anonymous.
    618618                if (bytecode.m_var != UINT_MAX) {
     
    14211421            GetPutInfo getPutInfo = metadata.m_getPutInfo;
    14221422            if (getPutInfo.resolveType() == GlobalVar || getPutInfo.resolveType() == GlobalVarWithVarInjectionChecks
    1423                 || getPutInfo.resolveType() == LocalClosureVar || getPutInfo.resolveType() == GlobalLexicalVar || getPutInfo.resolveType() == GlobalLexicalVarWithVarInjectionChecks)
     1423                || getPutInfo.resolveType() == ResolvedClosureVar || getPutInfo.resolveType() == GlobalLexicalVar || getPutInfo.resolveType() == GlobalLexicalVarWithVarInjectionChecks)
    14241424                return;
    14251425            WriteBarrierBase<Structure>& structure = metadata.m_structure;
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r278588 r278591  
    529529                    functionSymbolTable->set(NoLockingNecessary, name, entry);
    530530                }
    531                 OpPutToScope::emit(this, m_lexicalEnvironmentRegister, UINT_MAX, virtualRegisterForArgumentIncludingThis(1 + i), GetPutInfo(ThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization, ecmaMode), SymbolTableOrScopeDepth::symbolTable(VirtualRegister { symbolTableConstantIndex }), offset.offset());
     531                OpPutToScope::emit(this, m_lexicalEnvironmentRegister, UINT_MAX, virtualRegisterForArgumentIncludingThis(1 + i), GetPutInfo(ThrowIfNotFound, ResolvedClosureVar, InitializationMode::NotInitialization, ecmaMode), SymbolTableOrScopeDepth::symbolTable(VirtualRegister { symbolTableConstantIndex }), offset.offset());
    532532            }
    533533           
     
    567567            functionSymbolTable->set(NoLockingNecessary, name, SymbolTableEntry(VarOffset(offset)));
    568568           
    569             OpPutToScope::emit(this, m_lexicalEnvironmentRegister, addConstant(ident), virtualRegisterForArgumentIncludingThis(1 + i), GetPutInfo(ThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization, ecmaMode), SymbolTableOrScopeDepth::symbolTable(VirtualRegister { symbolTableConstantIndex }), offset.offset());
     569            OpPutToScope::emit(this, m_lexicalEnvironmentRegister, addConstant(ident), virtualRegisterForArgumentIncludingThis(1 + i), GetPutInfo(ThrowIfNotFound, ResolvedClosureVar, InitializationMode::NotInitialization, ecmaMode), SymbolTableOrScopeDepth::symbolTable(VirtualRegister { symbolTableConstantIndex }), offset.offset());
    570570        }
    571571    }
     
    843843
    844844    bool shouldInitializeBlockScopedFunctions = false; // We generate top-level function declarations in ::generate().
    845     pushLexicalScope(m_scopeNode, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, shouldInitializeBlockScopedFunctions);
     845    pushLexicalScope(m_scopeNode, ScopeType::LetConstScope, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, shouldInitializeBlockScopedFunctions);
    846846}
    847847
     
    908908   
    909909    bool shouldInitializeBlockScopedFunctions = false; // We generate top-level function declarations in ::generate().
    910     pushLexicalScope(m_scopeNode, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, shouldInitializeBlockScopedFunctions);
     910    pushLexicalScope(m_scopeNode, ScopeType::LetConstScope, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, shouldInitializeBlockScopedFunctions);
    911911}
    912912
     
    990990
    991991    VariableEnvironment& lexicalVariables = moduleProgramNode->lexicalVariables();
    992     instantiateLexicalVariables(lexicalVariables, moduleEnvironmentSymbolTable, ScopeRegisterType::Block, lookUpVarKind);
     992    instantiateLexicalVariables(lexicalVariables, ScopeType::LetConstScope, moduleEnvironmentSymbolTable, ScopeRegisterType::Block, lookUpVarKind);
    993993
    994994    // We keep the symbol table in the constant pool.
     
    18641864
    18651865template<typename LookUpVarKindFunctor>
    1866 bool BytecodeGenerator::instantiateLexicalVariables(const VariableEnvironment& lexicalVariables, SymbolTable* symbolTable, ScopeRegisterType scopeRegisterType, LookUpVarKindFunctor lookUpVarKind)
     1866bool BytecodeGenerator::instantiateLexicalVariables(const VariableEnvironment& lexicalVariables, ScopeType scopeType, SymbolTable* symbolTable, ScopeRegisterType scopeRegisterType, LookUpVarKindFunctor lookUpVarKind)
    18671867{
    18681868    bool hasCapturedVariables = false;
    18691869    {
     1870        bool hasPrivateNames = lexicalVariables.privateNamesSize();
     1871        // We need to ensure that @privateClassBrand and @privateBrand offsets are 0 and 1 respectively.
     1872        // To ensure that, we first define them, and later, we filter them out from lexicalVariables.
     1873        if (scopeType == ScopeType::ClassScope) {
     1874            if (hasPrivateNames) {
     1875                hasCapturedVariables = true;
     1876                VarOffset privateClassBrandOffset = VarOffset(symbolTable->takeNextScopeOffset(NoLockingNecessary));
     1877                ASSERT(privateClassBrandOffset.rawOffset() == PrivateNameEntry::privateClassBrandOffset);
     1878                symbolTable->add(NoLockingNecessary, propertyNames().builtinNames().privateClassBrandPrivateName().impl(), SymbolTableEntry { privateClassBrandOffset, static_cast<unsigned>(PropertyAttribute::ReadOnly) });
     1879
     1880                VarOffset privateBrandOffset = VarOffset(symbolTable->takeNextScopeOffset(NoLockingNecessary));
     1881                ASSERT(privateBrandOffset.rawOffset() == PrivateNameEntry::privateBrandOffset);
     1882                symbolTable->add(NoLockingNecessary, propertyNames().builtinNames().privateBrandPrivateName().impl(), SymbolTableEntry { privateBrandOffset, static_cast<unsigned>(PropertyAttribute::ReadOnly) });
     1883            }
     1884        }
     1885
    18701886        for (auto& entry : lexicalVariables) {
    18711887            ASSERT(entry.value.isLet() || entry.value.isConst() || entry.value.isFunction());
    18721888            ASSERT(!entry.value.isVar());
    1873             SymbolTableEntry symbolTableEntry = symbolTable->get(NoLockingNecessary, entry.key.get());
     1889
     1890            auto* key = entry.key.get();
     1891            if (scopeType == ScopeType::ClassScope) {
     1892                if (hasPrivateNames) {
     1893                    if (key == propertyNames().builtinNames().privateClassBrandPrivateName()) {
     1894                        ASSERT(entry.value.isConst());
     1895                        continue;
     1896                    }
     1897                    if (key == propertyNames().builtinNames().privateBrandPrivateName()) {
     1898                        ASSERT(entry.value.isConst());
     1899                        continue;
     1900                    }
     1901                } else {
     1902                    ASSERT(key != propertyNames().builtinNames().privateClassBrandPrivateName());
     1903                    ASSERT(key != propertyNames().builtinNames().privateBrandPrivateName());
     1904                }
     1905            }
     1906
     1907#if ASSERT_ENABLED
     1908            SymbolTableEntry symbolTableEntry = symbolTable->get(NoLockingNecessary, key);
    18741909            ASSERT(symbolTableEntry.isNull());
     1910#endif
    18751911
    18761912            // Imported bindings which are not the namespace bindings are not allocated
     
    18811917                continue;
    18821918
    1883             VarKind varKind = lookUpVarKind(entry.key.get(), entry.value);
     1919            VarKind varKind = lookUpVarKind(key, entry.value);
    18841920            VarOffset varOffset;
    18851921            if (varKind == VarKind::Scope) {
     
    18981934
    18991935            SymbolTableEntry newEntry(varOffset, static_cast<unsigned>(entry.value.isConst() ? PropertyAttribute::ReadOnly : PropertyAttribute::None));
    1900             symbolTable->add(NoLockingNecessary, entry.key.get(), newEntry);
     1936            symbolTable->add(NoLockingNecessary, key, newEntry);
    19011937
    19021938            // FIXME: only do this if there is an eval() within a nested scope --- otherwise it isn't needed.
     
    19071943                continue;
    19081944
    1909             auto findResult = privateEnvironment->find(entry.key.get());
     1945            auto findResult = privateEnvironment->find(key);
    19101946
    19111947            if (findResult == privateEnvironment->end())
     
    19441980}
    19451981
    1946 void BytecodeGenerator::pushLexicalScope(VariableEnvironmentNode* node, TDZCheckOptimization tdzCheckOptimization, NestedScopeType nestedScopeType, RegisterID** constantSymbolTableResult, bool shouldInitializeBlockScopedFunctions)
     1982void BytecodeGenerator::pushLexicalScope(VariableEnvironmentNode* node, ScopeType scopeType, TDZCheckOptimization tdzCheckOptimization, NestedScopeType nestedScopeType, RegisterID** constantSymbolTableResult, bool shouldInitializeBlockScopedFunctions)
    19471983{
    19481984    VariableEnvironment& environment = node->lexicalVariables();
    19491985    RegisterID* constantSymbolTableResultTemp = nullptr;
    1950     pushLexicalScopeInternal(environment, tdzCheckOptimization, nestedScopeType, &constantSymbolTableResultTemp, TDZRequirement::UnderTDZ, ScopeType::LetConstScope, ScopeRegisterType::Block);
     1986    pushLexicalScopeInternal(environment, tdzCheckOptimization, nestedScopeType, &constantSymbolTableResultTemp, TDZRequirement::UnderTDZ, scopeType, ScopeRegisterType::Block);
    19511987
    19521988    if (shouldInitializeBlockScopedFunctions)
     
    19722008        break;
    19732009    case ScopeType::LetConstScope:
     2010    case ScopeType::ClassScope:
    19742011        symbolTable->setScopeType(SymbolTable::ScopeType::LexicalScope);
    19752012        break;
     
    19862023    };
    19872024
    1988     bool hasCapturedVariables = instantiateLexicalVariables(environment, symbolTable, scopeRegisterType, lookUpVarKind);
     2025    bool hasCapturedVariables = instantiateLexicalVariables(environment, scopeType, symbolTable, scopeRegisterType, lookUpVarKind);
    19892026
    19902027    RegisterID* newScope = nullptr;
     
    24502487            scope,
    24512488            addConstant(variable.ident()),
    2452             GetPutInfo(resolveMode, variable.offset().isScope() ? LocalClosureVar : resolveType(), InitializationMode::NotInitialization, ecmaMode()),
     2489            GetPutInfo(resolveMode, variable.offset().isScope() ? ResolvedClosureVar : resolveType(), InitializationMode::NotInitialization, ecmaMode()),
    24532490            localScopeDepth(),
    24542491            variable.offset().isScope() ? variable.offset().scopeOffset().offset() : 0);
     
    24772514        if (variable.offset().isScope()) {
    24782515            offset = variable.offset().scopeOffset();
    2479             getPutInfo = GetPutInfo(resolveMode, LocalClosureVar, initializationMode, ecmaMode());
     2516            getPutInfo = GetPutInfo(resolveMode, ResolvedClosureVar, initializationMode, ecmaMode());
    24802517            symbolTableOrScopeDepth = SymbolTableOrScopeDepth::symbolTable(VirtualRegister { variable.symbolTableConstantIndex() });
    24812518        } else {
    2482             ASSERT(resolveType() != LocalClosureVar);
     2519            ASSERT(resolveType() != ResolvedClosureVar);
    24832520            getPutInfo = GetPutInfo(resolveMode, resolveType(), initializationMode, ecmaMode());
    24842521            symbolTableOrScopeDepth = SymbolTableOrScopeDepth::scopeDepth(localScopeDepth());
     
    27612798}
    27622799
    2763 void BytecodeGenerator::emitCreatePrivateBrand(RegisterID* scope, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
     2800void BytecodeGenerator::emitCreatePrivateBrand(const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
    27642801{
    27652802    RefPtr<RegisterID> createPrivateSymbol = moveLinkTimeConstant(nullptr, LinkTimeConstant::createPrivateSymbol);
     
    27712808    Variable privateBrandVar = variable(propertyNames().builtinNames().privateBrandPrivateName());
    27722809
    2773     emitPutToScope(scope, privateBrandVar, newSymbol, DoNotThrowIfNotFound, InitializationMode::ConstInitialization);
     2810    emitPutToScope(scopeRegister(), privateBrandVar, newSymbol, DoNotThrowIfNotFound, InitializationMode::ConstInitialization);
    27742811}
    27752812
     
    27912828RegisterID* BytecodeGenerator::emitGetPrivateBrand(RegisterID* dst, RegisterID* scope, bool isStatic)
    27922829{
    2793     Variable privateBrandVar = isStatic
    2794         ? variable(propertyNames().builtinNames().privateClassBrandPrivateName())
    2795         : variable(propertyNames().builtinNames().privateBrandPrivateName());
    2796     return emitGetFromScope(dst, scope, privateBrandVar, ThrowIfNotFound);
     2830    ASSERT(scope);
     2831    OpGetFromScope::emit(
     2832        this,
     2833        kill(dst),
     2834        scope,
     2835        addConstant(isStatic ? propertyNames().builtinNames().privateClassBrandPrivateName() : propertyNames().builtinNames().privateBrandPrivateName()),
     2836        GetPutInfo(ThrowIfNotFound, ResolvedClosureVar, InitializationMode::NotInitialization, ecmaMode()),
     2837        0,
     2838        isStatic ? PrivateNameEntry::privateClassBrandOffset : PrivateNameEntry::privateBrandOffset);
     2839    return dst;
    27972840}
    27982841
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r278588 r278591  
    690690        // This doesn't emit expression info. If using this, make sure you shouldn't be emitting text offset.
    691691        void emitProfileType(RegisterID* registerToProfile, ProfileTypeBytecodeFlag);
    692         // These variables are associated with variables in a program. They could be Locals, LocalClosureVar, or ClosureVar.
     692        // These variables are associated with variables in a program. They could be Locals, ResolvedClosureVar, or ClosureVar.
    693693        void emitProfileType(RegisterID* registerToProfile, const Variable&, const JSTextPosition& startDivot, const JSTextPosition& endDivot);
    694694
     
    843843        RegisterID* emitHasPrivateName(RegisterID* dst, RegisterID* base, RegisterID* property);
    844844
    845         void emitCreatePrivateBrand(RegisterID* dst, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
     845        void emitCreatePrivateBrand(const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
    846846        void emitInstallPrivateBrand(RegisterID* target);
    847847        void emitInstallPrivateClassBrand(RegisterID* target);
     
    11001100        enum class TDZCheckOptimization { Optimize, DoNotOptimize };
    11011101        enum class NestedScopeType { IsNested, IsNotNested };
     1102        enum class ScopeType { CatchScope, LetConstScope, FunctionNameScope, ClassScope };
    11021103    private:
    11031104        enum class TDZRequirement { UnderTDZ, NotUnderTDZ };
    1104         enum class ScopeType { CatchScope, LetConstScope, FunctionNameScope };
    11051105        enum class ScopeRegisterType { Var, Block };
    11061106        void pushLexicalScopeInternal(VariableEnvironment&, TDZCheckOptimization, NestedScopeType, RegisterID** constantSymbolTableResult, TDZRequirement, ScopeType, ScopeRegisterType);
     
    11081108        void popLexicalScopeInternal(VariableEnvironment&);
    11091109        template<typename LookUpVarKindFunctor>
    1110         bool instantiateLexicalVariables(const VariableEnvironment&, SymbolTable*, ScopeRegisterType, LookUpVarKindFunctor);
     1110        bool instantiateLexicalVariables(const VariableEnvironment&, ScopeType, SymbolTable*, ScopeRegisterType, LookUpVarKindFunctor);
    11111111        void emitPrefillStackTDZVariables(const VariableEnvironment&, SymbolTable*);
    11121112        RegisterID* emitGetParentScope(RegisterID* dst, RegisterID* scope);
     
    11301130        bool isSuperCallUsedInInnerArrowFunction();
    11311131        bool isThisUsedInInnerArrowFunction();
    1132         void pushLexicalScope(VariableEnvironmentNode*, TDZCheckOptimization, NestedScopeType = NestedScopeType::IsNotNested, RegisterID** constantSymbolTableResult = nullptr, bool shouldInitializeBlockScopedFunctions = true);
     1132        void pushLexicalScope(VariableEnvironmentNode*, ScopeType, TDZCheckOptimization, NestedScopeType = NestedScopeType::IsNotNested, RegisterID** constantSymbolTableResult = nullptr, bool shouldInitializeBlockScopedFunctions = true);
     1133        void pushClassLexicalScope(VariableEnvironmentNode*);
    11331134        void popLexicalScope(VariableEnvironmentNode*);
    11341135        void prepareLexicalScopeForNextForLoopIteration(VariableEnvironmentNode*, RegisterID* loopSymbolTable);
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r278578 r278591  
    983983            Variable var = generator.variable(identifierName);
    984984            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    985 
     985            ASSERT(scope); // Private names are always captured.
    986986            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    987987            generator.emitCheckPrivateBrand(base, privateBrandSymbol.get(), privateTraits.isStatic());
     
    993993            Variable var = generator.variable(identifierName);
    994994            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    995 
     995            ASSERT(scope); // Private names are always captured.
    996996            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    997997            generator.emitCheckPrivateBrand(base, privateBrandSymbol.get(), privateTraits.isStatic());
     
    10081008            Variable var = generator.variable(identifierName);
    10091009            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    1010 
     1010            ASSERT(scope); // Private names are always captured.
    10111011            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    10121012            generator.emitCheckPrivateBrand(base, privateBrandSymbol.get(), privateTraits.isStatic());
     
    10201020
    10211021        RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
     1022        ASSERT(scope); // Private names are always captured.
    10221023        RefPtr<RegisterID> privateName = generator.newTemporary();
    10231024        generator.emitGetFromScope(privateName.get(), scope.get(), var, DoNotThrowIfNotFound);
     
    10481049            Variable var = generator.variable(identifierName);
    10491050            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    1050 
     1051            ASSERT(scope); // Private names are always captured.
    10511052            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    10521053            generator.emitCheckPrivateBrand(base, privateBrandSymbol.get(), privateTraits.isStatic());
     
    10651066            Variable var = generator.variable(identifierName);
    10661067            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    1067 
     1068            ASSERT(scope); // Private names are always captured.
    10681069            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    10691070            generator.emitCheckPrivateBrand(base, privateBrandSymbol.get(), privateTraits.isStatic());
     
    10781079
    10791080        RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
     1081        ASSERT(scope); // Private names are always captured.
    10801082        RefPtr<RegisterID> privateName = generator.newTemporary();
    10811083        generator.emitGetFromScope(privateName.get(), scope.get(), var, DoNotThrowIfNotFound);
     
    24182420            Variable var = generator.variable(ident);
    24192421            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
     2422            ASSERT(scope); // Private names are always captured.
    24202423            RefPtr<RegisterID> privateName = generator.newTemporary();
    24212424            generator.emitGetFromScope(privateName.get(), scope.get(), var, DoNotThrowIfNotFound);
     
    24322435            Variable var = generator.variable(ident);
    24332436            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    2434 
     2437            ASSERT(scope); // Private names are always captured.
    24352438            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    24362439            generator.emitCheckPrivateBrand(base.get(), privateBrandSymbol.get(), privateTraits.isStatic());
     
    24432446        Variable var = generator.variable(ident);
    24442447        RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    2445 
     2448        ASSERT(scope); // Private names are always captured.
    24462449        RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    24472450        generator.emitCheckPrivateBrand(base.get(), privateBrandSymbol.get(), privateTraits.isStatic());
     
    27212724            Variable var = generator.variable(ident);
    27222725            RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    2723 
     2726            ASSERT(scope); // Private names are always captured.
    27242727            RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    27252728            generator.emitCheckPrivateBrand(base.get(), privateBrandSymbol.get(), privateTraits.isStatic());
     
    27322735        Variable var = generator.variable(ident);
    27332736        RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
    2734 
     2737        ASSERT(scope); // Private names are always captured.
    27352738        RefPtr<RegisterID> privateBrandSymbol = generator.emitGetPrivateBrand(generator.newTemporary(), scope.get(), privateTraits.isStatic());
    27362739        generator.emitCheckPrivateBrand(base.get(), privateBrandSymbol.get(), privateTraits.isStatic());
     
    32143217        Variable var = generator.variable(identifier);
    32153218        RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
     3219        ASSERT(scope); // Private names are always captured.
    32163220
    32173221        if (privateTraits.isField()) {
     
    38203824    if (!m_statements)
    38213825        return;
    3822     generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested);
     3826    generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::LetConstScope, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested);
    38233827    m_statements->emitBytecode(generator, dst);
    38243828    generator.popLexicalScope(this);
     
    40334037
    40344038    RegisterID* forLoopSymbolTable = nullptr;
    4035     generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
     4039    generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::LetConstScope, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
    40364040
    40374041    if (m_expr1)
     
    41844188
    41854189    RegisterID* forLoopSymbolTable = nullptr;
    4186     generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
     4190    generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::LetConstScope, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
    41874191
    41884192    if (m_lexpr->isAssignResolveNode())
     
    43534357
    43544358    RegisterID* forLoopSymbolTable = nullptr;
    4355     generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
     4359    generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::LetConstScope, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested, &forLoopSymbolTable);
    43564360    auto extractor = scopedLambda<void(BytecodeGenerator&, RegisterID*)>([this, dst](BytecodeGenerator& generator, RegisterID* value)
    43574361    {
     
    46874691    RefPtr<RegisterID> r0 = generator.emitNode(m_expr);
    46884692
    4689     generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::DoNotOptimize, BytecodeGenerator::NestedScopeType::IsNested);
     4693    generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::LetConstScope, BytecodeGenerator::TDZCheckOptimization::DoNotOptimize, BytecodeGenerator::NestedScopeType::IsNested);
    46904694    m_block->emitBytecodeForBlock(generator, r0.get(), dst);
    46914695    generator.popLexicalScope(this);
     
    51875191
    51885192    if (m_needsLexicalScope)
    5189         generator.pushLexicalScope(this, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested);
     5193        generator.pushLexicalScope(this, BytecodeGenerator::ScopeType::ClassScope, BytecodeGenerator::TDZCheckOptimization::Optimize, BytecodeGenerator::NestedScopeType::IsNested);
    51905194
    51915195    bool hasPrivateNames = !!m_lexicalVariables.privateNamesSize();
     
    51955199        generator.pushPrivateAccessNames(m_lexicalVariables.privateNameEnvironment());
    51965200    if (shouldEmitPrivateBrand)
    5197         generator.emitCreatePrivateBrand(generator.scopeRegister(), m_position, m_position, m_position);
     5201        generator.emitCreatePrivateBrand(m_position, m_position, m_position);
    51985202
    51995203    RefPtr<RegisterID> superclass;
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r278462 r278591  
    42474247    case GlobalLexicalVar:
    42484248    case ClosureVar:
    4249     case LocalClosureVar:
     4249    case ResolvedClosureVar:
    42504250    case ModuleVar:
    42514251        return false;
     
    76447644                    lexicalEnvironment = metadata.m_lexicalEnvironment.get();
    76457645                    break;
    7646                 case LocalClosureVar:
     7646                case ResolvedClosureVar:
    76477647                case ClosureVar:
    76487648                case ClosureVarWithVarInjectionChecks:
     
    76917691                break;
    76927692            }
    7693             case LocalClosureVar:
     7693            case ResolvedClosureVar:
    76947694            case ClosureVar:
    76957695            case ClosureVarWithVarInjectionChecks: {
     
    78727872                break;
    78737873            }
    7874             case LocalClosureVar:
     7874            case ResolvedClosureVar:
    78757875            case ClosureVar:
    78767876            case ClosureVarWithVarInjectionChecks: {
     
    79307930                getPutInfo = metadata.m_getPutInfo;
    79317931                resolveType = getPutInfo.resolveType();
    7932                 if (resolveType == GlobalVar || resolveType == GlobalVarWithVarInjectionChecks || resolveType == LocalClosureVar || resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)
     7932                if (resolveType == GlobalVar || resolveType == GlobalVarWithVarInjectionChecks || resolveType == ResolvedClosureVar || resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)
    79337933                    watchpoints = metadata.m_watchpointSet;
    79347934                else if (resolveType != UnresolvedProperty && resolveType != UnresolvedPropertyWithVarInjectionChecks)
     
    79967996                break;
    79977997            }
    7998             case LocalClosureVar:
     7998            case ResolvedClosureVar:
    79997999            case ClosureVar:
    80008000            case ClosureVarWithVarInjectionChecks: {
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r278576 r278591  
    841841        {
    842842            // GlobalVar because it is more efficient to emit inline than use a thunk.
    843             // LocalClosureVar and ModuleVar because we don't use these types with op_get_from_scope.
    844             return !(resolveType == GlobalVar || resolveType == LocalClosureVar || resolveType == ModuleVar);
     843            // ResolvedClosureVar and ModuleVar because we don't use these types with op_get_from_scope.
     844            return !(resolveType == GlobalVar || resolveType == ResolvedClosureVar || resolveType == ModuleVar);
    845845        }
    846846
     
    855855        {
    856856            // ModuleVar because it is more efficient to emit inline than use a thunk.
    857             // LocalClosureVar because we don't use these types with op_resolve_scope.
    858             return !(resolveType == LocalClosureVar || resolveType == ModuleVar);
     857            // ResolvedClosureVar because we don't use these types with op_resolve_scope.
     858            return !(resolveType == ResolvedClosureVar || resolveType == ModuleVar);
    859859        }
    860860
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r278445 r278591  
    30463046    ASSERT(getPutInfo.resolveType() != ModuleVar);
    30473047
    3048     if (getPutInfo.resolveType() == LocalClosureVar) {
     3048    if (getPutInfo.resolveType() == ResolvedClosureVar) {
    30493049        JSLexicalEnvironment* environment = jsCast<JSLexicalEnvironment*>(scope);
    30503050        environment->variableAt(ScopeOffset(metadata.m_operand)).set(vm, environment, value);
    30513051        if (WatchpointSet* set = metadata.m_watchpointSet)
    3052             set->touch(vm, "Executed op_put_scope<LocalClosureVar>");
     3052            set->touch(vm, "Executed op_put_scope<ResolvedClosureVar>");
    30533053        return;
    30543054    }
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r278445 r278591  
    17061706            addSlowCase(jump());
    17071707            break;
    1708         case LocalClosureVar:
     1708        case ResolvedClosureVar:
    17091709        case UnresolvedProperty:
    17101710        case UnresolvedPropertyWithVarInjectionChecks:
     
    18861886            slowCase.append(jump());
    18871887            break;
    1888         case LocalClosureVar:
     1888        case ResolvedClosureVar:
    18891889        case ModuleVar:
    18901890        case UnresolvedProperty:
     
    20942094            addSlowCase(jump());
    20952095            break;
    2096         case LocalClosureVar:
     2096        case ResolvedClosureVar:
    20972097        case ModuleVar:
    20982098        case UnresolvedProperty:
     
    23082308            slowCase.append(jump());
    23092309            break;
    2310         case LocalClosureVar:
     2310        case ResolvedClosureVar:
    23112311        case ModuleVar:
    23122312        case UnresolvedProperty:
     
    25212521            break;
    25222522        }
    2523         case LocalClosureVar:
     2523        case ResolvedClosureVar:
    25242524        case ClosureVar:
    25252525        case ClosureVarWithVarInjectionChecks:
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r278445 r278591  
    10151015            addSlowCase(jump());
    10161016            break;
    1017         case LocalClosureVar:
     1017        case ResolvedClosureVar:
    10181018        case UnresolvedProperty:
    10191019        case UnresolvedPropertyWithVarInjectionChecks:
     
    11541154            break;
    11551155        case ModuleVar:
    1156         case LocalClosureVar:
     1156        case ResolvedClosureVar:
    11571157        case UnresolvedProperty:
    11581158        case UnresolvedPropertyWithVarInjectionChecks:
     
    13001300            break;
    13011301        }
    1302         case LocalClosureVar:
     1302        case ResolvedClosureVar:
    13031303        case ClosureVar:
    13041304        case ClosureVarWithVarInjectionChecks:
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r278445 r278591  
    21792179    JSObject* scope = jsCast<JSObject*>(getNonConstantOperand(callFrame, bytecode.m_scope));
    21802180    JSValue value = getOperand(callFrame, bytecode.m_value);
    2181     if (metadata.m_getPutInfo.resolveType() == LocalClosureVar) {
     2181    if (metadata.m_getPutInfo.resolveType() == ResolvedClosureVar) {
    21822182        JSLexicalEnvironment* environment = jsCast<JSLexicalEnvironment*>(scope);
    21832183        environment->variableAt(ScopeOffset(metadata.m_operand)).set(vm, environment, value);
     
    21872187        // to the Undefined value from before the assignment.
    21882188        if (metadata.m_watchpointSet)
    2189             metadata.m_watchpointSet->touch(vm, "Executed op_put_scope<LocalClosureVar>");
     2189            metadata.m_watchpointSet->touch(vm, "Executed op_put_scope<ResolvedClosureVar>");
    21902190        LLINT_END();
    21912191    }
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r278445 r278591  
    593593const GlobalLexicalVar = constexpr GlobalLexicalVar
    594594const ClosureVar = constexpr ClosureVar
    595 const LocalClosureVar = constexpr LocalClosureVar
     595const ResolvedClosureVar = constexpr ResolvedClosureVar
    596596const ModuleVar = constexpr ModuleVar
    597597const GlobalPropertyWithVarInjectionChecks = constexpr GlobalPropertyWithVarInjectionChecks
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r278157 r278591  
    25832583    end
    25842584
    2585     macro putLocalClosureVar()
     2585    macro putResolvedClosureVar()
    25862586        get(m_value, t1)
    25872587        loadConstantOrVariable(size, t1, t2, t3)
     
    26102610    andi ResolveTypeMask, t0
    26112611
    2612 #pLocalClosureVar:
    2613     bineq t0, LocalClosureVar, .pGlobalProperty
     2612#pResolvedClosureVar:
     2613    bineq t0, ResolvedClosureVar, .pGlobalProperty
    26142614    loadVariable(get, m_scope, t2, t1, t0)
    2615     putLocalClosureVar()
     2615    putResolvedClosureVar()
    26162616    writeBarrierOnOperands(size, get, m_scope, m_value)
    26172617    dispatch()
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r275995 r278591  
    27112711    end
    27122712
    2713     macro putLocalClosureVar()
     2713    macro putResolvedClosureVar()
    27142714        get(m_value, t1)
    27152715        loadConstantOrVariable(size, t1, t2)
     
    27372737    andi ResolveTypeMask, t0
    27382738
    2739 #pLocalClosureVar:
    2740     bineq t0, LocalClosureVar, .pGlobalProperty
     2739#pResolvedClosureVar:
     2740    bineq t0, ResolvedClosureVar, .pGlobalProperty
    27412741    loadVariable(get, m_scope, t0)
    2742     putLocalClosureVar()
     2742    putResolvedClosureVar()
    27432743    writeBarrierOnOperands(size, get, m_scope, m_value)
    27442744    dispatch()
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r278588 r278591  
    31473147    consumeOrFail(CLOSEBRACE, "Expected a closing '}' after a class body");
    31483148
    3149     if (declaresPrivateMethod || declaresPrivateAccessor) {
    3150         Identifier privateBrandIdentifier = m_vm.propertyNames->builtinNames().privateBrandPrivateName();
    3151         DeclarationResultMask declarationResult = classScope->declareLexicalVariable(&privateBrandIdentifier, true);
    3152         ASSERT_UNUSED(declarationResult, declarationResult == DeclarationResult::Valid);
    3153         classScope->useVariable(&privateBrandIdentifier, false);
    3154         classScope->addClosedVariableCandidateUnconditionally(privateBrandIdentifier.impl());
     3149    if (declaresPrivateMethod || declaresPrivateAccessor || declaresStaticPrivateMethod || declaresStaticPrivateAccessor) {
     3150        {
     3151            Identifier privateBrandIdentifier = m_vm.propertyNames->builtinNames().privateBrandPrivateName();
     3152            DeclarationResultMask declarationResult = classScope->declareLexicalVariable(&privateBrandIdentifier, true);
     3153            ASSERT_UNUSED(declarationResult, declarationResult == DeclarationResult::Valid);
     3154            classScope->useVariable(&privateBrandIdentifier, false);
     3155            classScope->addClosedVariableCandidateUnconditionally(privateBrandIdentifier.impl());
     3156        }
     3157        {
     3158            Identifier privateClassBrandIdentifier = m_vm.propertyNames->builtinNames().privateClassBrandPrivateName();
     3159            DeclarationResultMask declarationResult = classScope->declareLexicalVariable(&privateClassBrandIdentifier, true);
     3160            ASSERT_UNUSED(declarationResult, declarationResult == DeclarationResult::Valid);
     3161            classScope->useVariable(&privateClassBrandIdentifier, false);
     3162            classScope->addClosedVariableCandidateUnconditionally(privateClassBrandIdentifier.impl());
     3163        }
    31553164    }
    31563165
     
    31583167        if (classElements)
    31593168            classElements->setHasPrivateAccessors(declaresPrivateAccessor || declaresStaticPrivateAccessor);
    3160     }
    3161 
    3162     if (declaresStaticPrivateMethod || declaresPrivateAccessor) {
    3163         Identifier privateClassBrandIdentifier = m_vm.propertyNames->builtinNames().privateClassBrandPrivateName();
    3164         DeclarationResultMask declarationResult = classScope->declareLexicalVariable(&privateClassBrandIdentifier, true);
    3165         ASSERT_UNUSED(declarationResult, declarationResult == DeclarationResult::Valid);
    3166         classScope->useVariable(&privateClassBrandIdentifier, false);
    3167         classScope->addClosedVariableCandidateUnconditionally(privateClassBrandIdentifier.impl());
    31683169    }
    31693170
  • trunk/Source/JavaScriptCore/parser/VariableEnvironment.h

    r277926 r278591  
    102102    friend class CachedPrivateNameEntry;
    103103
     104    static constexpr unsigned privateClassBrandOffset = 0;
     105    static constexpr unsigned privateBrandOffset = 1;
     106
    104107public:
    105108    PrivateNameEntry(uint16_t traits = 0) { m_bits = traits; }
  • trunk/Source/JavaScriptCore/runtime/GetPutInfo.h

    r278029 r278591  
    4545    v(GlobalLexicalVar) \
    4646    v(ClosureVar) \
    47     v(LocalClosureVar) \
     47    v(ResolvedClosureVar) \
    4848    v(ModuleVar) \
    4949    v(GlobalPropertyWithVarInjectionChecks) \
     
    6161    GlobalLexicalVar,
    6262    ClosureVar,
    63     LocalClosureVar,
     63    ResolvedClosureVar,
    6464    ModuleVar,
    6565
     
    103103        "GlobalLexicalVar",
    104104        "ClosureVar",
    105         "LocalClosureVar",
     105        "ResolvedClosureVar",
    106106        "ModuleVar",
    107107        "GlobalPropertyWithVarInjectionChecks",
     
    152152        return GlobalLexicalVarWithVarInjectionChecks;
    153153    case ClosureVar:
    154     case LocalClosureVar:
     154    case ResolvedClosureVar:
    155155        return ClosureVarWithVarInjectionChecks;
    156156    case UnresolvedProperty:
     
    177177    case GlobalLexicalVar:
    178178    case ClosureVar:
    179     case LocalClosureVar:
     179    case ResolvedClosureVar:
    180180    case ModuleVar:
    181181    case UnresolvedProperty:
Note: See TracChangeset for help on using the changeset viewer.