Title: [148259] trunk/Source/_javascript_Core
Revision
148259
Author
[email protected]
Date
2013-04-11 20:42:46 -0700 (Thu, 11 Apr 2013)

Log Message

Merge CharacterClassTable into CharacterClass
https://bugs.webkit.org/show_bug.cgi?id=114409

Patch by Benjamin Poulain <[email protected]> on 2013-04-11
Reviewed by Darin Adler.

CharacterClassTable is only a pointer and a boolean.
It is a little overkill to make a separate allocation
for that.

* create_regex_tables:
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::matchCharacterClass):
* yarr/YarrPattern.cpp:
(JSC::Yarr::CharacterClassConstructor::charClass):
* yarr/YarrPattern.h:
(CharacterClass):
(JSC::Yarr::CharacterClass::CharacterClass):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (148258 => 148259)


--- trunk/Source/_javascript_Core/ChangeLog	2013-04-12 02:38:32 UTC (rev 148258)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-04-12 03:42:46 UTC (rev 148259)
@@ -1,3 +1,23 @@
+2013-04-11  Benjamin Poulain  <[email protected]>
+
+        Merge CharacterClassTable into CharacterClass
+        https://bugs.webkit.org/show_bug.cgi?id=114409
+
+        Reviewed by Darin Adler.
+
+        CharacterClassTable is only a pointer and a boolean.
+        It is a little overkill to make a separate allocation
+        for that.
+
+        * create_regex_tables:
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::matchCharacterClass):
+        * yarr/YarrPattern.cpp:
+        (JSC::Yarr::CharacterClassConstructor::charClass):
+        * yarr/YarrPattern.h:
+        (CharacterClass):
+        (JSC::Yarr::CharacterClass::CharacterClass):
+
 2013-04-11  Michael Saboff  <[email protected]>
 
         Added UNLIKELY() suggested in https://bugs.webkit.org/show_bug.cgi?id=114366

Modified: trunk/Source/_javascript_Core/create_regex_tables (148258 => 148259)


--- trunk/Source/_javascript_Core/create_regex_tables	2013-04-12 02:38:32 UTC (rev 148258)
+++ trunk/Source/_javascript_Core/create_regex_tables	2013-04-12 03:42:46 UTC (rev 148259)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Apple Inc. All rights reserved.
+# Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -90,11 +90,11 @@
     function += ("{\n")
     if emitTables and classes["UseTable"]:
         if "Inverse" in classes:
-            function += ("    CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, true));\n" % (classes["Inverse"]))
+            function += ("    CharacterClass* characterClass = new CharacterClass(_%sData, true);\n" % (classes["Inverse"]))
         else:
-            function += ("    CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, false));\n" % (name))
+            function += ("    CharacterClass* characterClass = new CharacterClass(_%sData, false);\n" % (name))
     else:
-        function += ("    CharacterClass* characterClass = new CharacterClass(0);\n")
+        function += ("    CharacterClass* characterClass = new CharacterClass;\n")
     for (min, max) in ranges:
         if (min == max):
             if (min > 127):

Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.cpp (148258 => 148259)


--- trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2013-04-12 02:38:32 UTC (rev 148258)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.cpp	2013-04-12 03:42:46 UTC (rev 148259)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -179,8 +179,8 @@
     void matchCharacterClass(RegisterID character, JumpList& matchDest, const CharacterClass* charClass)
     {
         if (charClass->m_table) {
-            ExtendedAddress tableEntry(character, reinterpret_cast<intptr_t>(charClass->m_table->m_table));
-            matchDest.append(branchTest8(charClass->m_table->m_inverted ? Zero : NonZero, tableEntry));
+            ExtendedAddress tableEntry(character, reinterpret_cast<intptr_t>(charClass->m_table));
+            matchDest.append(branchTest8(charClass->m_tableInverted ? Zero : NonZero, tableEntry));
             return;
         }
         Jump unicodeFail;

Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.cpp (148258 => 148259)


--- trunk/Source/_javascript_Core/yarr/YarrPattern.cpp	2013-04-12 02:38:32 UTC (rev 148258)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.cpp	2013-04-12 03:42:46 UTC (rev 148259)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Peter Varga ([email protected]), University of Szeged
  *
  * Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,7 @@
 
     PassOwnPtr<CharacterClass> charClass()
     {
-        OwnPtr<CharacterClass> characterClass = adoptPtr(new CharacterClass(0));
+        OwnPtr<CharacterClass> characterClass = adoptPtr(new CharacterClass);
 
         characterClass->m_matches.swap(m_matches);
         characterClass->m_ranges.swap(m_ranges);

Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.h (148258 => 148259)


--- trunk/Source/_javascript_Core/yarr/YarrPattern.h	2013-04-12 02:38:32 UTC (rev 148258)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.h	2013-04-12 03:42:46 UTC (rev 148259)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2013 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Peter Varga ([email protected]), University of Szeged
  *
  * Redistribution and use in source and binary forms, with or without
@@ -50,37 +50,28 @@
     }
 };
 
-struct CharacterClassTable : RefCounted<CharacterClassTable> {
-    const char* m_table;
-    bool m_inverted;
-    static PassRefPtr<CharacterClassTable> create(const char* table, bool inverted)
-    {
-        return adoptRef(new CharacterClassTable(table, inverted));
-    }
-
-private:
-    CharacterClassTable(const char* table, bool inverted)
-        : m_table(table)
-        , m_inverted(inverted)
-    {
-    }
-};
-
 struct CharacterClass {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     // All CharacterClass instances have to have the full set of matches and ranges,
-    // they may have an optional table for faster lookups (which must match the
+    // they may have an optional m_table for faster lookups (which must match the
     // specified matches and ranges)
-    CharacterClass(PassRefPtr<CharacterClassTable> table)
+    CharacterClass()
+        : m_table(0)
+    {
+    }
+    CharacterClass(const char* table, bool inverted)
         : m_table(table)
+        , m_tableInverted(inverted)
     {
     }
     Vector<UChar> m_matches;
     Vector<CharacterRange> m_ranges;
     Vector<UChar> m_matchesUnicode;
     Vector<CharacterRange> m_rangesUnicode;
-    RefPtr<CharacterClassTable> m_table;
+
+    const char* m_table;
+    bool m_tableInverted;
 };
 
 enum QuantifierType {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to