Title: [238778] trunk/Source/_javascript_Core
Revision
238778
Author
[email protected]
Date
2018-12-01 00:38:53 -0800 (Sat, 01 Dec 2018)

Log Message

[JSC] Keep TypeMaybeBigInt small
https://bugs.webkit.org/show_bug.cgi?id=192203

Reviewed by Saam Barati.

As BigInt is being implemented, more and more bytecodes start returning BigInt.
It means that ResultType of these bytecodes include TypeMaybeBigInt. However,
TypeMaybeBigInt was large number 0x20, leading to wide instruction since ResultType
easily becomes larger than 32 (e.g. TypeInt32 | TypeMaybeBigInt == 33).

This patch sorts the numbers of TypeMaybeXXX based on the frequency of appearance in
the code.

* parser/ResultType.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (238777 => 238778)


--- trunk/Source/_javascript_Core/ChangeLog	2018-12-01 06:17:55 UTC (rev 238777)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-12-01 08:38:53 UTC (rev 238778)
@@ -1,3 +1,20 @@
+2018-11-29  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Keep TypeMaybeBigInt small
+        https://bugs.webkit.org/show_bug.cgi?id=192203
+
+        Reviewed by Saam Barati.
+
+        As BigInt is being implemented, more and more bytecodes start returning BigInt.
+        It means that ResultType of these bytecodes include TypeMaybeBigInt. However,
+        TypeMaybeBigInt was large number 0x20, leading to wide instruction since ResultType
+        easily becomes larger than 32 (e.g. TypeInt32 | TypeMaybeBigInt == 33).
+
+        This patch sorts the numbers of TypeMaybeXXX based on the frequency of appearance in
+        the code.
+
+        * parser/ResultType.h:
+
 2018-11-30  Dean Jackson  <[email protected]>
 
         Try to fix Windows build by using strcmp instead of strcasecmp.

Modified: trunk/Source/_javascript_Core/parser/ResultType.h (238777 => 238778)


--- trunk/Source/_javascript_Core/parser/ResultType.h	2018-12-01 06:17:55 UTC (rev 238777)
+++ trunk/Source/_javascript_Core/parser/ResultType.h	2018-12-01 08:38:53 UTC (rev 238778)
@@ -32,15 +32,15 @@
         friend struct OperandTypes;
 
         using Type = uint8_t;
-        static constexpr Type TypeInt32 = 1;
-        static constexpr Type TypeMaybeNumber = 0x02;
-        static constexpr Type TypeMaybeString = 0x04;
-        static constexpr Type TypeMaybeNull   = 0x08;
-        static constexpr Type TypeMaybeBool   = 0x10;
-        static constexpr Type TypeMaybeBigInt = 0x20;
-        static constexpr Type TypeMaybeOther  = 0x40;
+        static constexpr Type TypeInt32       = 0x1 << 0;
+        static constexpr Type TypeMaybeNumber = 0x1 << 1;
+        static constexpr Type TypeMaybeString = 0x1 << 2;
+        static constexpr Type TypeMaybeBigInt = 0x1 << 3;
+        static constexpr Type TypeMaybeNull   = 0x1 << 4;
+        static constexpr Type TypeMaybeBool   = 0x1 << 5;
+        static constexpr Type TypeMaybeOther  = 0x1 << 6;
 
-        static constexpr Type TypeBits = TypeMaybeNumber | TypeMaybeString | TypeMaybeNull | TypeMaybeBool | TypeMaybeBigInt | TypeMaybeOther;
+        static constexpr Type TypeBits = TypeMaybeNumber | TypeMaybeString | TypeMaybeBigInt | TypeMaybeNull | TypeMaybeBool | TypeMaybeOther;
 
     public:
         static constexpr int numBitsNeeded = 7;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to