Title: [179621] trunk/Source/_javascript_Core
Revision
179621
Author
[email protected]
Date
2015-02-04 12:03:52 -0800 (Wed, 04 Feb 2015)

Log Message

TypeSet can use 1 byte instead of 4 bytes for its m_seenTypes member variable
https://bugs.webkit.org/show_bug.cgi?id=141204

Reviewed by Darin Adler.

There is no need to use 32 bits to store a TypeSet::RuntimeType set 
bit-vector when the largest value for a single TypeSet::RuntimeType 
is 0x80. 8 bits is enough to represent the set of seen types.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* runtime/TypeSet.cpp:
(JSC::TypeSet::doesTypeConformTo):
* runtime/TypeSet.h:
(JSC::TypeSet::seenTypes):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179620 => 179621)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-04 19:41:45 UTC (rev 179620)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-04 20:03:52 UTC (rev 179621)
@@ -1,3 +1,21 @@
+2015-02-04  Saam Barati  <[email protected]>
+
+        TypeSet can use 1 byte instead of 4 bytes for its m_seenTypes member variable
+        https://bugs.webkit.org/show_bug.cgi?id=141204
+
+        Reviewed by Darin Adler.
+
+        There is no need to use 32 bits to store a TypeSet::RuntimeType set 
+        bit-vector when the largest value for a single TypeSet::RuntimeType 
+        is 0x80. 8 bits is enough to represent the set of seen types.
+
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+        * runtime/TypeSet.cpp:
+        (JSC::TypeSet::doesTypeConformTo):
+        * runtime/TypeSet.h:
+        (JSC::TypeSet::seenTypes):
+
 2015-02-04  Mark Lam  <[email protected]>
 
         Remove concept of makeUsableFromMultipleThreads().

Modified: trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (179620 => 179621)


--- trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2015-02-04 19:41:45 UTC (rev 179620)
+++ trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2015-02-04 20:03:52 UTC (rev 179621)
@@ -1143,7 +1143,7 @@
             // (The other direction does not hold in general).
 
             RefPtr<TypeSet> typeSet = node->typeLocation()->m_instructionTypeSet;
-            uint32_t seenTypes = typeSet->seenTypes();
+            uint8_t seenTypes = typeSet->seenTypes();
             if (typeSet->doesTypeConformTo(TypeMachineInt)) {
                 node->convertToCheck();
                 if (node->child1()->shouldSpeculateInt32())

Modified: trunk/Source/_javascript_Core/runtime/TypeSet.cpp (179620 => 179621)


--- trunk/Source/_javascript_Core/runtime/TypeSet.cpp	2015-02-04 19:41:45 UTC (rev 179620)
+++ trunk/Source/_javascript_Core/runtime/TypeSet.cpp	2015-02-04 20:03:52 UTC (rev 179621)
@@ -157,7 +157,7 @@
     return seen.toString();
 }
 
-bool TypeSet::doesTypeConformTo(uint32_t test) const
+bool TypeSet::doesTypeConformTo(uint8_t test) const
 {
     // This function checks if our seen types conform  to the types described by the test bitstring. (i.e we haven't seen more types than test).
     // We are <= to those types if ANDing with the bitstring doesn't zero out any of our bits.

Modified: trunk/Source/_javascript_Core/runtime/TypeSet.h (179620 => 179621)


--- trunk/Source/_javascript_Core/runtime/TypeSet.h	2015-02-04 19:41:45 UTC (rev 179620)
+++ trunk/Source/_javascript_Core/runtime/TypeSet.h	2015-02-04 20:03:52 UTC (rev 179621)
@@ -48,7 +48,7 @@
 
 class JSValue;
 
-enum RuntimeType {
+enum RuntimeType : uint8_t {
     TypeNothing            = 0x0,
     TypeFunction           = 0x1,
     TypeUndefined          = 0x2,
@@ -108,12 +108,12 @@
     String leastCommonAncestor() const;
     Ref<Inspector::Protocol::Runtime::TypeSet> inspectorTypeSet() const;
     bool isEmpty() const { return m_seenTypes == TypeNothing; }
-    bool doesTypeConformTo(uint32_t test) const;
-    uint32_t seenTypes() const { return m_seenTypes; }
+    bool doesTypeConformTo(uint8_t test) const;
+    uint8_t seenTypes() const { return m_seenTypes; }
     StructureSet structureSet() const { return m_structureSet; };
 
 private:
-    uint32_t m_seenTypes;
+    uint8_t m_seenTypes;
     bool m_isOverflown;
     Vector<RefPtr<StructureShape>> m_structureHistory;
     StructureSet m_structureSet;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to