Changeset 244286 in webkit
- Timestamp:
- Apr 15, 2019 1:39:11 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r244285 r244286 1 2019-04-15 Robin Morisset <rmorisset@apple.com> 2 3 Several structures and enums in the Yarr interpreter can be shrunk 4 https://bugs.webkit.org/show_bug.cgi?id=196923 5 6 Reviewed by Saam Barati. 7 8 YarrOp: 88 -> 80 9 RegularExpression: 40 -> 32 10 ByteTerm: 56 -> 48 11 PatternTerm: 56 -> 48 12 13 * yarr/RegularExpression.cpp: 14 * yarr/YarrInterpreter.h: 15 * yarr/YarrJIT.cpp: 16 (JSC::Yarr::YarrGenerator::YarrOp::YarrOp): 17 * yarr/YarrParser.h: 18 * yarr/YarrPattern.h: 19 1 20 2019-04-15 Devin Rousso <drousso@apple.com> 2 21 -
trunk/Source/JavaScriptCore/yarr/RegularExpression.cpp
r242699 r244286 44 44 } 45 45 46 int lastMatchLength { -1 };47 48 unsigned m_numSubpatterns;49 std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;50 51 46 private: 52 47 Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode) … … 79 74 } 80 75 76 JSC::Yarr::ErrorCode m_constructionErrorCode { Yarr::ErrorCode::NoError }; 81 77 BumpPointerAllocator m_regexAllocator; 82 JSC::Yarr::ErrorCode m_constructionErrorCode { Yarr::ErrorCode::NoError }; 78 79 public: 80 int lastMatchLength { -1 }; 81 unsigned m_numSubpatterns; 82 std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode; 83 83 }; 84 84 -
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h
r242699 r244286 40 40 41 41 struct ByteTerm { 42 enum Type { 42 union { 43 struct { 44 union { 45 UChar32 patternCharacter; 46 struct { 47 UChar32 lo; 48 UChar32 hi; 49 } casedCharacter; 50 CharacterClass* characterClass; 51 unsigned subpatternId; 52 }; 53 union { 54 ByteDisjunction* parenthesesDisjunction; 55 unsigned parenthesesWidth; 56 }; 57 QuantifierType quantityType; 58 unsigned quantityMinCount; 59 unsigned quantityMaxCount; 60 } atom; 61 struct { 62 int next; 63 int end; 64 bool onceThrough; 65 } alternative; 66 struct { 67 bool m_bol : 1; 68 bool m_eol : 1; 69 } anchors; 70 unsigned checkInputCount; 71 }; 72 unsigned frameLocation; 73 enum Type : uint8_t { 43 74 TypeBodyAlternativeBegin, 44 75 TypeBodyAlternativeDisjunction, … … 73 104 TypeDotStarEnclosure, 74 105 } type; 75 union {76 struct {77 union {78 UChar32 patternCharacter;79 struct {80 UChar32 lo;81 UChar32 hi;82 } casedCharacter;83 CharacterClass* characterClass;84 unsigned subpatternId;85 };86 union {87 ByteDisjunction* parenthesesDisjunction;88 unsigned parenthesesWidth;89 };90 QuantifierType quantityType;91 unsigned quantityMinCount;92 unsigned quantityMaxCount;93 } atom;94 struct {95 int next;96 int end;97 bool onceThrough;98 } alternative;99 struct {100 bool m_bol : 1;101 bool m_eol : 1;102 } anchors;103 unsigned checkInputCount;104 };105 unsigned frameLocation;106 106 bool m_capture : 1; 107 107 bool m_invert : 1; … … 378 378 OptionSet<Flags> m_flags; 379 379 // Each BytecodePattern is associated with a RegExp, each RegExp is associated 380 // with a VM. Cache a pointer to ou tVM's m_regExpAllocator.380 // with a VM. Cache a pointer to our VM's m_regExpAllocator. 381 381 BumpPointerAllocator* m_allocator; 382 382 ConcurrentJSLock* m_lock; -
trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp
r243967 r244286 771 771 } 772 772 773 enum YarrOpCode {773 enum YarrOpCode : uint8_t { 774 774 // These nodes wrap body alternatives - those in the main disjunction, 775 775 // rather than subpatterns or assertions. These are chained together in … … 817 817 struct YarrOp { 818 818 explicit YarrOp(PatternTerm* term) 819 : m_ op(OpTerm)820 , m_ term(term)819 : m_term(term) 820 , m_op(OpTerm) 821 821 , m_isDeadCode(false) 822 822 { … … 828 828 { 829 829 } 830 831 // The operation, as a YarrOpCode, and also a reference to the PatternTerm.832 YarrOpCode m_op;833 PatternTerm* m_term;834 830 835 831 // For alternatives, this holds the PatternAlternative and doubly linked … … 841 837 size_t m_previousOp; 842 838 size_t m_nextOp; 839 840 // The operation, as a YarrOpCode, and also a reference to the PatternTerm. 841 PatternTerm* m_term; 842 YarrOpCode m_op; 843 843 844 844 // Used to record a set of Jumps out of the generated code, typically -
trunk/Source/JavaScriptCore/yarr/YarrParser.h
r239427 r244286 586 586 * parseCharacterClass(): 587 587 * 588 * Helper for parseTokens(); calls dir ctly and indirectly (via parseCharacterClassEscape)588 * Helper for parseTokens(); calls directly and indirectly (via parseCharacterClassEscape) 589 589 * to an instance of CharacterClassParserDelegate, to describe the character class to the 590 590 * delegate. -
trunk/Source/JavaScriptCore/yarr/YarrPattern.h
r243642 r244286 123 123 }; 124 124 125 enum QuantifierType {125 enum QuantifierType : uint8_t { 126 126 QuantifierFixedCount, 127 127 QuantifierGreedy, … … 130 130 131 131 struct PatternTerm { 132 enum Type {132 enum Type : uint8_t { 133 133 TypeAssertionBOL, 134 134 TypeAssertionEOL, … … 144 144 bool m_capture :1; 145 145 bool m_invert :1; 146 QuantifierType quantityType; 147 Checked<unsigned> quantityMinCount; 148 Checked<unsigned> quantityMaxCount; 146 149 union { 147 150 UChar32 patternCharacter; … … 160 163 } anchors; 161 164 }; 162 QuantifierType quantityType;163 Checked<unsigned> quantityMinCount;164 Checked<unsigned> quantityMaxCount;165 165 unsigned inputPosition; 166 166 unsigned frameLocation;
Note: See TracChangeset
for help on using the changeset viewer.