Title: [255449] trunk/Source/_javascript_Core
Revision
255449
Author
[email protected]
Date
2020-01-30 13:00:05 -0800 (Thu, 30 Jan 2020)

Log Message

[JSC] Make SourceProviderCacheItem small
https://bugs.webkit.org/show_bug.cgi?id=206987

Reviewed by Mark Lam.

We know this becomes very large when parsing a large script, and it is noticeable in some of RAMification tests.
We should use PackedPtr to shrink size of SourceProviderCacheItem.

* parser/Parser.h:
(JSC::Scope::restoreFromSourceProviderCache):
* parser/SourceProviderCacheItem.h:
(JSC::SourceProviderCacheItem::usedVariables const):
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (255448 => 255449)


--- trunk/Source/_javascript_Core/ChangeLog	2020-01-30 20:59:52 UTC (rev 255448)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-01-30 21:00:05 UTC (rev 255449)
@@ -1,3 +1,19 @@
+2020-01-30  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make SourceProviderCacheItem small
+        https://bugs.webkit.org/show_bug.cgi?id=206987
+
+        Reviewed by Mark Lam.
+
+        We know this becomes very large when parsing a large script, and it is noticeable in some of RAMification tests.
+        We should use PackedPtr to shrink size of SourceProviderCacheItem.
+
+        * parser/Parser.h:
+        (JSC::Scope::restoreFromSourceProviderCache):
+        * parser/SourceProviderCacheItem.h:
+        (JSC::SourceProviderCacheItem::usedVariables const):
+        (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
+
 2020-01-30  Keith Miller  <[email protected]>
 
         Parser needs to restore unary stack state when backtracking

Modified: trunk/Source/_javascript_Core/parser/Parser.h (255448 => 255449)


--- trunk/Source/_javascript_Core/parser/Parser.h	2020-01-30 20:59:52 UTC (rev 255448)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2020-01-30 21:00:05 UTC (rev 255449)
@@ -724,7 +724,7 @@
         m_needsSuperBinding = info->needsSuperBinding;
         UniquedStringImplPtrSet& destSet = m_usedVariables.last();
         for (unsigned i = 0; i < info->usedVariablesCount; ++i)
-            destSet.add(info->usedVariables()[i]);
+            destSet.add(info->usedVariables()[i].get());
     }
 
     class MaybeParseAsGeneratorForScope;

Modified: trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h (255448 => 255449)


--- trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h	2020-01-30 20:59:52 UTC (rev 255448)
+++ trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h	2020-01-30 21:00:05 UTC (rev 255449)
@@ -95,12 +95,12 @@
     unsigned innerArrowFunctionFeatures : 6; // InnerArrowFunctionCodeFeatures
     unsigned constructorKind : 2; // ConstructorKind
 
-    UniquedStringImpl** usedVariables() const { return const_cast<UniquedStringImpl**>(m_variables); }
+    PackedPtr<UniquedStringImpl>* usedVariables() const { return const_cast<PackedPtr<UniquedStringImpl>*>(m_variables); }
 
 private:
     SourceProviderCacheItem(const SourceProviderCacheItemCreationParameters&);
 
-    UniquedStringImpl* m_variables[0];
+    PackedPtr<UniquedStringImpl> m_variables[0];
 };
 
 inline SourceProviderCacheItem::~SourceProviderCacheItem()
@@ -140,8 +140,9 @@
     ASSERT(constructorKind == static_cast<unsigned>(parameters.constructorKind));
     ASSERT(expectedSuperBinding == static_cast<unsigned>(parameters.expectedSuperBinding));
     for (unsigned i = 0; i < usedVariablesCount; ++i) {
-        m_variables[i] = parameters.usedVariables[i];
-        m_variables[i]->ref();
+        auto* pointer = parameters.usedVariables[i];
+        pointer->ref();
+        m_variables[i] = pointer;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to