Title: [279105] trunk
Revision
279105
Author
[email protected]
Date
2021-06-21 23:41:14 -0700 (Mon, 21 Jun 2021)

Log Message

[JSC] Add JIT ICs for `#x in obj` feature
https://bugs.webkit.org/show_bug.cgi?id=226146

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/has-private-brand.js: Added.
* microbenchmarks/has-private-name.js: Added.

Source/_javascript_Core:

This patch implements JIT ICs for the new `#x in obj` feature and turns the feature on by default.
Implementation closely follows InByVal, though HasPrivateBrand has a few subtleties
(namely, it cannot be viewed in terms of a PropertySlot and should not be converted to InById).

Microbenchmarks:
    has-private-name        46.5777+-0.1374     ^      6.0589+-0.0296        ^ definitely 7.6875x faster
    has-private-brand       25.8823+-0.0561     ^     19.1509+-0.0447        ^ definitely 1.3515x faster

* bytecode/StructureStubInfo.cpp:
(JSC::StructureStubInfo::reset):
* bytecode/StructureStubInfo.h:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleInByAsMatchStructure):
(JSC::DFG::ByteCodeParser::handleInById):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileInByVal):
(JSC::DFG::SpeculativeJIT::compileHasPrivate):
(JSC::DFG::SpeculativeJIT::compileHasPrivateName):
(JSC::DFG::SpeculativeJIT::compileHasPrivateBrand):
* dfg/DFGSpeculativeJIT.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
* jit/JITInlineCacheGenerator.cpp:
(JSC::JITInByValGenerator::JITInByValGenerator):
* jit/JITInlineCacheGenerator.h:
* jit/JITOperations.cpp:
(JSC::JSC_DEFINE_JIT_OPERATION):
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_in_by_val):
(JSC::JIT::emitHasPrivate):
(JSC::JIT::emitHasPrivateSlow):
(JSC::JIT::emit_op_has_private_name):
(JSC::JIT::emitSlow_op_has_private_name):
(JSC::JIT::emit_op_has_private_brand):
(JSC::JIT::emitSlow_op_has_private_brand):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_in_by_val):
(JSC::JIT::emitHasPrivate):
(JSC::JIT::emitHasPrivateSlow):
(JSC::JIT::emit_op_has_private_name):
(JSC::JIT::emitSlow_op_has_private_name):
(JSC::JIT::emit_op_has_private_brand):
(JSC::JIT::emitSlow_op_has_private_brand):
* jit/Repatch.cpp:
(JSC::appropriateOptimizingInByFunction):
(JSC::appropriateGenericInByFunction):
(JSC::tryCacheInBy):
(JSC::repatchInBy):
(JSC::tryCacheHasPrivateBrand):
(JSC::repatchHasPrivateBrand):
(JSC::resetInBy):
(JSC::resetHasPrivateBrand):
* jit/Repatch.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter.asm:
* runtime/CommonSlowPaths.cpp:
* runtime/CommonSlowPaths.h:
* runtime/OptionsList.h:

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (279104 => 279105)


--- trunk/JSTests/ChangeLog	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/JSTests/ChangeLog	2021-06-22 06:41:14 UTC (rev 279105)
@@ -1,3 +1,13 @@
+2021-06-21  Ross Kirsling  <[email protected]>
+
+        [JSC] Add JIT ICs for `#x in obj` feature
+        https://bugs.webkit.org/show_bug.cgi?id=226146
+
+        Reviewed by Saam Barati.
+
+        * microbenchmarks/has-private-brand.js: Added.
+        * microbenchmarks/has-private-name.js: Added.
+
 2021-06-21  Xan Lopez  <[email protected]>
 
         [JSC] Fix consistency check during stack splitting in Wasm::LLIntGenerator::addLoop

Added: trunk/JSTests/microbenchmarks/has-private-brand.js (0 => 279105)


--- trunk/JSTests/microbenchmarks/has-private-brand.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/has-private-brand.js	2021-06-22 06:41:14 UTC (rev 279105)
@@ -0,0 +1,19 @@
+function assert(b) {
+  if (!b) throw new Error;
+}
+
+class M {
+  #x() {}
+  static isM(obj) {
+    return #x in obj;
+  }
+}
+noInline(M.prototype.isM);
+
+function test() {
+  assert(M.isM(new M) && !M.isM(M) && !M.isM({}));
+}
+noInline(test);
+
+for (var i = 0; i < 1e6; ++i)
+  test();

Added: trunk/JSTests/microbenchmarks/has-private-name.js (0 => 279105)


--- trunk/JSTests/microbenchmarks/has-private-name.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/has-private-name.js	2021-06-22 06:41:14 UTC (rev 279105)
@@ -0,0 +1,19 @@
+function assert(b) {
+  if (!b) throw new Error;
+}
+
+class F {
+  #x;
+  static isF(obj) {
+    return #x in obj;
+  }
+}
+noInline(F.prototype.isF);
+
+function test() {
+  assert(F.isF(new F) && !F.isF(F) && !F.isF({}));
+}
+noInline(test);
+
+for (var i = 0; i < 1e6; ++i)
+  test();

Modified: trunk/Source/_javascript_Core/ChangeLog (279104 => 279105)


--- trunk/Source/_javascript_Core/ChangeLog	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-06-22 06:41:14 UTC (rev 279105)
@@ -1,3 +1,77 @@
+2021-06-21  Ross Kirsling  <[email protected]>
+
+        [JSC] Add JIT ICs for `#x in obj` feature
+        https://bugs.webkit.org/show_bug.cgi?id=226146
+
+        Reviewed by Saam Barati.
+
+        This patch implements JIT ICs for the new `#x in obj` feature and turns the feature on by default.
+        Implementation closely follows InByVal, though HasPrivateBrand has a few subtleties
+        (namely, it cannot be viewed in terms of a PropertySlot and should not be converted to InById).
+
+        Microbenchmarks:
+            has-private-name        46.5777+-0.1374     ^      6.0589+-0.0296        ^ definitely 7.6875x faster
+            has-private-brand       25.8823+-0.0561     ^     19.1509+-0.0447        ^ definitely 1.3515x faster
+
+        * bytecode/StructureStubInfo.cpp:
+        (JSC::StructureStubInfo::reset):
+        * bytecode/StructureStubInfo.h:
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::handleInByAsMatchStructure):
+        (JSC::DFG::ByteCodeParser::handleInById):
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileInByVal):
+        (JSC::DFG::SpeculativeJIT::compileHasPrivate):
+        (JSC::DFG::SpeculativeJIT::compileHasPrivateName):
+        (JSC::DFG::SpeculativeJIT::compileHasPrivateBrand):
+        * dfg/DFGSpeculativeJIT.h:
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompileMainPass):
+        (JSC::JIT::privateCompileSlowCases):
+        * jit/JIT.h:
+        * jit/JITInlineCacheGenerator.cpp:
+        (JSC::JITInByValGenerator::JITInByValGenerator):
+        * jit/JITInlineCacheGenerator.h:
+        * jit/JITOperations.cpp:
+        (JSC::JSC_DEFINE_JIT_OPERATION):
+        * jit/JITOperations.h:
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::emit_op_in_by_val):
+        (JSC::JIT::emitHasPrivate):
+        (JSC::JIT::emitHasPrivateSlow):
+        (JSC::JIT::emit_op_has_private_name):
+        (JSC::JIT::emitSlow_op_has_private_name):
+        (JSC::JIT::emit_op_has_private_brand):
+        (JSC::JIT::emitSlow_op_has_private_brand):
+        * jit/JITPropertyAccess32_64.cpp:
+        (JSC::JIT::emit_op_in_by_val):
+        (JSC::JIT::emitHasPrivate):
+        (JSC::JIT::emitHasPrivateSlow):
+        (JSC::JIT::emit_op_has_private_name):
+        (JSC::JIT::emitSlow_op_has_private_name):
+        (JSC::JIT::emit_op_has_private_brand):
+        (JSC::JIT::emitSlow_op_has_private_brand):
+        * jit/Repatch.cpp:
+        (JSC::appropriateOptimizingInByFunction):
+        (JSC::appropriateGenericInByFunction):
+        (JSC::tryCacheInBy):
+        (JSC::repatchInBy):
+        (JSC::tryCacheHasPrivateBrand):
+        (JSC::repatchHasPrivateBrand):
+        (JSC::resetInBy):
+        (JSC::resetHasPrivateBrand):
+        * jit/Repatch.h:
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        * llint/LLIntSlowPaths.h:
+        * llint/LowLevelInterpreter.asm:
+        * runtime/CommonSlowPaths.cpp:
+        * runtime/CommonSlowPaths.h:
+        * runtime/OptionsList.h:
+
 2021-06-21  Don Olmstead  <[email protected]>
 
         Non-unified build fixes late June 2021 edition

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -279,6 +279,12 @@
     case AccessType::InByVal:
         resetInBy(codeBlock, *this, InByKind::ByVal);
         break;
+    case AccessType::HasPrivateName:
+        resetInBy(codeBlock, *this, InByKind::PrivateName);
+        break;
+    case AccessType::HasPrivateBrand:
+        resetHasPrivateBrand(codeBlock, *this);
+        break;
     case AccessType::InstanceOf:
         resetInstanceOf(codeBlock, *this);
         break;

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (279104 => 279105)


--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -57,6 +57,8 @@
     Put,
     InById,
     InByVal,
+    HasPrivateName,
+    HasPrivateBrand,
     InstanceOf,
     DeleteByID,
     DeleteByVal,

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -264,6 +264,7 @@
     void handleDeleteById(
         VirtualRegister destination, Node* base, CacheableIdentifier, unsigned identifierNumber, DeleteByStatus, ECMAMode);
 
+    bool handleInByAsMatchStructure(VirtualRegister destination, Node* base, InByStatus);
     void handleInById(VirtualRegister destination, Node* base, CacheableIdentifier, InByStatus);
 
     // Either register a watchpoint or emit a check for this condition. Returns false if the
@@ -4941,32 +4942,40 @@
     return;
 }
 
-void ByteCodeParser::handleInById(VirtualRegister destination, Node* base, CacheableIdentifier identifier, InByStatus status)
+bool ByteCodeParser::handleInByAsMatchStructure(VirtualRegister destination, Node* base, InByStatus status)
 {
-    if (status.isSimple() && Options::useAccessInlining()) {
-        bool allOK = true;
-        MatchStructureData* data = ""
-        for (const InByVariant& variant : status.variants()) {
-            if (!check(variant.conditionSet())) {
-                allOK = false;
-                break;
-            }
-            for (Structure* structure : variant.structureSet()) {
-                MatchStructureVariant matchVariant;
-                matchVariant.structure = m_graph.registerStructure(structure);
-                matchVariant.result = variant.isHit();
+    if (!status.isSimple() || !Options::useAccessInlining())
+        return false;
 
-                data->variants.append(WTFMove(matchVariant));
-            }
+    bool allOK = true;
+    MatchStructureData* data = ""
+    for (const InByVariant& variant : status.variants()) {
+        if (!check(variant.conditionSet())) {
+            allOK = false;
+            break;
         }
+        for (Structure* structure : variant.structureSet()) {
+            MatchStructureVariant matchVariant;
+            matchVariant.structure = m_graph.registerStructure(structure);
+            matchVariant.result = variant.isHit();
 
-        if (allOK) {
-            addToGraph(FilterInByStatus, OpInfo(m_graph.m_plan.recordedStatuses().addInByStatus(currentCodeOrigin(), status)), base);
-            set(destination, addToGraph(MatchStructure, OpInfo(data), base));
-            return;
+            data->variants.append(WTFMove(matchVariant));
         }
     }
 
+    if (allOK) {
+        addToGraph(FilterInByStatus, OpInfo(m_graph.m_plan.recordedStatuses().addInByStatus(currentCodeOrigin(), status)), base);
+        set(destination, addToGraph(MatchStructure, OpInfo(data), base));
+    }
+
+    return allOK;
+}
+
+void ByteCodeParser::handleInById(VirtualRegister destination, Node* base, CacheableIdentifier identifier, InByStatus status)
+{
+    if (handleInByAsMatchStructure(destination, base, status))
+        return;
+
     set(destination, addToGraph(InById, OpInfo(identifier), base));
 }
 
@@ -8304,18 +8313,59 @@
         }
         
         case op_has_private_name: {
-            // FIXME: Improve this once InByVal has been optimized.
-            // https://bugs.webkit.org/show_bug.cgi?id=226146
             auto bytecode = currentInstruction->as<OpHasPrivateName>();
-            set(bytecode.m_dst, addToGraph(HasPrivateName, get(bytecode.m_base), get(bytecode.m_property)));
+            Node* base = get(bytecode.m_base);
+            Node* property = get(bytecode.m_property);
+            bool compiledAsInById = false;
+
+            if (!m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadIdent)
+                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType)
+                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadConstantValue)) {
+
+                InByStatus status = InByStatus::computeFor(
+                    m_inlineStackTop->m_profiledBlock, m_inlineStackTop->m_baselineMap,
+                    m_icContextStack, currentCodeOrigin());
+
+                if (CacheableIdentifier identifier = status.singleIdentifier()) {
+                    m_graph.identifiers().ensure(identifier.uid());
+                    ASSERT(identifier.isSymbolCell());
+                    FrozenValue* frozen = m_graph.freezeStrong(identifier.cell());
+                    addToGraph(CheckIsConstant, OpInfo(frozen), property);
+                    handleInById(bytecode.m_dst, base, identifier, status);
+                    compiledAsInById = true;
+                }
+            }
+
+            if (!compiledAsInById)
+                set(bytecode.m_dst, addToGraph(HasPrivateName, base, property));
             NEXT_OPCODE(op_has_private_name);
         }
 
         case op_has_private_brand: {
-            // FIXME: Improve this once InByVal has been optimized.
-            // https://bugs.webkit.org/show_bug.cgi?id=226146
             auto bytecode = currentInstruction->as<OpHasPrivateBrand>();
-            set(bytecode.m_dst, addToGraph(HasPrivateBrand, get(bytecode.m_base), get(bytecode.m_brand)));
+            Node* base = get(bytecode.m_base);
+            Node* brand = get(bytecode.m_brand);
+            bool compiledAsMatchStructure = false;
+
+            if (!m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadIdent)
+                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadType)
+                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadConstantValue)) {
+
+                InByStatus status = InByStatus::computeFor(
+                    m_inlineStackTop->m_profiledBlock, m_inlineStackTop->m_baselineMap,
+                    m_icContextStack, currentCodeOrigin());
+
+                if (CacheableIdentifier identifier = status.singleIdentifier()) {
+                    m_graph.identifiers().ensure(identifier.uid());
+                    ASSERT(identifier.isSymbolCell());
+                    FrozenValue* frozen = m_graph.freezeStrong(identifier.cell());
+                    addToGraph(CheckIsConstant, OpInfo(frozen), brand);
+                    compiledAsMatchStructure = handleInByAsMatchStructure(bytecode.m_dst, base, status);
+                }
+            }
+
+            if (!compiledAsMatchStructure)
+                set(bytecode.m_dst, addToGraph(HasPrivateBrand, base, brand));
             NEXT_OPCODE(op_has_private_brand);
         }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -1350,12 +1350,12 @@
         slowPath = slowPathICCall(
             slowCases, this, gen.stubInfo(), stubInfoGPR, CCallHelpers::Address(stubInfoGPR, StructureStubInfo::offsetOfSlowOperation()), operationInByIdOptimize,
             NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
-            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), stubInfoGPR, CCallHelpers::CellValue(baseGPR), node->cacheableIdentifier().rawBits());
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), stubInfoGPR, CCallHelpers::CellValue(baseGPR), node->cacheableIdentifier().rawBits());
     } else {
         slowPath = slowPathCall(
             slowCases, this, operationInByIdOptimize,
             NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
-            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), gen.stubInfo(), CCallHelpers::CellValue(baseGPR), node->cacheableIdentifier().rawBits());
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), gen.stubInfo(), CCallHelpers::CellValue(baseGPR), node->cacheableIdentifier().rawBits());
     }
 
     m_jit.addInById(gen, slowPath.get());
@@ -1389,7 +1389,7 @@
     CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
     RegisterSet usedRegisters = this->usedRegisters();
     JITInByValGenerator gen(
-        m_jit.codeBlock(), JITType::DFGJIT, codeOrigin, callSite, usedRegisters,
+        m_jit.codeBlock(), JITType::DFGJIT, codeOrigin, callSite, AccessType::InByVal, usedRegisters,
         JSValueRegs::payloadOnly(baseGPR), keyRegs, resultRegs, stubInfoGPR);
     gen.generateFastPath(m_jit);
     if (!JITCode::useDataIC(JITType::DFGJIT))
@@ -1400,12 +1400,12 @@
         slowPath = slowPathICCall(
             slowCases, this, gen.stubInfo(), stubInfoGPR, CCallHelpers::Address(stubInfoGPR, StructureStubInfo::offsetOfSlowOperation()), operationInByValOptimize,
             NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
-            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), stubInfoGPR, nullptr, CCallHelpers::CellValue(baseGPR), keyRegs);
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), stubInfoGPR, nullptr, CCallHelpers::CellValue(baseGPR), keyRegs);
     } else {
         slowPath = slowPathCall(
             slowCases, this, operationInByValOptimize,
             NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
-            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), gen.stubInfo(), nullptr, CCallHelpers::CellValue(baseGPR), keyRegs);
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), gen.stubInfo(), nullptr, CCallHelpers::CellValue(baseGPR), keyRegs);
     }
 
     m_jit.addInByVal(gen, slowPath.get());
@@ -1414,48 +1414,70 @@
     blessedBooleanResult(resultRegs.payloadGPR(), node, UseChildrenCalledExplicitly);
 }
 
-void SpeculativeJIT::compileHasPrivateName(Node* node)
+void SpeculativeJIT::compileHasPrivate(Node* node, AccessType type)
 {
     SpeculateCellOperand base(this, node->child1());
-    SpeculateCellOperand key(this, node->child2());
+    SpeculateCellOperand propertyOrBrand(this, node->child2());
+    JSValueRegsTemporary result(this, Reuse, base);
+    std::optional<GPRTemporary> stubInfo;
 
+    GPRReg stubInfoGPR = InvalidGPRReg;
+    if (JITCode::useDataIC(JITType::DFGJIT)) {
+        stubInfo.emplace(this);
+        stubInfoGPR = stubInfo->gpr();
+    }
     GPRReg baseGPR = base.gpr();
-    GPRReg keyGPR = key.gpr();
+    GPRReg propertyOrBrandGPR = propertyOrBrand.gpr();
+    JSValueRegs resultRegs = result.regs();
 
-    speculateSymbol(node->child2(), keyGPR);
+    speculateSymbol(node->child2(), propertyOrBrandGPR);
 
     base.use();
-    key.use();
+    propertyOrBrand.use();
 
-    flushRegisters();
-    JSValueRegsFlushedCallResult result(this);
-    JSValueRegs resultRegs = result.regs();
-    callOperation(operationHasPrivateName, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), baseGPR, CCallHelpers::CellValue(keyGPR));
-    m_jit.exceptionCheck();
-    blessedBooleanResult(resultRegs.payloadGPR(), node, UseChildrenCalledExplicitly);
-}
+    CCallHelpers::JumpList slowCases;
 
-void SpeculativeJIT::compileHasPrivateBrand(Node* node)
-{
-    SpeculateCellOperand base(this, node->child1());
-    SpeculateCellOperand brand(this, node->child2());
+    CodeOrigin codeOrigin = node->origin.semantic;
+    CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
+    RegisterSet usedRegisters = this->usedRegisters();
+    JITInByValGenerator gen(
+        m_jit.codeBlock(), JITType::DFGJIT, codeOrigin, callSite, type, usedRegisters,
+        JSValueRegs::payloadOnly(baseGPR), JSValueRegs::payloadOnly(propertyOrBrandGPR), resultRegs, stubInfoGPR);
 
-    GPRReg baseGPR = base.gpr();
-    GPRReg brandGPR = brand.gpr();
+    gen.stubInfo()->propertyIsSymbol = true;
+    gen.generateFastPath(m_jit);
+    if (!JITCode::useDataIC(JITType::DFGJIT))
+        slowCases.append(gen.slowPathJump());
 
-    speculateSymbol(node->child2(), brandGPR);
+    std::unique_ptr<SlowPathGenerator> slowPath;
+    if (JITCode::useDataIC(JITType::DFGJIT)) {
+        slowPath = slowPathICCall(
+            slowCases, this, gen.stubInfo(), stubInfoGPR, CCallHelpers::Address(stubInfoGPR, StructureStubInfo::offsetOfSlowOperation()), type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize,
+            NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), stubInfoGPR, CCallHelpers::CellValue(baseGPR), CCallHelpers::CellValue(propertyOrBrandGPR));
+    } else {
+        slowPath = slowPathCall(
+            slowCases, this, type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize,
+            NeedToSpill, ExceptionCheckRequirement::CheckNeeded,
+            resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), gen.stubInfo(), CCallHelpers::CellValue(baseGPR), CCallHelpers::CellValue(propertyOrBrandGPR));
+    }
 
-    base.use();
-    brand.use();
+    m_jit.addInByVal(gen, slowPath.get());
+    addSlowPathGenerator(WTFMove(slowPath));
 
-    flushRegisters();
-    JSValueRegsFlushedCallResult result(this);
-    JSValueRegs resultRegs = result.regs();
-    callOperation(operationHasPrivateBrand, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), baseGPR, CCallHelpers::CellValue(brandGPR));
-    m_jit.exceptionCheck();
     blessedBooleanResult(resultRegs.payloadGPR(), node, UseChildrenCalledExplicitly);
 }
 
+void SpeculativeJIT::compileHasPrivateName(Node* node)
+{
+    compileHasPrivate(node, AccessType::HasPrivateName);
+}
+
+void SpeculativeJIT::compileHasPrivateBrand(Node* node)
+{
+    compileHasPrivate(node, AccessType::HasPrivateBrand);
+}
+
 void SpeculativeJIT::compilePushWithScope(Node* node)
 {
     SpeculateCellOperand currentScope(this, node->child1());

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (279104 => 279105)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -738,9 +738,10 @@
     void compileGetByIdFlush(Node*, AccessType);
     void compileInById(Node*);
     void compileInByVal(Node*);
+    void compileHasPrivate(Node*, AccessType);
     void compileHasPrivateName(Node*);
     void compileHasPrivateBrand(Node*);
-    
+
     void nonSpeculativeNonPeepholeCompareNullOrUndefined(Edge operand);
     void nonSpeculativePeepholeBranchNullOrUndefined(Edge operand, Node* branchNode);
     

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -12420,24 +12420,13 @@
         setJSValue(m_out.phi(Int64, results));
     }
 
-    void compileHasPrivateName()
-    {
-        JSGlobalObject* globalObject = m_graph.globalObjectFor(m_origin.semantic);
-        setJSValue(vmCall(Int64, operationHasPrivateName, weakPointer(globalObject), lowCell(m_node->child1()), lowSymbol(m_node->child2())));
-    }
-
-    void compileHasPrivateBrand()
-    {
-        JSGlobalObject* globalObject = m_graph.globalObjectFor(m_origin.semantic);
-        setJSValue(vmCall(Int64, operationHasPrivateBrand, weakPointer(globalObject), lowCell(m_node->child1()), lowSymbol(m_node->child2())));
-    }
-
-    template<InByKind kind, typename SubscriptKind>
+    template<AccessType type, typename SubscriptKind>
     void compileInBy(LValue base, SubscriptKind subscriptValue)
     {
+        static_assert(type == AccessType::InById || type == AccessType::InByVal || type == AccessType::HasPrivateName || type == AccessType::HasPrivateBrand);
         PatchpointValue* patchpoint = m_out.patchpoint(Int64);
         patchpoint->appendSomeRegister(base);
-        if constexpr (kind != InByKind::ById)
+        if constexpr (type != AccessType::InById)
             patchpoint->appendSomeRegister(subscriptValue);
         patchpoint->append(m_notCellMask, ValueRep::lateReg(GPRInfo::notCellMaskRegister));
         patchpoint->append(m_numberTag, ValueRep::lateReg(GPRInfo::numberTagRegister));
@@ -12462,8 +12451,21 @@
                 auto returnGPR = params[0].gpr();
                 auto base = JSValueRegs(params[1].gpr());
 
+                constexpr auto optimizationFunction = [&] () {
+                    if constexpr (type == AccessType::InById)
+                        return operationInByIdOptimize;
+                    else if constexpr (type == AccessType::InByVal)
+                        return operationInByValOptimize;
+                    else if constexpr (type == AccessType::HasPrivateName)
+                        return operationHasPrivateNameOptimize;
+                    else {
+                        static_assert(type == AccessType::HasPrivateBrand);
+                        return operationHasPrivateBrandOptimize;
+                    }
+                }();
+
                 const auto subscript = [&] {
-                    if constexpr (kind == InByKind::ById)
+                    if constexpr (type == AccessType::InById)
                         return CCallHelpers::TrustedImmPtr(subscriptValue.rawBits());
                     else
                         return JSValueRegs(params[2].gpr());
@@ -12470,7 +12472,7 @@
                 }();
 
                 const auto generator = [&] {
-                    if constexpr (kind == InByKind::ById) {
+                    if constexpr (type == AccessType::InById) {
                         return Box<JITInByIdGenerator>::create(
                             jit.codeBlock(), JITType::FTLJIT, semanticNodeOrigin, callSiteIndex,
                             params.unavailableRegisters(), subscriptValue, base,
@@ -12478,7 +12480,7 @@
                     } else {
                         return Box<JITInByValGenerator>::create(
                             jit.codeBlock(), JITType::FTLJIT, semanticNodeOrigin, callSiteIndex,
-                            params.unavailableRegisters(), base, subscript,
+                            type, params.unavailableRegisters(), base, subscript,
                             JSValueRegs(returnGPR), stubInfoGPR);
                     }
                 }();
@@ -12485,7 +12487,7 @@
 
                 CCallHelpers::JumpList slowCases;
                 generator->generateFastPath(jit);
-                if constexpr (kind == InByKind::ById)
+                if constexpr (type == AccessType::InById)
                     slowCases.append(generator->slowPathJump());
                 else {
                     if (!JITCode::useDataIC(JITType::FTLJIT))
@@ -12500,10 +12502,10 @@
                         slowCases.link(&jit);
                         CCallHelpers::Label slowPathBegin = jit.label();
                         CCallHelpers::Call slowPathCall;
-                        if constexpr (kind == InByKind::ById) {
+                        if constexpr (type != AccessType::InByVal) {
                             if (JITCode::useDataIC(JITType::FTLJIT)) {
                                 jit.move(CCallHelpers::TrustedImmPtr(generator->stubInfo()), stubInfoGPR);
-                                generator->stubInfo()->m_slowOperation = operationInByIdOptimize;
+                                generator->stubInfo()->m_slowOperation = optimizationFunction;
                                 slowPathCall = callOperation(
                                     *state, params.unavailableRegisters(), jit, semanticNodeOrigin,
                                     exceptions.get(), CCallHelpers::Address(stubInfoGPR, StructureStubInfo::offsetOfSlowOperation()), returnGPR,
@@ -12512,7 +12514,7 @@
                             } else {
                                 slowPathCall = callOperation(
                                     *state, params.unavailableRegisters(), jit, semanticNodeOrigin,
-                                    exceptions.get(), operationInByIdOptimize, returnGPR,
+                                    exceptions.get(), optimizationFunction, returnGPR,
                                     jit.codeBlock()->globalObjectFor(semanticNodeOrigin),
                                     CCallHelpers::TrustedImmPtr(generator->stubInfo()), base, subscript).call();
                             }
@@ -12519,7 +12521,7 @@
                         } else {
                             if (JITCode::useDataIC(JITType::FTLJIT)) {
                                 jit.move(CCallHelpers::TrustedImmPtr(generator->stubInfo()), stubInfoGPR);
-                                generator->stubInfo()->m_slowOperation = operationInByValOptimize;
+                                generator->stubInfo()->m_slowOperation = optimizationFunction;
                                 slowPathCall = callOperation(
                                     *state, params.unavailableRegisters(), jit, semanticNodeOrigin,
                                     exceptions.get(), CCallHelpers::Address(stubInfoGPR, StructureStubInfo::offsetOfSlowOperation()), returnGPR,
@@ -12529,7 +12531,7 @@
                             } else {
                                 slowPathCall = callOperation(
                                     *state, params.unavailableRegisters(), jit, semanticNodeOrigin,
-                                    exceptions.get(), operationInByValOptimize, returnGPR,
+                                    exceptions.get(), optimizationFunction, returnGPR,
                                     jit.codeBlock()->globalObjectFor(semanticNodeOrigin),
                                     CCallHelpers::TrustedImmPtr(generator->stubInfo()),
                                     CCallHelpers::TrustedImmPtr(nullptr), base, subscript).call();
@@ -12551,14 +12553,24 @@
 
     void compileInById()
     {
-        compileInBy<InByKind::ById>(lowCell(m_node->child1()), m_node->cacheableIdentifier());
+        compileInBy<AccessType::InById>(lowCell(m_node->child1()), m_node->cacheableIdentifier());
     }
 
     void compileInByVal()
     {
-        compileInBy<InByKind::ByVal>(lowCell(m_node->child1()), lowJSValue(m_node->child2()));
+        compileInBy<AccessType::InByVal>(lowCell(m_node->child1()), lowJSValue(m_node->child2()));
     }
 
+    void compileHasPrivateName()
+    {
+        compileInBy<AccessType::HasPrivateName>(lowCell(m_node->child1()), lowSymbol(m_node->child2()));
+    }
+
+    void compileHasPrivateBrand()
+    {
+        compileInBy<AccessType::HasPrivateBrand>(lowCell(m_node->child1()), lowSymbol(m_node->child2()));
+    }
+
     void compileHasOwnProperty()
     {
         JSGlobalObject* globalObject = m_graph.globalObjectFor(m_origin.semantic);

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -285,8 +285,6 @@
         }
 
         switch (opcodeID) {
-        DEFINE_SLOW_OP(has_private_name)
-        DEFINE_SLOW_OP(has_private_brand)
         DEFINE_SLOW_OP(less)
         DEFINE_SLOW_OP(lesseq)
         DEFINE_SLOW_OP(greater)
@@ -361,6 +359,8 @@
         DEFINE_OP(op_try_get_by_id)
         DEFINE_OP(op_in_by_id)
         DEFINE_OP(op_in_by_val)
+        DEFINE_OP(op_has_private_name)
+        DEFINE_OP(op_has_private_brand)
         DEFINE_OP(op_get_by_id)
         DEFINE_OP(op_get_by_id_with_this)
         DEFINE_OP(op_get_by_id_direct)
@@ -572,6 +572,8 @@
         DEFINE_SLOWCASE_OP(op_try_get_by_id)
         DEFINE_SLOWCASE_OP(op_in_by_id)
         DEFINE_SLOWCASE_OP(op_in_by_val)
+        DEFINE_SLOWCASE_OP(op_has_private_name)
+        DEFINE_SLOWCASE_OP(op_has_private_brand)
         DEFINE_SLOWCASE_OP(op_get_by_id)
         DEFINE_SLOWCASE_OP(op_get_by_id_with_this)
         DEFINE_SLOWCASE_OP(op_get_by_id_direct)

Modified: trunk/Source/_javascript_Core/jit/JIT.h (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JIT.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -571,6 +571,8 @@
         void emit_op_get_prototype_of(const Instruction*);
         void emit_op_in_by_id(const Instruction*);
         void emit_op_in_by_val(const Instruction*);
+        void emit_op_has_private_name(const Instruction*);
+        void emit_op_has_private_brand(const Instruction*);
         void emit_op_init_lazy_reg(const Instruction*);
         void emit_op_overrides_has_instance(const Instruction*);
         void emit_op_instanceof(const Instruction*);
@@ -705,6 +707,8 @@
         void emitSlow_op_get_argument_by_val(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_in_by_id(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_in_by_val(const Instruction*, Vector<SlowCaseEntry>::iterator&);
+        void emitSlow_op_has_private_name(const Instruction*, Vector<SlowCaseEntry>::iterator&);
+        void emitSlow_op_has_private_brand(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_instanceof(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_instanceof_custom(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_jless(const Instruction*, Vector<SlowCaseEntry>::iterator&);
@@ -753,6 +757,9 @@
         void emitRightShift(const Instruction*, bool isUnsigned);
         void emitRightShiftSlowCase(const Instruction*, Vector<SlowCaseEntry>::iterator&, bool isUnsigned);
 
+        void emitHasPrivate(VirtualRegister dst, VirtualRegister base, VirtualRegister propertyOrBrand, AccessType);
+        void emitHasPrivateSlow(VirtualRegister dst, AccessType);
+
         template<typename Op>
         void emitNewFuncCommon(const Instruction*);
         template<typename Op>

Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -249,8 +249,8 @@
         m_stubInfo->m_codePtr = m_stubInfo->slowPathStartLocation;
 }
 
-JITInByValGenerator::JITInByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR)
-    : Base(codeBlock, jitType, codeOrigin, callSiteIndex, AccessType::InByVal, usedRegisters)
+JITInByValGenerator::JITInByValGenerator(CodeBlock* codeBlock, JITType jitType, CodeOrigin codeOrigin, CallSiteIndex callSiteIndex, AccessType accessType, const RegisterSet& usedRegisters, JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR)
+    : Base(codeBlock, jitType, codeOrigin, callSiteIndex, accessType, usedRegisters)
 {
     m_stubInfo->hasConstantIdentifier = false;
 

Modified: trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITInlineCacheGenerator.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -202,7 +202,7 @@
     JITInByValGenerator() { }
 
     JITInByValGenerator(
-        CodeBlock*, JITType, CodeOrigin, CallSiteIndex, const RegisterSet& usedRegisters,
+        CodeBlock*, JITType, CodeOrigin, CallSiteIndex, AccessType, const RegisterSet& usedRegisters,
         JSValueRegs base, JSValueRegs property, JSValueRegs result, GPRReg stubInfoGPR);
 
     MacroAssembler::Jump slowPathJump() const

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -508,43 +508,110 @@
     return JSValue::encode(jsBoolean(CommonSlowPaths::opInByVal(globalObject, JSValue::decode(base), JSValue::decode(key), arrayProfile)));
 }
 
-JSC_DEFINE_JIT_OPERATION(operationHasPrivateName, EncodedJSValue, (JSGlobalObject* globalObject, JSCell* base, EncodedJSValue key))
+JSC_DEFINE_JIT_OPERATION(operationHasPrivateNameOptimize, EncodedJSValue, (JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedBase, EncodedJSValue encodedProperty))
 {
     SuperSamplerScope superSamplerScope(false);
-    
+
     VM& vm = globalObject->vm();
     CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
     JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
+    auto scope = DECLARE_THROW_SCOPE(vm);
 
+    JSValue baseValue = JSValue::decode(encodedBase);
+    if (!baseValue.isObject()) {
+        throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue));
+        return encodedJSValue();
+    }
+    JSObject* baseObject = asObject(baseValue);
+
+    JSValue propertyValue = JSValue::decode(encodedProperty);
+    ASSERT(propertyValue.isSymbol());
+    auto property = propertyValue.toPropertyKey(globalObject);
+    EXCEPTION_ASSERT(!scope.exception());
+
+    PropertySlot slot(baseObject, PropertySlot::InternalMethodType::HasProperty);
+    bool found = JSObject::getPrivateFieldSlot(baseObject, globalObject, property, slot);
+
+    ASSERT(CacheableIdentifier::isCacheableIdentifierCell(propertyValue));
+    CodeBlock* codeBlock = callFrame->codeBlock();
+    CacheableIdentifier identifier = CacheableIdentifier::createFromCell(propertyValue.asCell());
+    if (stubInfo->considerCachingBy(vm, codeBlock, baseObject->structure(vm), identifier))
+        repatchInBy(globalObject, codeBlock, baseObject, identifier, found, slot, *stubInfo, InByKind::PrivateName);
+
+    return JSValue::encode(jsBoolean(found));
+}
+
+JSC_DEFINE_JIT_OPERATION(operationHasPrivateNameGeneric, EncodedJSValue, (JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedBase, EncodedJSValue encodedProperty))
+{
+    SuperSamplerScope superSamplerScope(false);
+
+    VM& vm = globalObject->vm();
+    CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
+    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
     auto scope = DECLARE_THROW_SCOPE(vm);
-    if (!base->isObject()) {
-        throwException(globalObject, scope, createInvalidInParameterError(globalObject, base));
+
+    stubInfo->tookSlowPath = true;
+
+    JSValue baseValue = JSValue::decode(encodedBase);
+    if (!baseValue.isObject()) {
+        throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue));
         return encodedJSValue();
     }
 
-    JSValue propertyValue = JSValue::decode(key);
+    JSValue propertyValue = JSValue::decode(encodedProperty);
     ASSERT(propertyValue.isSymbol());
     auto property = propertyValue.toPropertyKey(globalObject);
     EXCEPTION_ASSERT(!scope.exception());
 
-    return JSValue::encode(jsBoolean(asObject(base)->hasPrivateField(globalObject, property)));
+    return JSValue::encode(jsBoolean(asObject(baseValue)->hasPrivateField(globalObject, property)));
 }
 
-JSC_DEFINE_JIT_OPERATION(operationHasPrivateBrand, EncodedJSValue, (JSGlobalObject* globalObject, JSCell* base, EncodedJSValue brand))
+JSC_DEFINE_JIT_OPERATION(operationHasPrivateBrandOptimize, EncodedJSValue, (JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedBase, EncodedJSValue encodedBrand))
 {
     SuperSamplerScope superSamplerScope(false);
-    
+
     VM& vm = globalObject->vm();
     CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
     JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
+    auto scope = DECLARE_THROW_SCOPE(vm);
 
+    JSValue baseValue = JSValue::decode(encodedBase);
+    if (!baseValue.isObject()) {
+        throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue));
+        return encodedJSValue();
+    }
+    JSObject* baseObject = asObject(baseValue);
+
+    JSValue brand = JSValue::decode(encodedBrand);
+    bool found = asObject(baseValue)->hasPrivateBrand(globalObject, brand);
+
+    ASSERT(CacheableIdentifier::isCacheableIdentifierCell(brand));
+    CodeBlock* codeBlock = callFrame->codeBlock();
+    CacheableIdentifier identifier = CacheableIdentifier::createFromCell(brand.asCell());
+    if (stubInfo->considerCachingBy(vm, codeBlock, baseObject->structure(vm), identifier))
+        repatchHasPrivateBrand(globalObject, codeBlock, baseObject, identifier, found, *stubInfo);
+
+    return JSValue::encode(jsBoolean(found));
+}
+
+JSC_DEFINE_JIT_OPERATION(operationHasPrivateBrandGeneric, EncodedJSValue, (JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedBase, EncodedJSValue encodedBrand))
+{
+    SuperSamplerScope superSamplerScope(false);
+
+    VM& vm = globalObject->vm();
+    CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
+    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
     auto scope = DECLARE_THROW_SCOPE(vm);
-    if (!base->isObject()) {
-        throwException(globalObject, scope, createInvalidInParameterError(globalObject, base));
+
+    stubInfo->tookSlowPath = true;
+
+    JSValue baseValue = JSValue::decode(encodedBase);
+    if (!baseValue.isObject()) {
+        throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue));
         return encodedJSValue();
     }
 
-    return JSValue::encode(jsBoolean(asObject(base)->hasPrivateBrand(globalObject, JSValue::decode(brand))));
+    return JSValue::encode(jsBoolean(asObject(baseValue)->hasPrivateBrand(globalObject, JSValue::decode(encodedBrand))));
 }
 
 JSC_DEFINE_JIT_OPERATION(operationPutByIdStrict, void, (JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, uintptr_t rawCacheableIdentifier))

Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITOperations.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -178,8 +178,10 @@
 JSC_DECLARE_JIT_OPERATION(operationInByIdOptimize, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue, uintptr_t));
 JSC_DECLARE_JIT_OPERATION(operationInByValGeneric, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, ArrayProfile*, EncodedJSValue, EncodedJSValue));
 JSC_DECLARE_JIT_OPERATION(operationInByValOptimize, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, ArrayProfile*, EncodedJSValue, EncodedJSValue));
-JSC_DECLARE_JIT_OPERATION(operationHasPrivateName, EncodedJSValue, (JSGlobalObject*, JSCell*, EncodedJSValue));
-JSC_DECLARE_JIT_OPERATION(operationHasPrivateBrand, EncodedJSValue, (JSGlobalObject*, JSCell*, EncodedJSValue));
+JSC_DECLARE_JIT_OPERATION(operationHasPrivateNameGeneric, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue, EncodedJSValue));
+JSC_DECLARE_JIT_OPERATION(operationHasPrivateNameOptimize, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue, EncodedJSValue));
+JSC_DECLARE_JIT_OPERATION(operationHasPrivateBrandGeneric, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue, EncodedJSValue));
+JSC_DECLARE_JIT_OPERATION(operationHasPrivateBrandOptimize, EncodedJSValue, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue, EncodedJSValue));
 
 JSC_DECLARE_JIT_OPERATION(operationPutByIdStrict, void, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, uintptr_t));
 JSC_DECLARE_JIT_OPERATION(operationPutByIdNonStrict, void, (JSGlobalObject*, StructureStubInfo*, EncodedJSValue encodedValue, EncodedJSValue encodedBase, uintptr_t));

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -1710,7 +1710,7 @@
     emitArrayProfilingSiteWithCell(regT0, regT2, profile);
 
     JITInByValGenerator gen(
-        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), RegisterSet::stubUnavailableRegisters(),
+        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), AccessType::InByVal, RegisterSet::stubUnavailableRegisters(),
         JSValueRegs(regT0), JSValueRegs(regT1), JSValueRegs(regT0), regT2);
     gen.generateFastPath(*this);
     if (!JITCode::useDataIC(JITType::BaselineJIT))
@@ -1772,6 +1772,94 @@
     gen.reportSlowPathCall(coldPathBegin, call);
 }
 
+void JIT::emitHasPrivate(VirtualRegister dst, VirtualRegister base, VirtualRegister propertyOrBrand, AccessType type)
+{
+    emitGetVirtualRegister(base, regT0);
+    emitJumpSlowCaseIfNotJSCell(regT0, base);
+    emitGetVirtualRegister(propertyOrBrand, regT1);
+
+    JITInByValGenerator gen(
+        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), type, RegisterSet::stubUnavailableRegisters(),
+        JSValueRegs(regT0), JSValueRegs(regT1), JSValueRegs(regT0), regT2);
+    gen.generateFastPath(*this);
+    if (!JITCode::useDataIC(JITType::BaselineJIT))
+        addSlowCase(gen.slowPathJump());
+    else
+        addSlowCase();
+    m_inByVals.append(gen);
+
+    emitPutVirtualRegister(dst);
+}
+
+void JIT::emitHasPrivateSlow(VirtualRegister dst, AccessType type)
+{
+    ASSERT(type == AccessType::HasPrivateName || type == AccessType::HasPrivateBrand);
+
+    JITInByValGenerator& gen = m_inByVals[m_inByValIndex++];
+    Label coldPathBegin = label();
+
+#if !ENABLE(EXTRA_CTI_THUNKS)
+    Call call = callOperation(type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize, dst, TrustedImmPtr(m_codeBlock->globalObject()), gen.stubInfo(), regT0, regT1);
+#else
+    VM& vm = this->vm();
+    uint32_t bytecodeOffset = m_bytecodeIndex.offset();
+    ASSERT(BytecodeIndex(bytecodeOffset) == m_bytecodeIndex);
+
+    constexpr GPRReg bytecodeOffsetGPR = argumentGPR3;
+    move(TrustedImm32(bytecodeOffset), bytecodeOffsetGPR);
+
+    constexpr GPRReg stubInfoGPR = argumentGPR2;
+    constexpr GPRReg baseGPR = regT0;
+    constexpr GPRReg propertyOrBrandGPR = regT1;
+    static_assert(baseGPR == argumentGPR0 || !isARM64());
+    static_assert(propertyOrBrandGPR == argumentGPR1);
+
+    move(TrustedImmPtr(gen.stubInfo()), stubInfoGPR);
+    static_assert(std::is_same<decltype(operationHasPrivateNameOptimize), decltype(operationGetPrivateNameOptimize)>::value);
+    static_assert(std::is_same<decltype(operationHasPrivateBrandOptimize), decltype(operationGetPrivateNameOptimize)>::value);
+    emitNakedNearCall(vm.getCTIStub(slow_op_get_private_name_prepareCallGenerator).retaggedCode<NoPtrTag>());
+
+    Call call;
+    if (JITCode::useDataIC(JITType::BaselineJIT))
+        gen.stubInfo()->m_slowOperation = type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize;
+    else
+        call = appendCall(type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize);
+    emitNakedNearCall(vm.getCTIStub(checkExceptionGenerator).retaggedCode<NoPtrTag>());
+
+    emitPutVirtualRegister(dst, returnValueGPR);
+#endif // ENABLE(EXTRA_CTI_THUNKS)
+
+    gen.reportSlowPathCall(coldPathBegin, call);
+}
+
+void JIT::emit_op_has_private_name(const Instruction* currentInstruction)
+{
+    auto bytecode = currentInstruction->as<OpHasPrivateName>();
+    emitHasPrivate(bytecode.m_dst, bytecode.m_base, bytecode.m_property, AccessType::HasPrivateName);
+}
+
+void JIT::emitSlow_op_has_private_name(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+    linkAllSlowCases(iter);
+
+    auto bytecode = currentInstruction->as<OpHasPrivateName>();
+    emitHasPrivateSlow(bytecode.m_dst, AccessType::HasPrivateName);
+}
+
+void JIT::emit_op_has_private_brand(const Instruction* currentInstruction)
+{
+    auto bytecode = currentInstruction->as<OpHasPrivateBrand>();
+    emitHasPrivate(bytecode.m_dst, bytecode.m_base, bytecode.m_brand, AccessType::HasPrivateBrand);
+}
+
+void JIT::emitSlow_op_has_private_brand(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+    linkAllSlowCases(iter);
+
+    auto bytecode = currentInstruction->as<OpHasPrivateBrand>();
+    emitHasPrivateSlow(bytecode.m_dst, AccessType::HasPrivateBrand);
+}
+
 void JIT::emitVarInjectionCheck(bool needsVarInjectionChecks)
 {
     if (!needsVarInjectionChecks)

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -924,7 +924,7 @@
     emitArrayProfilingSiteWithCell(regT0, regT4, profile);
 
     JITInByValGenerator gen(
-        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), RegisterSet::stubUnavailableRegisters(),
+        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), AccessType::InByVal, RegisterSet::stubUnavailableRegisters(),
         JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), JSValueRegs(regT1, regT0), InvalidGPRReg);
     gen.generateFastPath(*this);
     addSlowCase(gen.slowPathJump());
@@ -951,6 +951,61 @@
     gen.reportSlowPathCall(coldPathBegin, call);
 }
 
+void JIT::emitHasPrivate(VirtualRegister dst, VirtualRegister base, VirtualRegister propertyOrBrand, AccessType type)
+{
+    emitLoad2(base, regT1, regT0, propertyOrBrand, regT3, regT2);
+    emitJumpSlowCaseIfNotJSCell(base, regT1);
+
+    JITInByValGenerator gen(
+        m_codeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), type, RegisterSet::stubUnavailableRegisters(),
+        JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), JSValueRegs(regT1, regT0), InvalidGPRReg);
+    gen.generateFastPath(*this);
+    addSlowCase(gen.slowPathJump());
+    m_inByVals.append(gen);
+
+    emitStore(dst, regT1, regT0);
+}
+
+void JIT::emitHasPrivateSlow(VirtualRegister dst, AccessType type)
+{
+    ASSERT(type == AccessType::HasPrivateName || type == AccessType::HasPrivateBrand);
+
+    JITInByValGenerator& gen = m_inByVals[m_inByValIndex++];
+    Label coldPathBegin = label();
+
+    Call call = callOperation(type == AccessType::HasPrivateName ? operationHasPrivateNameOptimize : operationHasPrivateBrandOptimize, dst, TrustedImmPtr(m_codeBlock->globalObject()), gen.stubInfo(), JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
+
+    gen.reportSlowPathCall(coldPathBegin, call);
+}
+
+void JIT::emit_op_has_private_name(const Instruction* currentInstruction)
+{
+    auto bytecode = currentInstruction->as<OpHasPrivateName>();
+    emitHasPrivate(bytecode.m_dst, bytecode.m_base, bytecode.m_property, AccessType::HasPrivateName);
+}
+
+void JIT::emitSlow_op_has_private_name(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+    linkAllSlowCases(iter);
+
+    auto bytecode = currentInstruction->as<OpHasPrivateName>();
+    emitHasPrivateSlow(bytecode.m_dst, AccessType::HasPrivateName);
+}
+
+void JIT::emit_op_has_private_brand(const Instruction* currentInstruction)
+{
+    auto bytecode = currentInstruction->as<OpHasPrivateBrand>();
+    emitHasPrivate(bytecode.m_dst, bytecode.m_base, bytecode.m_brand, AccessType::HasPrivateBrand);
+}
+
+void JIT::emitSlow_op_has_private_brand(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
+{
+    linkAllSlowCases(iter);
+
+    auto bytecode = currentInstruction->as<OpHasPrivateBrand>();
+    emitHasPrivateSlow(bytecode.m_dst, AccessType::HasPrivateBrand);
+}
+
 void JIT::emitVarInjectionCheck(bool needsVarInjectionChecks)
 {
     if (!needsVarInjectionChecks)

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -922,6 +922,32 @@
     }
 }
 
+inline FunctionPtr<CFunctionPtrTag> appropriateOptimizingInByFunction(InByKind kind)
+{
+    switch (kind) {
+    case InByKind::ById:
+        return operationInByIdOptimize;
+    case InByKind::ByVal:
+        return operationInByValOptimize;
+    case InByKind::PrivateName:
+        return operationHasPrivateNameOptimize;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+inline FunctionPtr<CFunctionPtrTag> appropriateGenericInByFunction(InByKind kind)
+{
+    switch (kind) {
+    case InByKind::ById:
+        return operationInByIdGeneric;
+    case InByKind::ByVal:
+        return operationInByValGeneric;
+    case InByKind::PrivateName:
+        return operationHasPrivateNameGeneric;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
 static InlineCacheAction tryCacheInBy(
     JSGlobalObject* globalObject, CodeBlock* codeBlock, JSObject* base, CacheableIdentifier propertyName,
     bool wasFound, const PropertySlot& slot, StructureStubInfo& stubInfo, InByKind kind)
@@ -1016,17 +1042,12 @@
 
         if (result.generatedSomeCode()) {
             LOG_IC((ICEvent::InReplaceWithJump, structure->classInfo(), ident, slot.slotBase() == base));
-            
+
             RELEASE_ASSERT(result.code());
-
-            switch (kind) {
-            case InByKind::ById:
+            if (kind == InByKind::ById)
                 InlineAccess::rewireStubAsJumpInAccess(codeBlock, stubInfo, CodeLocationLabel<JITStubRoutinePtrTag>(result.code()));
-                break;
-            case InByKind::ByVal:
+            else
                 InlineAccess::rewireStubAsJumpInAccessNotUsingInlineAccess(codeBlock, stubInfo, CodeLocationLabel<JITStubRoutinePtrTag>(result.code()));
-                break;
-            }
         }
     }
 
@@ -1042,13 +1063,55 @@
 
     if (tryCacheInBy(globalObject, codeBlock, baseObject, propertyName, wasFound, slot, stubInfo, kind) == GiveUpOnCache) {
         LOG_IC((ICEvent::InReplaceWithGeneric, baseObject->classInfo(globalObject->vm()), Identifier::fromUid(vm, propertyName.uid())));
-        if (kind == InByKind::ById)
-            repatchSlowPathCall(codeBlock, stubInfo, operationInByIdGeneric);
-        else
-            repatchSlowPathCall(codeBlock, stubInfo, operationInByValGeneric);
+        repatchSlowPathCall(codeBlock, stubInfo, appropriateGenericInByFunction(kind));
     }
 }
 
+static InlineCacheAction tryCacheHasPrivateBrand(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSObject* base, CacheableIdentifier brandID, bool wasFound, StructureStubInfo& stubInfo)
+{
+    VM& vm = globalObject->vm();
+    AccessGenerationResult result;
+    Identifier ident = Identifier::fromUid(vm, brandID.uid());
+
+    {
+        GCSafeConcurrentJSLocker locker(codeBlock->m_lock, vm.heap);
+        if (forceICFailure(globalObject))
+            return GiveUpOnCache;
+
+        Structure* structure = base->structure(vm);
+
+        InlineCacheAction action = "" base);
+        if (action != AttemptToCache)
+            return action;
+
+        bool isBaseProperty = true;
+        LOG_IC((ICEvent::InAddAccessCase, structure->classInfo(), ident, isBaseProperty));
+
+        Ref<AccessCase> newCase = AccessCase::create(vm, codeBlock, wasFound ? AccessCase::InHit : AccessCase::InMiss, brandID, invalidOffset, structure, { }, { });
+
+        result = stubInfo.addAccessCase(locker, globalObject, codeBlock, ECMAMode::strict(), brandID, WTFMove(newCase));
+
+        if (result.generatedSomeCode()) {
+            LOG_IC((ICEvent::InReplaceWithJump, structure->classInfo(), ident, isBaseProperty));
+
+            RELEASE_ASSERT(result.code());
+            InlineAccess::rewireStubAsJumpInAccessNotUsingInlineAccess(codeBlock, stubInfo, CodeLocationLabel<JITStubRoutinePtrTag>(result.code()));
+        }
+    }
+
+    fireWatchpointsAndClearStubIfNeeded(vm, stubInfo, codeBlock, result);
+
+    return result.shouldGiveUpNow() ? GiveUpOnCache : RetryCacheLater;
+}
+
+void repatchHasPrivateBrand(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSObject* baseObject, CacheableIdentifier brandID, bool wasFound, StructureStubInfo& stubInfo)
+{
+    SuperSamplerScope superSamplerScope(false);
+
+    if (tryCacheHasPrivateBrand(globalObject, codeBlock, baseObject, brandID, wasFound, stubInfo) == GiveUpOnCache)
+        repatchSlowPathCall(codeBlock, stubInfo, operationHasPrivateBrandGeneric);
+}
+
 static InlineCacheAction tryCacheCheckPrivateBrand(
     JSGlobalObject* globalObject, CodeBlock* codeBlock, JSObject* base, CacheableIdentifier brandID,
     StructureStubInfo& stubInfo)
@@ -1728,18 +1791,19 @@
 
 void resetInBy(CodeBlock* codeBlock, StructureStubInfo& stubInfo, InByKind kind)
 {
-    switch (kind) {
-    case InByKind::ById:
-        repatchSlowPathCall(codeBlock, stubInfo, operationInByIdOptimize);
+    repatchSlowPathCall(codeBlock, stubInfo, appropriateOptimizingInByFunction(kind));
+    if (kind == InByKind::ById)
         InlineAccess::resetStubAsJumpInAccess(codeBlock, stubInfo);
-        break;
-    case InByKind::ByVal:
-        repatchSlowPathCall(codeBlock, stubInfo, operationInByValOptimize);
+    else
         InlineAccess::resetStubAsJumpInAccessNotUsingInlineAccess(codeBlock, stubInfo);
-        break;
-    }
 }
 
+void resetHasPrivateBrand(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
+{
+    repatchSlowPathCall(codeBlock, stubInfo, operationHasPrivateBrandOptimize);
+    InlineAccess::resetStubAsJumpInAccessNotUsingInlineAccess(codeBlock, stubInfo);
+}
+
 void resetInstanceOf(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
 {
     repatchSlowPathCall(codeBlock, stubInfo, operationInstanceOfOptimize);

Modified: trunk/Source/_javascript_Core/jit/Repatch.h (279104 => 279105)


--- trunk/Source/_javascript_Core/jit/Repatch.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/jit/Repatch.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -50,7 +50,8 @@
 
 enum class InByKind {
     ById,
-    ByVal
+    ByVal,
+    PrivateName
 };
 
 void repatchArrayGetByVal(JSGlobalObject*, CodeBlock*, JSValue base, JSValue index, StructureStubInfo&);
@@ -58,6 +59,7 @@
 void repatchPutByID(JSGlobalObject*, CodeBlock*, JSValue, Structure*, CacheableIdentifier, const PutPropertySlot&, StructureStubInfo&, PutKind);
 void repatchDeleteBy(JSGlobalObject*, CodeBlock*, DeletePropertySlot&, JSValue, Structure*, CacheableIdentifier, StructureStubInfo&, DelByKind, ECMAMode);
 void repatchInBy(JSGlobalObject*, CodeBlock*, JSObject*, CacheableIdentifier, bool wasFound, const PropertySlot&, StructureStubInfo&, InByKind);
+void repatchHasPrivateBrand(JSGlobalObject*, CodeBlock*, JSObject*, CacheableIdentifier, bool wasFound,  StructureStubInfo&);
 void repatchCheckPrivateBrand(JSGlobalObject*, CodeBlock*, JSObject*, CacheableIdentifier, StructureStubInfo&);
 void repatchSetPrivateBrand(JSGlobalObject*, CodeBlock*, JSObject*, Structure*, CacheableIdentifier, StructureStubInfo&);
 void repatchInstanceOf(JSGlobalObject*, CodeBlock*, JSValue value, JSValue prototype, StructureStubInfo&, bool wasFound);
@@ -70,6 +72,7 @@
 void resetPutByID(CodeBlock*, StructureStubInfo&);
 void resetDelBy(CodeBlock*, StructureStubInfo&, DelByKind);
 void resetInBy(CodeBlock*, StructureStubInfo&, InByKind);
+void resetHasPrivateBrand(CodeBlock*, StructureStubInfo&);
 void resetInstanceOf(CodeBlock*, StructureStubInfo&);
 void resetCheckPrivateBrand(CodeBlock*, StructureStubInfo&);
 void resetSetPrivateBrand(CodeBlock*, StructureStubInfo&);

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -1432,6 +1432,35 @@
     LLINT_RETURN(jsBoolean(CommonSlowPaths::opInByVal(globalObject, getOperand(callFrame, bytecode.m_base), getOperand(callFrame, bytecode.m_property), &metadata.m_arrayProfile)));
 }
 
+LLINT_SLOW_PATH_DECL(slow_path_has_private_name)
+{
+    LLINT_BEGIN();
+
+    auto bytecode = pc->as<OpHasPrivateName>();
+    auto baseValue = getOperand(callFrame, bytecode.m_base);
+    if (!baseValue.isObject())
+        LLINT_THROW(createInvalidInParameterError(globalObject, baseValue));
+
+    auto propertyValue = getOperand(callFrame, bytecode.m_property);
+    ASSERT(propertyValue.isSymbol());
+    auto property = propertyValue.toPropertyKey(globalObject);
+    EXCEPTION_ASSERT(!throwScope.exception());
+
+    LLINT_RETURN(jsBoolean(asObject(baseValue)->hasPrivateField(globalObject, property)));
+}
+
+LLINT_SLOW_PATH_DECL(slow_path_has_private_brand)
+{
+    LLINT_BEGIN();
+
+    auto bytecode = pc->as<OpHasPrivateBrand>();
+    auto baseValue = getOperand(callFrame, bytecode.m_base);
+    if (!baseValue.isObject())
+        LLINT_THROW(createInvalidInParameterError(globalObject, baseValue));
+
+    LLINT_RETURN(jsBoolean(asObject(baseValue)->hasPrivateBrand(globalObject, getOperand(callFrame, bytecode.m_brand))));
+}
+
 LLINT_SLOW_PATH_DECL(slow_path_put_getter_by_id)
 {
     LLINT_BEGIN();

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h (279104 => 279105)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -73,6 +73,8 @@
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_by_id);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_in_by_id);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_in_by_val);
+LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_has_private_name);
+LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_has_private_brand);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_del_by_id);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_val);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_private_name);

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (279104 => 279105)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-06-22 06:41:14 UTC (rev 279105)
@@ -2010,8 +2010,6 @@
     slowPathOp(get_prototype_of)
 end
 
-slowPathOp(has_private_name)
-slowPathOp(has_private_brand)
 slowPathOp(is_callable)
 slowPathOp(is_constructor)
 slowPathOp(less)
@@ -2044,6 +2042,8 @@
 
 llintSlowPathOp(in_by_id)
 llintSlowPathOp(in_by_val)
+llintSlowPathOp(has_private_name)
+llintSlowPathOp(has_private_brand)
 llintSlowPathOp(del_by_id)
 llintSlowPathOp(del_by_val)
 llintSlowPathOp(instanceof)

Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (279104 => 279105)


--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp	2021-06-22 06:41:14 UTC (rev 279105)
@@ -830,35 +830,6 @@
     RETURN(jsBoolean(GET_C(bytecode.m_operand).jsValue().isConstructor(vm)));
 }
 
-JSC_DEFINE_COMMON_SLOW_PATH(slow_path_has_private_name)
-{
-    BEGIN();
-
-    auto bytecode = pc->as<OpHasPrivateName>();
-    auto baseValue = GET_C(bytecode.m_base).jsValue();
-    if (!baseValue.isObject())
-        THROW(createInvalidInParameterError(globalObject, baseValue));
-
-    auto propertyValue = GET_C(bytecode.m_property).jsValue();
-    ASSERT(propertyValue.isSymbol());
-    auto property = propertyValue.toPropertyKey(globalObject);
-    EXCEPTION_ASSERT(!throwScope.exception());
-
-    RETURN(jsBoolean(asObject(baseValue)->hasPrivateField(globalObject, property)));
-}
-
-JSC_DEFINE_COMMON_SLOW_PATH(slow_path_has_private_brand)
-{
-    BEGIN();
-
-    auto bytecode = pc->as<OpHasPrivateBrand>();
-    auto baseValue = GET_C(bytecode.m_base).jsValue();
-    if (!baseValue.isObject())
-        THROW(createInvalidInParameterError(globalObject, baseValue));
-
-    RETURN(jsBoolean(asObject(baseValue)->hasPrivateBrand(globalObject, GET_C(bytecode.m_brand).jsValue())));
-}
-
 template<OpcodeSize width>
 ALWAYS_INLINE SlowPathReturnType iteratorOpenTryFastImpl(VM& vm, JSGlobalObject* globalObject, CodeBlock* codeBlock, CallFrame* callFrame, const Instruction* pc)
 {

Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (279104 => 279105)


--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -251,8 +251,6 @@
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof_is_function);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_callable);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_constructor);
-JSC_DECLARE_COMMON_SLOW_PATH(slow_path_has_private_name);
-JSC_DECLARE_COMMON_SLOW_PATH(slow_path_has_private_brand);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_strcat);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_to_primitive);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_to_property_key);

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (279104 => 279105)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-06-22 06:08:29 UTC (rev 279104)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-06-22 06:41:14 UTC (rev 279105)
@@ -529,7 +529,7 @@
     v(Bool, usePrivateStaticClassFields, true, Normal, "If true, the parser will understand private static data fields inside classes.") \
     v(Bool, usePrivateClassFields, true, Normal, "If true, the parser will understand private data fields inside classes.") \
     v(Bool, usePrivateMethods, true, Normal, "If true, the parser will understand private methods inside classes.") \
-    v(Bool, usePrivateIn, false, Normal, "If true, the parser will understand private member existence checks with the `in` operator.") \
+    v(Bool, usePrivateIn, true, Normal, "If true, the parser will understand private member existence checks with the `in` operator.") \
     v(Bool, useWebAssemblyStreaming, true, Normal, "Allow to run WebAssembly's Streaming API") \
     v(Bool, useWebAssemblyReferences, true, Normal, "Allow types from the wasm references spec.") \
     v(Bool, useWebAssemblyTypedFunctionReferences, false, Normal, "Allow function types from the wasm typed function references spec.") \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to