Title: [250477] branches/safari-608-branch/Source/_javascript_Core
Revision
250477
Author
[email protected]
Date
2019-09-27 18:20:58 -0700 (Fri, 27 Sep 2019)

Log Message

Cherry-pick r250440. rdar://problem/55800893

    OSR exit shouldn't bother updating get_by_id array profiles that have changed modes
    https://bugs.webkit.org/show_bug.cgi?id=202324
    <rdar://problem/52669110>

    Reviewed by Yusuke Suzuki.

    This is an optimization that avoids polluting the array profile.

    * dfg/DFGOSRExit.cpp:
    (JSC::DFG::OSRExit::executeOSRExit):
    (JSC::DFG::OSRExit::compileExit):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/_javascript_Core/ChangeLog (250476 => 250477)


--- branches/safari-608-branch/Source/_javascript_Core/ChangeLog	2019-09-28 01:20:54 UTC (rev 250476)
+++ branches/safari-608-branch/Source/_javascript_Core/ChangeLog	2019-09-28 01:20:58 UTC (rev 250477)
@@ -1,3 +1,36 @@
+2019-09-27  Alan Coon  <[email protected]>
+
+        Cherry-pick r250440. rdar://problem/55800893
+
+    OSR exit shouldn't bother updating get_by_id array profiles that have changed modes
+    https://bugs.webkit.org/show_bug.cgi?id=202324
+    <rdar://problem/52669110>
+    
+    Reviewed by Yusuke Suzuki.
+    
+    This is an optimization that avoids polluting the array profile.
+    
+    * dfg/DFGOSRExit.cpp:
+    (JSC::DFG::OSRExit::executeOSRExit):
+    (JSC::DFG::OSRExit::compileExit):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-27  Keith Miller  <[email protected]>
+
+            OSR exit shouldn't bother updating get_by_id array profiles that have changed modes
+            https://bugs.webkit.org/show_bug.cgi?id=202324
+            <rdar://problem/52669110>
+
+            Reviewed by Yusuke Suzuki.
+
+            This is an optimization that avoids polluting the array profile.
+
+            * dfg/DFGOSRExit.cpp:
+            (JSC::DFG::OSRExit::executeOSRExit):
+            (JSC::DFG::OSRExit::compileExit):
+
 2019-09-23  Alan Coon  <[email protected]>
 
         Cherry-pick r250116. rdar://problem/55608003

Modified: branches/safari-608-branch/Source/_javascript_Core/dfg/DFGOSRExit.cpp (250476 => 250477)


--- branches/safari-608-branch/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2019-09-28 01:20:54 UTC (rev 250476)
+++ branches/safari-608-branch/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2019-09-28 01:20:58 UTC (rev 250477)
@@ -515,13 +515,17 @@
             break;
 
         // Begin extra initilization level: ArrayProfileUpdate
-        ArrayProfile* arrayProfile = exitState.arrayProfile;
-        if (arrayProfile) {
+        if (ArrayProfile* arrayProfile = exitState.arrayProfile) {
             ASSERT(!!exit.m_jsValueSource);
             ASSERT(exit.m_kind == BadCache || exit.m_kind == BadIndexingType);
-            Structure* structure = profiledValue.asCell()->structure(vm);
-            arrayProfile->observeStructure(structure);
-            arrayProfile->observeArrayMode(arrayModesFromStructure(structure));
+            CodeBlock* profiledCodeBlock = baselineCodeBlockForOriginAndBaselineCodeBlock(exit.m_codeOriginForExitProfile, baselineCodeBlock);
+            const Instruction* instruction = profiledCodeBlock->instructions().at(exit.m_codeOriginForExitProfile.bytecodeIndex()).ptr();
+            bool doProfile = !instruction->is<OpGetById>() || instruction->as<OpGetById>().metadata(profiledCodeBlock).m_modeMetadata.mode == GetByIdMode::ArrayLength;
+            if (doProfile) {
+                Structure* structure = profiledValue.asCell()->structure(vm);
+                arrayProfile->observeStructure(structure);
+                arrayProfile->observeArrayMode(arrayModesFromStructure(structure));
+            }
         }
         if (extraInitializationLevel <= ExtraInitializationLevel::ArrayProfileUpdate)
             break;
@@ -1166,7 +1170,15 @@
             // property access, or due to an array profile).
 
             CodeOrigin codeOrigin = exit.m_codeOriginForExitProfile;
-            if (ArrayProfile* arrayProfile = jit.baselineCodeBlockFor(codeOrigin)->getArrayProfile(codeOrigin.bytecodeIndex())) {
+            CodeBlock* codeBlock = jit.baselineCodeBlockFor(codeOrigin);
+            if (ArrayProfile* arrayProfile = codeBlock->getArrayProfile(codeOrigin.bytecodeIndex())) {
+                const Instruction* instruction = codeBlock->instructions().at(codeOrigin.bytecodeIndex()).ptr();
+                CCallHelpers::Jump skipProfile;
+                if (instruction->is<OpGetById>()) {
+                    auto& metadata = instruction->as<OpGetById>().metadata(codeBlock);
+                    skipProfile = jit.branch8(CCallHelpers::NotEqual, CCallHelpers::AbsoluteAddress(&metadata.m_modeMetadata.mode), CCallHelpers::TrustedImm32(static_cast<uint8_t>(GetByIdMode::ArrayLength)));
+                }
+
 #if USE(JSVALUE64)
                 GPRReg usedRegister;
                 if (exit.m_jsValueSource.isAddress())
@@ -1242,6 +1254,9 @@
                     jit.pop(scratch2);
                     jit.pop(scratch1);
                 }
+
+                if (skipProfile.isSet())
+                    skipProfile.link(&jit);
             }
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to