Title: [283887] trunk/Source/_javascript_Core
Revision
283887
Author
[email protected]
Date
2021-10-11 02:10:40 -0700 (Mon, 11 Oct 2021)

Log Message

[JSC][32bit] Fix profiling in baseline
https://bugs.webkit.org/show_bug.cgi?id=231368

Patch by Geza Lore <[email protected]> on 2021-10-11
Reviewed by Yusuke Suzuki.

Fixes profiling omissions introduced with the recent 32-bit baseline
build fixes, and also brings the rest of profile updates in-line with
the unlinked baseline on 64-bit platforms.

* jit/JIT.h:
* jit/JITCall32_64.cpp:
(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileSetupFrame):
(JSC::JIT::compileOpCall):
(JSC::JIT::emit_op_iterator_open):
(JSC::JIT::emitSlow_op_iterator_open):
(JSC::JIT::emit_op_iterator_next):
(JSC::JIT::emitSlow_op_iterator_next):
* jit/JITInlines.h:
(JSC::JIT::emitValueProfilingSiteIfProfiledOpcode):
(JSC::JIT::emitValueProfilingSite):
(JSC::JIT::emitArrayProfilingSiteWithCell):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_jneq_ptr):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_to_numeric):
(JSC::JIT::emit_op_to_object):
(JSC::JIT::emit_op_catch):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_get_private_name):
(JSC::JIT::emitSlow_op_get_private_name):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id_direct):
(JSC::JIT::emitSlow_op_get_by_id_direct):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_by_id_with_this):
(JSC::JIT::emitSlow_op_get_by_id_with_this):
(JSC::JIT::emit_op_in_by_val):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_get_internal_field):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (283886 => 283887)


--- trunk/Source/_javascript_Core/ChangeLog	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-10-11 09:10:40 UTC (rev 283887)
@@ -1,3 +1,52 @@
+2021-10-11  Geza Lore  <[email protected]>
+
+        [JSC][32bit] Fix profiling in baseline
+        https://bugs.webkit.org/show_bug.cgi?id=231368
+
+        Reviewed by Yusuke Suzuki.
+
+        Fixes profiling omissions introduced with the recent 32-bit baseline
+        build fixes, and also brings the rest of profile updates in-line with
+        the unlinked baseline on 64-bit platforms.
+
+        * jit/JIT.h:
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::emitPutCallResult):
+        (JSC::JIT::compileSetupFrame):
+        (JSC::JIT::compileOpCall):
+        (JSC::JIT::emit_op_iterator_open):
+        (JSC::JIT::emitSlow_op_iterator_open):
+        (JSC::JIT::emit_op_iterator_next):
+        (JSC::JIT::emitSlow_op_iterator_next):
+        * jit/JITInlines.h:
+        (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode):
+        (JSC::JIT::emitValueProfilingSite):
+        (JSC::JIT::emitArrayProfilingSiteWithCell):
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::emit_op_jneq_ptr):
+        (JSC::JIT::emit_op_to_number):
+        (JSC::JIT::emit_op_to_numeric):
+        (JSC::JIT::emit_op_to_object):
+        (JSC::JIT::emit_op_catch):
+        * jit/JITPropertyAccess32_64.cpp:
+        (JSC::JIT::emit_op_get_by_val):
+        (JSC::JIT::emitSlow_op_get_by_val):
+        (JSC::JIT::emit_op_get_private_name):
+        (JSC::JIT::emitSlow_op_get_private_name):
+        (JSC::JIT::emit_op_put_by_val):
+        (JSC::JIT::emit_op_try_get_by_id):
+        (JSC::JIT::emit_op_get_by_id_direct):
+        (JSC::JIT::emitSlow_op_get_by_id_direct):
+        (JSC::JIT::emit_op_get_by_id):
+        (JSC::JIT::emitSlow_op_get_by_id):
+        (JSC::JIT::emit_op_get_by_id_with_this):
+        (JSC::JIT::emitSlow_op_get_by_id_with_this):
+        (JSC::JIT::emit_op_in_by_val):
+        (JSC::JIT::emit_op_get_from_scope):
+        (JSC::JIT::emitSlow_op_get_from_scope):
+        (JSC::JIT::emit_op_get_from_arguments):
+        (JSC::JIT::emit_op_get_internal_field):
+
 2021-10-10  Sihui Liu  <[email protected]>
 
         Add support for iterating FileSystemDirectoryHandle

Modified: trunk/Source/_javascript_Core/jit/JIT.h (283886 => 283887)


--- trunk/Source/_javascript_Core/jit/JIT.h	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2021-10-11 09:10:40 UTC (rev 283887)
@@ -343,17 +343,12 @@
         void emitWriteBarrier(JSCell* owner);
         void emitWriteBarrier(GPRReg owner);
 
-        // This assumes that the value to profile is in regT0 and that regT3 is available for
-        // scratch.
+#if USE(JSVALUE64)
         template<typename Bytecode> void emitValueProfilingSite(const Bytecode&, GPRReg);
+#endif
         template<typename Bytecode> void emitValueProfilingSite(const Bytecode&, JSValueRegs);
-#if USE(JSVALUE32_64)
-        void emitValueProfilingSite(ValueProfile&, JSValueRegs);
-        template<typename Metadata>
-        std::enable_if_t<std::is_same<decltype(Metadata::m_profile), ValueProfile>::value, void>
-        emitValueProfilingSite(Metadata&, JSValueRegs);
-#endif
 
+        // This assumes that the value to profile is in regT0 (regT1/regT0 on JSVALUE32_64).
         void emitValueProfilingSiteIfProfiledOpcode(...);
         template<typename Op>
         std::enable_if_t<std::is_same<decltype(Op::Metadata::m_profile), ValueProfile>::value, void>
@@ -364,11 +359,6 @@
         template <typename Bytecode>
         void emitArrayProfilingSiteWithCell(const Bytecode&, ptrdiff_t, RegisterID cellGPR, RegisterID scratchGPR);
 
-#if USE(JSVALUE32_64)
-        void emitArrayProfilingSiteWithCell(RegisterID, ArrayProfile* , RegisterID);
-        void emitArrayProfilingSiteWithCell(RegisterID, RegisterID , RegisterID);
-#endif
-
         template<typename Op>
         ECMAMode ecmaMode(Op);
 

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (283886 => 283887)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2021-10-11 09:10:40 UTC (rev 283887)
@@ -52,7 +52,7 @@
 template<typename Op>
 void JIT::emitPutCallResult(const Op& bytecode)
 {
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), JSValueRegs(regT1, regT0));
+    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
     emitStore(destinationFor(bytecode, m_bytecodeIndex.checkpoint()).virtualRegister(), regT1, regT0);
 }
 
@@ -157,7 +157,6 @@
 JIT::compileSetupFrame(const Op& bytecode, CallLinkInfo*)
 {
     unsigned checkpoint = m_bytecodeIndex.checkpoint();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     int argCount = argumentCountIncludingThisFor(bytecode, checkpoint);
     int registerOffset = -static_cast<int>(stackOffsetInRegistersForCall(bytecode, checkpoint));
 
@@ -164,8 +163,8 @@
     if (Op::opcodeID == op_call && shouldEmitProfiling()) {
         emitLoad(VirtualRegister(registerOffset + CallFrame::argumentOffsetIncludingThis(0)), regT0, regT1);
         Jump done = branchIfNotCell(regT0);
-        load32(Address(regT1, JSCell::structureIDOffset()), regT1);
-        store32(regT1, metadata.m_callLinkInfo.m_arrayProfile.addressOfLastSeenStructureID());
+        load32(Address(regT1, JSCell::structureIDOffset()), regT0);
+        store32ToMetadata(regT0, bytecode, OpCall::Metadata::offsetOfCallLinkInfo() + LLIntCallLinkInfo::offsetOfArrayProfile() + ArrayProfile::offsetOfLastSeenStructureID());
         done.link(this);
     }
 
@@ -320,7 +319,7 @@
         return;
     }
 
-    auto slowPaths = info->emitFastPath(*this, regT0, regT2, CallLinkInfo::UseDataIC::Yes);
+    auto slowPaths = info->emitFastPath(*this, regT0, regT2, CallLinkInfo::UseDataIC::No);
     addSlowCase(slowPaths);
     m_callCompilationInfo[callLinkInfoIndex].doneLocation = label();
 
@@ -411,7 +410,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByIds.append(gen);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), nextRegs);
+    emitValueProfilingSite(bytecode, nextRegs);
     emitPutVirtualRegister(bytecode.m_next, nextRegs);
 
     fastCase.link(this);
@@ -441,7 +440,7 @@
     Label coldPathBegin = label();
 
     Call call = callOperationWithProfile(
-        bytecode.metadata(m_profiledCodeBlock), // metadata
+        bytecode,
         operationGetByIdOptimize, // operation
         nextVReg, // result
         TrustedImmPtr(m_profiledCodeBlock->globalObject()), // arg1
@@ -461,7 +460,6 @@
 void JIT::emit_op_iterator_next(const Instruction* instruction)
 {
     auto bytecode = instruction->as<OpIteratorNext>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     auto* tryFastFunction = ([&] () {
         switch (instruction->width()) {
         case Narrow: return iterator_next_try_fast_narrow;
@@ -480,7 +478,9 @@
     Jump fastCase = branch32(NotEqual, GPRInfo::returnValueGPR2, TrustedImm32(static_cast<uint32_t>(IterationMode::Generic)));
 
     genericCase.link(this);
-    or8(TrustedImm32(static_cast<uint8_t>(IterationMode::Generic)), AbsoluteAddress(&metadata.m_iterationMetadata.seenModes));
+    load8FromMetadata(bytecode, OpIteratorNext::Metadata::offsetOfIterationMetadata() + IterationModeMetadata::offsetOfSeenModes(), regT0);
+    or32(TrustedImm32(static_cast<uint8_t>(IterationMode::Generic)), regT0);
+    store8ToMetadata(regT0, bytecode, OpIteratorNext::Metadata::offsetOfIterationMetadata() + IterationModeMetadata::offsetOfSeenModes());
     compileOpCall<OpIteratorNext>(instruction, m_callLinkInfoIndex++);
     advanceToNextCheckpoint();
     // call result ({ done, value } JSObject) in regT1, regT0
@@ -521,7 +521,7 @@
         addSlowCase(gen.slowPathJump());
         m_getByIds.append(gen);
 
-        emitValueProfilingSite(metadata, doneRegs);
+        emitValueProfilingSite(bytecode, doneRegs);
         emitPutVirtualRegister(bytecode.m_done, doneRegs);
         advanceToNextCheckpoint();
     }
@@ -551,7 +551,7 @@
         addSlowCase(gen.slowPathJump());
         m_getByIds.append(gen);
 
-        emitValueProfilingSite(metadata, resultRegs);
+        emitValueProfilingSite(bytecode, resultRegs);
         emitPutVirtualRegister(bytecode.m_value, resultRegs);
 
         iterationDone.link(this);
@@ -589,7 +589,7 @@
         Label coldPathBegin = label();
 
         Call call = callOperationWithProfile(
-            bytecode.metadata(m_profiledCodeBlock), // metadata
+            bytecode,
             operationGetByIdOptimize, // operation
             doneVReg, // result
             TrustedImmPtr(m_profiledCodeBlock->globalObject()), // arg1
@@ -619,7 +619,7 @@
         Label coldPathBegin = label();
 
         Call call = callOperationWithProfile(
-            bytecode.metadata(m_profiledCodeBlock), // metadata
+            bytecode,
             operationGetByIdOptimize, // operation
             valueVReg, // result
             TrustedImmPtr(m_profiledCodeBlock->globalObject()), // arg1

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (283886 => 283887)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2021-10-11 09:10:40 UTC (rev 283887)
@@ -329,32 +329,15 @@
     return getConstantOperand(src).isString() && asString(getConstantOperand(src).asCell())->length() == 1;
 }
 
-#if USE(JSVALUE32_64)
-inline void JIT::emitValueProfilingSite(ValueProfile& valueProfile, JSValueRegs value)
-{
-    if (!shouldEmitProfiling())
-        return;
-
-    EncodedValueDescriptor* descriptor = bitwise_cast<EncodedValueDescriptor*>(valueProfile.m_buckets);
-    store32(value.payloadGPR(), &descriptor->asBits.payload);
-    store32(value.tagGPR(), &descriptor->asBits.tag);
-}
-
-template<typename Metadata>
-std::enable_if_t<std::is_same<decltype(Metadata::m_profile), ValueProfile>::value, void> JIT::emitValueProfilingSite(Metadata& metadata, JSValueRegs value)
-{
-    emitValueProfilingSite(valueProfileFor(metadata, m_bytecodeIndex.checkpoint()), value);
-}
-#endif
-
 template<typename Op>
 inline std::enable_if_t<std::is_same<decltype(Op::Metadata::m_profile), ValueProfile>::value, void> JIT::emitValueProfilingSiteIfProfiledOpcode(Op bytecode)
 {
 #if USE(JSVALUE64)
-    emitValueProfilingSite(bytecode, regT0);
+    JSValueRegs result { regT0 };
 #else
-    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
+    JSValueRegs result { regT1, regT0 };
 #endif
+    emitValueProfilingSite(bytecode, result);
 }
 
 inline void JIT::emitValueProfilingSiteIfProfiledOpcode(...) { }
@@ -365,27 +348,28 @@
     if (!shouldEmitProfiling())
         return;
 
+    ptrdiff_t offset = m_unlinkedCodeBlock->metadata().offsetInMetadataTable(bytecode) + valueProfileOffsetFor<Bytecode>(m_bytecodeIndex.checkpoint()) + ValueProfile::offsetOfFirstBucket();
 #if USE(JSVALUE64)
-    ptrdiff_t offset = m_unlinkedCodeBlock->metadata().offsetInMetadataTable(bytecode) + valueProfileOffsetFor<Bytecode>(m_bytecodeIndex.checkpoint()) + ValueProfile::offsetOfFirstBucket();
     store64(value.gpr(), Address(s_metadataGPR, offset));
 #else
-    UNUSED_PARAM(value);
-    UNUSED_PARAM(bytecode);
-    // FIXME.
+    store32(value.payloadGPR(), Address(s_metadataGPR, offset + PayloadOffset));
+    store32(value.tagGPR(), Address(s_metadataGPR, offset + TagOffset));
 #endif
 }
 
+#if USE(JSVALUE64)
 template<typename Bytecode>
 inline void JIT::emitValueProfilingSite(const Bytecode& bytecode, GPRReg resultReg)
 {
     emitValueProfilingSite(bytecode, JSValueRegs(resultReg));
 }
+#endif
 
 template <typename Bytecode>
 inline void JIT::emitArrayProfilingSiteWithCell(const Bytecode& bytecode, ptrdiff_t offsetOfArrayProfile, RegisterID cellGPR, RegisterID scratchGPR)
 {
     if (shouldEmitProfiling()) {
-        load32(MacroAssembler::Address(cellGPR, JSCell::structureIDOffset()), scratchGPR);
+        load32(Address(cellGPR, JSCell::structureIDOffset()), scratchGPR);
         store32ToMetadata(scratchGPR, bytecode, offsetOfArrayProfile);
     }
 }
@@ -396,24 +380,6 @@
     emitArrayProfilingSiteWithCell(bytecode, Bytecode::Metadata::offsetOfArrayProfile() + ArrayProfile::offsetOfLastSeenStructureID(), cellGPR, scratchGPR);
 }
 
-#if USE(JSVALUE32_64)
-inline void JIT::emitArrayProfilingSiteWithCell(RegisterID cellGPR, ArrayProfile* arrayProfile, RegisterID scratchGPR)
-{
-    if (shouldEmitProfiling()) {
-        load32(MacroAssembler::Address(cellGPR, JSCell::structureIDOffset()), scratchGPR);
-        store32(scratchGPR, arrayProfile->addressOfLastSeenStructureID());
-    }
-}
-
-inline void JIT::emitArrayProfilingSiteWithCell(RegisterID cellGPR, RegisterID arrayProfileGPR, RegisterID scratchGPR)
-{
-    if (shouldEmitProfiling()) {
-        load32(MacroAssembler::Address(cellGPR, JSCell::structureIDOffset()), scratchGPR);
-        store32(scratchGPR, Address(arrayProfileGPR, ArrayProfile::offsetOfLastSeenStructureID()));
-    }
-}
-#endif
-
 ALWAYS_INLINE int32_t JIT::getOperandConstantInt(VirtualRegister src)
 {
     return getConstantOperand(src).asInt32();

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (283886 => 283887)


--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2021-10-11 09:10:40 UTC (rev 283887)
@@ -518,7 +518,6 @@
 void JIT::emit_op_jneq_ptr(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<OpJneqPtr>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     VirtualRegister src = ""
     JSValue specialPointer = getConstantOperand(bytecode.m_specialPointer);
     ASSERT(specialPointer.isCell());
@@ -528,7 +527,7 @@
     Jump notCell = branchIfNotCell(regT1);
     Jump equal = branchPtr(Equal, regT0, TrustedImmPtr(specialPointer.asCell()));
     notCell.link(this);
-    store8(TrustedImm32(1), &metadata.m_hasJumped);
+    store8ToMetadata(TrustedImm32(1), bytecode, OpJneqPtr::Metadata::offsetOfHasJumped());
     addJump(jump(), target);
     equal.link(this);
 }
@@ -876,7 +875,7 @@
     addSlowCase(branch32(AboveOrEqual, regT1, TrustedImm32(JSValue::LowestTag)));
     isInt32.link(this);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), JSValueRegs(regT1, regT0));
+    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
     if (src != dst)
         emitStore(dst, regT1, regT0);
 }
@@ -898,7 +897,7 @@
     addSlowCase(branchIfNotNumber(argumentValueRegs, regT2));
     isBigInt.link(this);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), JSValueRegs(regT1, regT0));
+    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
     if (src != dst)
         emitStore(dst, regT1, regT0);
 }
@@ -929,7 +928,7 @@
     addSlowCase(branchIfNotCell(regT1));
     addSlowCase(branchIfNotObject(regT0));
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), JSValueRegs(regT1, regT0));
+    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
     if (src != dst)
         emitStore(dst, regT1, regT0);
 }
@@ -979,23 +978,11 @@
     // argument type proofs, storing locals to the buffer, etc
     // https://bugs.webkit.org/show_bug.cgi?id=175598
 
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
-    ValueProfileAndVirtualRegisterBuffer* buffer = metadata.m_buffer;
-    if (buffer || !shouldEmitProfiling())
-        callOperationNoExceptionCheck(operationTryOSREnterAtCatch, &vm(), m_bytecodeIndex.asBits());
-    else
-        callOperationNoExceptionCheck(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
+    callOperationNoExceptionCheck(operationTryOSREnterAtCatchAndValueProfile, &vm(), m_bytecodeIndex.asBits());
     auto skipOSREntry = branchTestPtr(Zero, returnValueGPR);
     emitRestoreCalleeSaves();
     farJump(returnValueGPR, NoPtrTag);
     skipOSREntry.link(this);
-    if (buffer && shouldEmitProfiling()) {
-        buffer->forEach([&] (ValueProfileAndVirtualRegister& profile) {
-            JSValueRegs regs(regT1, regT0);
-            emitGetVirtualRegister(profile.m_operand, regs);
-            emitValueProfilingSite(static_cast<ValueProfile&>(profile), regs);
-        });
-    }
 #endif // ENABLE(DFG_JIT)
 }
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (283886 => 283887)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2021-10-11 08:14:39 UTC (rev 283886)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2021-10-11 09:10:40 UTC (rev 283887)
@@ -237,22 +237,20 @@
 void JIT::emit_op_get_by_val(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<OpGetByVal>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister base = bytecode.m_base;
     VirtualRegister property = bytecode.m_property;
-    ArrayProfile* profile = ""
 
     emitLoad2(base, regT1, regT0, property, regT3, regT2);
 
-    if (metadata.m_seenIdentifiers.count() > Options::getByValICMaxNumberOfIdentifiers()) {
+    if (bytecode.metadata(m_profiledCodeBlock).m_seenIdentifiers.count() > Options::getByValICMaxNumberOfIdentifiers()) {
         auto notCell = branchIfNotCell(regT1);
-        emitArrayProfilingSiteWithCell(regT0, profile, regT4);
+        emitArrayProfilingSiteWithCell(bytecode, regT0, regT4);
         notCell.link(this);
-        callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetByVal, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
+        callOperationWithProfile(bytecode, operationGetByVal, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
     } else {
         emitJumpSlowCaseIfNotJSCell(base, regT1);
-        emitArrayProfilingSiteWithCell(regT0, profile, regT4);
+        emitArrayProfilingSiteWithCell(bytecode, regT0, regT4);
 
         JSValueRegs resultRegs = JSValueRegs(regT1, regT0);
 
@@ -265,7 +263,7 @@
         addSlowCase(gen.slowPathJump());
         m_getByVals.append(gen);
 
-        emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+        emitValueProfilingSite(bytecode, resultRegs);
         emitStore(dst, regT1, regT0);
     }
 }
@@ -284,7 +282,7 @@
         linkAllSlowCases(iter);
 
         Label coldPathBegin = label();
-        Call call = callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetByValOptimize, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), gen.stubInfo(), profile, JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
+        Call call = callOperationWithProfile(bytecode, operationGetByValOptimize, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), gen.stubInfo(), profile, JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
         gen.reportSlowPathCall(coldPathBegin, call);
     }
 }
@@ -311,7 +309,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByVals.append(gen);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
@@ -330,7 +328,7 @@
 
     auto baseGPR = JSValueRegs(regT1, regT0);
     auto propertyGPR = JSValueRegs(regT3, regT2);
-    Call call = callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetPrivateNameOptimize, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), gen.stubInfo(), baseGPR, propertyGPR);
+    Call call = callOperationWithProfile(bytecode, operationGetPrivateNameOptimize, dst, TrustedImmPtr(m_profiledCodeBlock->globalObject()), gen.stubInfo(), baseGPR, propertyGPR);
     gen.reportSlowPathCall(coldPathBegin, call);
 }
 
@@ -465,17 +463,16 @@
 void JIT::emit_op_put_by_val(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<Op>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     VirtualRegister base = bytecode.m_base;
     VirtualRegister property = bytecode.m_property;
     VirtualRegister value = bytecode.m_value;
-    ArrayProfile* profile = ""
 
     emitLoad2(base, regT1, regT0, property, regT3, regT2);
     emitLoad(value, regT5, regT4);
-    move(TrustedImmPtr(profile), regT6);
+
     emitJumpSlowCaseIfNotJSCell(base, regT1);
-    emitArrayProfilingSiteWithCell(regT0, regT6, regT7);
+    emitArrayProfilingSiteWithCell(bytecode, regT0, regT6);
+    materializePointerIntoMetadata(bytecode, Op::Metadata::offsetOfArrayProfile(), regT6);
 
     JITPutByValGenerator gen(
         m_profiledCodeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), AccessType::PutByVal, RegisterSet::stubUnavailableRegisters(),
@@ -548,7 +545,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByIds.append(gen);
     
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
@@ -589,7 +586,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByIds.append(gen);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
@@ -605,7 +602,7 @@
 
     Label coldPathBegin = label();
 
-    Call call = callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetByIdDirectOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
+    Call call = callOperationWithProfile(bytecode, operationGetByIdDirectOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
 
     gen.reportSlowPathCall(coldPathBegin, call);
 }
@@ -614,7 +611,6 @@
 void JIT::emit_op_get_by_id(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<OpGetById>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister base = bytecode.m_base;
     const Identifier* ident = &(m_profiledCodeBlock->identifier(bytecode.m_property));
@@ -623,8 +619,9 @@
     emitJumpSlowCaseIfNotJSCell(base, regT1);
 
     if (*ident == m_vm->propertyNames->length && shouldEmitProfiling()) {
-        Jump notArrayLengthMode = branch8(NotEqual, AbsoluteAddress(&metadata.m_modeMetadata.mode), TrustedImm32(static_cast<uint8_t>(GetByIdMode::ArrayLength)));
-        emitArrayProfilingSiteWithCell(regT0, &metadata.m_modeMetadata.arrayLengthMode.arrayProfile, regT2);
+        load8FromMetadata(bytecode, OpGetById::Metadata::offsetOfModeMetadata() + GetByIdModeMetadata::offsetOfMode(), regT2);
+        Jump notArrayLengthMode = branch32(NotEqual, TrustedImm32(static_cast<uint8_t>(GetByIdMode::ArrayLength)), regT2);
+        emitArrayProfilingSiteWithCell(bytecode, OpGetById::Metadata::offsetOfModeMetadata() + GetByIdModeMetadataArrayLength::offsetOfArrayProfile(), regT0, regT2);
         notArrayLengthMode.link(this);
     }
 
@@ -636,7 +633,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByIds.append(gen);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
@@ -652,7 +649,7 @@
     
     Label coldPathBegin = label();
     
-    Call call = callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetByIdOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
+    Call call = callOperationWithProfile(bytecode, operationGetByIdOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
     
     gen.reportSlowPathCall(coldPathBegin, call);
 }
@@ -679,7 +676,7 @@
     addSlowCase(gen.slowPathJump());
     m_getByIdsWithThis.append(gen);
 
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
@@ -695,7 +692,7 @@
     
     Label coldPathBegin = label();
     
-    Call call = callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetByIdWithThisOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), JSValueRegs(regT4, regT3), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
+    Call call = callOperationWithProfile(bytecode, operationGetByIdWithThisOptimize, resultVReg, m_profiledCodeBlock->globalObject(), gen.stubInfo(), JSValueRegs(regT1, regT0), JSValueRegs(regT4, regT3), CacheableIdentifier::createFromIdentifierOwnedByCodeBlock(m_profiledCodeBlock, *ident).rawBits());
     
     gen.reportSlowPathCall(coldPathBegin, call);
 }
@@ -796,12 +793,10 @@
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister base = bytecode.m_base;
     VirtualRegister property = bytecode.m_property;
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
-    ArrayProfile* profile = ""
 
     emitLoad2(base, regT1, regT0, property, regT3, regT2);
     emitJumpSlowCaseIfNotJSCell(base, regT1);
-    emitArrayProfilingSiteWithCell(regT0, profile, regT4);
+    emitArrayProfilingSiteWithCell(bytecode, regT0, regT4);
 
     JITInByValGenerator gen(
         m_profiledCodeBlock, JITType::BaselineJIT, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), AccessType::InByVal, RegisterSet::stubUnavailableRegisters(),
@@ -1142,7 +1137,7 @@
         emitCode(resolveType, false);
         break;
     }
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), JSValueRegs(regT1, regT0));
+    emitValueProfilingSite(bytecode, JSValueRegs(regT1, regT0));
     emitStore(dst, regT1, regT0);
 }
 
@@ -1152,7 +1147,7 @@
 
     auto bytecode = currentInstruction->as<OpGetFromScope>();
     VirtualRegister dst = bytecode.m_dst;
-    callOperationWithProfile(bytecode.metadata(m_profiledCodeBlock), operationGetFromScope, dst, m_profiledCodeBlock->globalObject(), currentInstruction);
+    callOperationWithProfile(bytecode, operationGetFromScope, dst, m_profiledCodeBlock->globalObject(), currentInstruction);
 }
 
 void JIT::emitPutGlobalVariable(JSValue* operand, VirtualRegister value, WatchpointSet* set)
@@ -1324,13 +1319,13 @@
     VirtualRegister arguments = bytecode.m_arguments;
     int index = bytecode.m_index;
 
-    JSValueRegs resutlRegs = JSValueRegs(regT1, regT0);
+    JSValueRegs resultRegs = JSValueRegs(regT1, regT0);
     
     emitLoadPayload(arguments, regT0);
-    load32(Address(regT0, DirectArguments::storageOffset() + index * sizeof(WriteBarrier<Unknown>) + TagOffset), resutlRegs.tagGPR());
-    load32(Address(regT0, DirectArguments::storageOffset() + index * sizeof(WriteBarrier<Unknown>) + PayloadOffset), resutlRegs.payloadGPR());
-    emitValueProfilingSite(bytecode.metadata(m_profiledCodeBlock), resutlRegs);
-    emitStore(dst, resutlRegs.tagGPR(), resutlRegs.payloadGPR());
+    load32(Address(regT0, DirectArguments::storageOffset() + index * sizeof(WriteBarrier<Unknown>) + TagOffset), resultRegs.tagGPR());
+    load32(Address(regT0, DirectArguments::storageOffset() + index * sizeof(WriteBarrier<Unknown>) + PayloadOffset), resultRegs.payloadGPR());
+    emitValueProfilingSite(bytecode, resultRegs);
+    emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
 void JIT::emit_op_put_to_arguments(const Instruction* currentInstruction)
@@ -1351,7 +1346,6 @@
 void JIT::emit_op_get_internal_field(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<OpGetInternalField>();
-    auto& metadata = bytecode.metadata(m_profiledCodeBlock);
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister base = bytecode.m_base;
     unsigned index = bytecode.m_index;
@@ -1361,7 +1355,7 @@
     emitLoadPayload(base, regT2);
     load32(Address(regT2, JSInternalFieldObjectImpl<>::offsetOfInternalField(index) + TagOffset), resultRegs.tagGPR());
     load32(Address(regT2, JSInternalFieldObjectImpl<>::offsetOfInternalField(index) + PayloadOffset), resultRegs.payloadGPR());
-    emitValueProfilingSite(metadata, resultRegs);
+    emitValueProfilingSite(bytecode, resultRegs);
     emitStore(dst, resultRegs.tagGPR(), resultRegs.payloadGPR());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to