Title: [276290] trunk/Source/_javascript_Core
Revision
276290
Author
[email protected]
Date
2021-04-20 00:26:08 -0700 (Tue, 20 Apr 2021)

Log Message

[JSC] Use FixedVector for LLIntPrototypeLoadAdaptiveStructureWatchpoint vector
https://bugs.webkit.org/show_bug.cgi?id=224729

Reviewed by Darin Adler.

Replace Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> with FixedVector.

* bytecode/CodeBlock.h:
* bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp:
(JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint):
(JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::initialize):
* bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::setupGetByIdPrototypeCache):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (276289 => 276290)


--- trunk/Source/_javascript_Core/ChangeLog	2021-04-20 07:14:46 UTC (rev 276289)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-20 07:26:08 UTC (rev 276290)
@@ -1,3 +1,20 @@
+2021-04-20  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Use FixedVector for LLIntPrototypeLoadAdaptiveStructureWatchpoint vector
+        https://bugs.webkit.org/show_bug.cgi?id=224729
+
+        Reviewed by Darin Adler.
+
+        Replace Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> with FixedVector.
+
+        * bytecode/CodeBlock.h:
+        * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp:
+        (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint):
+        (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::initialize):
+        * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h:
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::setupGetByIdPrototypeCache):
+
 2021-04-19  Mark Lam  <[email protected]>
 
         Build fix for Debug -O3 after r276162.

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (276289 => 276290)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2021-04-20 07:14:46 UTC (rev 276289)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2021-04-20 07:26:08 UTC (rev 276290)
@@ -669,7 +669,7 @@
         return m_llintExecuteCounter;
     }
 
-    typedef HashMap<std::tuple<StructureID, unsigned>, Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> StructureWatchpointMap;
+    typedef HashMap<std::tuple<StructureID, unsigned>, FixedVector<LLIntPrototypeLoadAdaptiveStructureWatchpoint>> StructureWatchpointMap;
     StructureWatchpointMap& llintGetByIdWatchpointMap() { return m_llintGetByIdWatchpointMap; }
 
     // Functions for controlling when tiered compilation kicks in. This

Modified: trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp (276289 => 276290)


--- trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp	2021-04-20 07:14:46 UTC (rev 276289)
+++ trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp	2021-04-20 07:26:08 UTC (rev 276290)
@@ -42,6 +42,20 @@
     RELEASE_ASSERT(!key.watchingRequiresReplacementWatchpoint());
 }
 
+LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint()
+    : Watchpoint(Watchpoint::Type::LLIntPrototypeLoadAdaptiveStructure)
+    , m_owner(nullptr)
+    , m_bytecodeOffset(0)
+{
+}
+
+void LLIntPrototypeLoadAdaptiveStructureWatchpoint::initialize(CodeBlock* codeBlock, const ObjectPropertyCondition& key, unsigned bytecodeOffset)
+{
+    m_owner = codeBlock;
+    m_bytecodeOffset = bytecodeOffset;
+    m_key = key;
+}
+
 void LLIntPrototypeLoadAdaptiveStructureWatchpoint::install(VM& vm)
 {
     RELEASE_ASSERT(m_key.isWatchable());

Modified: trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h (276289 => 276290)


--- trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h	2021-04-20 07:14:46 UTC (rev 276289)
+++ trunk/Source/_javascript_Core/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h	2021-04-20 07:26:08 UTC (rev 276290)
@@ -36,7 +36,10 @@
 class LLIntPrototypeLoadAdaptiveStructureWatchpoint final : public Watchpoint {
 public:
     LLIntPrototypeLoadAdaptiveStructureWatchpoint(CodeBlock*, const ObjectPropertyCondition&, unsigned bytecodeOffset);
+    LLIntPrototypeLoadAdaptiveStructureWatchpoint();
 
+    void initialize(CodeBlock*, const ObjectPropertyCondition&, unsigned bytecodeOffset);
+
     void install(VM&);
 
     static void clearLLIntGetByIdCache(GetByIdModeMetadata&);

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (276289 => 276290)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-04-20 07:14:46 UTC (rev 276289)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-04-20 07:26:08 UTC (rev 276290)
@@ -723,15 +723,16 @@
     unsigned bytecodeOffset = codeBlock->bytecodeOffset(pc);
     PropertyOffset offset = invalidOffset;
     CodeBlock::StructureWatchpointMap& watchpointMap = codeBlock->llintGetByIdWatchpointMap();
-    Vector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> watchpoints;
-    watchpoints.reserveInitialCapacity(conditions.size());
+    FixedVector<LLIntPrototypeLoadAdaptiveStructureWatchpoint> watchpoints(conditions.size());
+    unsigned index = 0;
     for (ObjectPropertyCondition condition : conditions) {
+        auto& watchpoint = watchpoints[index++];
         if (!condition.isWatchable())
             return;
         if (condition.condition().kind() == PropertyCondition::Presence)
             offset = condition.condition().offset();
-        watchpoints.uncheckedConstructAndAppend(codeBlock, condition, bytecodeOffset);
-        watchpoints.last().install(vm);
+        watchpoint.initialize(codeBlock, condition, bytecodeOffset);
+        watchpoint.install(vm);
     }
 
     ASSERT((offset == invalidOffset) == slot.isUnset());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to