From 41e477e2ce2d00a793adc6f8ba85540e02275e5f Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 18 Jan 2020 16:30:42 -0500 Subject: Bug 1358037 - Inline the methods of nsHtml5ElementName and nsHtml5AttributeName. Tag UXP Issue #1344 --- .../src/nu/validator/htmlparser/impl/AttributeName.java | 8 ++++---- .../src/nu/validator/htmlparser/impl/ElementName.java | 17 ++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'parser/html/java/htmlparser/src/nu/validator') diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java index 24f89ddb0..667e8eb93 100644 --- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java +++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/AttributeName.java @@ -272,7 +272,7 @@ public final class AttributeName * whether to check ncnameness * @return an AttributeName corresponding to the argument data */ - static AttributeName nameByBuffer(@NoLength char[] buf, int offset, + @Inline static AttributeName nameByBuffer(@NoLength char[] buf, int offset, int length , Interner interner) { // XXX deal with offset @@ -282,7 +282,7 @@ public final class AttributeName return null; } AttributeName attributeName = AttributeName.ATTRIBUTE_NAMES[index]; - @Local String name = attributeName.getLocal(AttributeName.HTML); + @Local String name = attributeName.getLocal(0); if (!Portability.localEqualsBuffer(name, buf, offset, length)) { return null; } @@ -418,11 +418,11 @@ public final class AttributeName // CPPONLY: this.custom = true; // CPPONLY: } // CPPONLY: - // CPPONLY: public boolean isInterned() { + // CPPONLY: @Inline public boolean isInterned() { // CPPONLY: return !custom; // CPPONLY: } // CPPONLY: - // CPPONLY: public void setNameForNonInterned(@Local String name) { + // CPPONLY: @Inline public void setNameForNonInterned(@Local String name) { // CPPONLY: assert custom; // CPPONLY: local[0] = name; // CPPONLY: local[1] = name; diff --git a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java index e961c4397..cc363acde 100644 --- a/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java +++ b/parser/html/java/htmlparser/src/nu/validator/htmlparser/impl/ElementName.java @@ -107,15 +107,15 @@ public final class ElementName return flags; } - public int getGroup() { - return flags & GROUP_MASK; + @Inline public int getGroup() { + return flags & ElementName.GROUP_MASK; } - public boolean isInterned() { - return (flags & NOT_INTERNED) == 0; + @Inline public boolean isInterned() { + return (flags & ElementName.NOT_INTERNED) == 0; } - static ElementName elementNameByBuffer(@NoLength char[] buf, int offset, int length, Interner interner) { + @Inline static ElementName elementNameByBuffer(@NoLength char[] buf, int offset, int length, Interner interner) { @Unsigned int hash = ElementName.bufToHash(buf, length); int index = Arrays.binarySearch(ElementName.ELEMENT_HASHES, hash); if (index < 0) { @@ -184,12 +184,15 @@ public final class ElementName // The translator adds refcount debug code here. } - public void setNameForNonInterned(@Local String name) { + @Inline public void setNameForNonInterned(@Local String name) { // No need to worry about refcounting the local name, because in the // C++ case the scoped atom table remembers its own atoms. this.name = name; this.camelCaseName = name; - assert this.flags == (TreeBuilder.OTHER | NOT_INTERNED); + // The assertion below relies on TreeBuilder.OTHER being zero! + // TreeBuilder.OTHER isn't referenced here, because it would create + // a circular C++ header dependency given that this method is inlined. + assert this.flags == ElementName.NOT_INTERNED; } // CPPONLY: public static final ElementName ISINDEX = new ElementName("isindex", "isindex", TreeBuilder.ISINDEX | SPECIAL); -- cgit v1.2.3