[JSC] Optimize layout of RegExp to reduce padding
https://bugs.webkit.org/show_bug.cgi?id=187438

Reviewed by Mark Lam.

Reduce the size of RegExp from 168 to 144.

* runtime/RegExp.cpp:
(JSC::RegExp::RegExp):
* runtime/RegExp.h:
* runtime/RegExpKey.h:
* yarr/YarrErrorCode.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@233621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/RegExp.cpp b/Source/JavaScriptCore/runtime/RegExp.cpp
index 4f20be0..63a2b51 100644
--- a/Source/JavaScriptCore/runtime/RegExp.cpp
+++ b/Source/JavaScriptCore/runtime/RegExp.cpp
@@ -211,7 +211,6 @@
 
 RegExp::RegExp(VM& vm, const String& patternString, RegExpFlags flags)
     : JSCell(vm, vm.regExpStructure.get())
-    , m_state(NotCompiled)
     , m_patternString(patternString)
     , m_flags(flags)
 {
diff --git a/Source/JavaScriptCore/runtime/RegExp.h b/Source/JavaScriptCore/runtime/RegExp.h
index b6c25ab..60d7ff2 100644
--- a/Source/JavaScriptCore/runtime/RegExp.h
+++ b/Source/JavaScriptCore/runtime/RegExp.h
@@ -132,7 +132,7 @@
 
     static RegExp* createWithoutCaching(VM&, const String&, RegExpFlags);
 
-    enum RegExpState {
+    enum RegExpState : uint8_t {
         ParseError,
         JITCode,
         ByteCode,
@@ -151,13 +151,15 @@
     void matchCompareWithInterpreter(const String&, int startOffset, int* offsetVector, int jitResult);
 #endif
 
-    RegExpState m_state { NotCompiled };
     String m_patternString;
+    RegExpState m_state { NotCompiled };
     RegExpFlags m_flags;
+    ConcurrentJSLock m_lock;
     Yarr::ErrorCode m_constructionErrorCode { Yarr::ErrorCode::NoError };
     unsigned m_numSubpatterns { 0 };
     Vector<String> m_captureGroupNames;
     HashMap<String, unsigned> m_namedGroupToParenIndex;
+    std::unique_ptr<Yarr::BytecodePattern> m_regExpBytecode;
 #if ENABLE(REGEXP_TRACING)
     double m_rtMatchOnlyTotalSubjectStringLen { 0.0 };
     double m_rtMatchTotalSubjectStringLen { 0.0 };
@@ -166,12 +168,10 @@
     unsigned m_rtMatchCallCount { 0 };
     unsigned m_rtMatchFoundCount { 0 };
 #endif
-    ConcurrentJSLock m_lock;
 
 #if ENABLE(YARR_JIT)
     Yarr::YarrCodeBlock m_regExpJITCode;
 #endif
-    std::unique_ptr<Yarr::BytecodePattern> m_regExpBytecode;
 };
 
 } // namespace JSC
diff --git a/Source/JavaScriptCore/runtime/RegExpKey.h b/Source/JavaScriptCore/runtime/RegExpKey.h
index 79b652f..d01e40a 100644
--- a/Source/JavaScriptCore/runtime/RegExpKey.h
+++ b/Source/JavaScriptCore/runtime/RegExpKey.h
@@ -32,7 +32,7 @@
 
 namespace JSC {
 
-enum RegExpFlags {
+enum RegExpFlags : int8_t {
     NoFlags = 0,
     FlagGlobal = 1,
     FlagIgnoreCase = 2,