Bug 1466449 - Update Tokenizer.java and StackNode.java to initialize properties. r=andi
☠☠ backed out by d088f3b8a805 ☠ ☠
authorJonathan Kingston <jkt@mozilla.com>
Mon, 22 Oct 2018 11:34:58 +0100
changeset 442525 cb24d2d42554fb0f0f01ee5de3187d19e9985de4
parent 442524 5566199eda709907ccdf172aaa7f51d439a44ebc
child 442526 f5973de3f6e8d55dfd22fe60df34d8f96c3c13e0
child 442530 cc803b2429d86587fbe6c29fed2e2bfb51f9422e
push id109182
push userebalazs@mozilla.com
push dateTue, 23 Oct 2018 13:02:08 +0000
treeherdermozilla-inbound@cb24d2d42554 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersandi
bugs1466449
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466449 - Update Tokenizer.java and StackNode.java to initialize properties. r=andi
parser/html/javasrc/StackNode.java
parser/html/javasrc/Tokenizer.java
parser/html/nsHtml5Tokenizer.cpp
--- a/parser/html/javasrc/StackNode.java
+++ b/parser/html/javasrc/StackNode.java
@@ -92,17 +92,24 @@ final class StackNode<T> {
     public boolean isOptionalEndTag() {
         return (flags & ElementName.OPTIONAL_END_TAG) != 0;
     }
 
     // ]NOCPP]
 
     StackNode(int idxInTreeBuilder) {
         this.idxInTreeBuilder = idxInTreeBuilder;
+        this.flags = 0;
+        this.name = null;
+        this.popName = null;
+        this.ns = 0;
+        this.node = null;
+        this.attributes = null;
         this.refcount = 0;
+        this.htmlCreator = null;
     }
 
     // CPPONLY: public @HtmlCreator Object getHtmlCreator() {
     // CPPONLY:     return htmlCreator;
     // CPPONLY: }
 
     /**
      * Setter for copying. This doesn't take another <code>StackNode</code>
--- a/parser/html/javasrc/Tokenizer.java
+++ b/parser/html/javasrc/Tokenizer.java
@@ -522,31 +522,56 @@ public class Tokenizer implements Locato
 
     // [NOCPP[
 
     protected LocatorImpl ampersandLocation;
 
     public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
         this.tokenHandler = tokenHandler;
         this.encodingDeclarationHandler = null;
+        this.lastCR = false;
+        this.stateSave = 0;
+        this.returnStateSave = 0;
+        this.index = 0;
+        this.forceQuirks = false;
+        this.additional = '\u0000';
+        this.entCol = 0;
+        this.firstCharKey = 0;
+        this.lo = 0;
+        this.hi = 0;
+        this.candidate = 0;
+        this.charRefBufMark = 0;
+        this.value = 0;
+        this.seenDigits = false;
+        this.cstart = 0;
+        this.strBufLen = 0;
         this.newAttributesEachTime = newAttributesEachTime;
         // &CounterClockwiseContourIntegral; is the longest valid char ref and
         // the semicolon never gets appended to the buffer.
         this.charRefBuf = new char[32];
+        this.charRefBufLen = 0;
         this.bmpChar = new char[1];
         this.astralChar = new char[2];
+        this.endTagExpectation = null;
+        this.endTagExpectationAsArray = new char[0];
+        this.endTag = false;
         this.containsHyphen = false;
         this.tagName = null;
         this.nonInternedTagName = new ElementName();
         this.attributeName = null;
         // CPPONLY: this.nonInternedAttributeName = new AttributeName();
         this.doctypeName = null;
         this.publicIdentifier = null;
         this.systemIdentifier = null;
         this.attributes = null;
+        this.shouldSuspend = false;
+        this.confident = false;
+        this.line = 0;
+        this.attributeLine = 0;
+        this.interner = null;
     }
 
     // ]NOCPP]
 
     /**
      * The constructor.
      *
      * @param tokenHandler
@@ -555,34 +580,59 @@ public class Tokenizer implements Locato
     public Tokenizer(TokenHandler tokenHandler
     // CPPONLY: , boolean viewingXmlSource
     ) {
         this.tokenHandler = tokenHandler;
         this.encodingDeclarationHandler = null;
         // [NOCPP[
         this.newAttributesEachTime = false;
         // ]NOCPP]
+        this.lastCR = false;
+        this.stateSave = 0;
+        this.returnStateSave = 0;
+        this.index = 0;
+        this.forceQuirks = false;
+        this.additional = '\u0000';
+        this.entCol = 0;
+        this.firstCharKey = 0;
+        this.lo = 0;
+        this.hi = 0;
+        this.candidate = 0;
+        this.charRefBufMark = 0;
+        this.value = 0;
+        this.seenDigits = false;
+        this.cstart = 0;
+        this.strBufLen = 0;
         // &CounterClockwiseContourIntegral; is the longest valid char ref and
         // the semicolon never gets appended to the buffer.
         this.charRefBuf = new char[32];
+        this.charRefBufLen = 0;
         this.bmpChar = new char[1];
         this.astralChar = new char[2];
+        this.endTagExpectation = null;
+        this.endTagExpectationAsArray = new char[0];
+        this.endTag = false;
         this.containsHyphen = false;
         this.tagName = null;
         this.nonInternedTagName = new ElementName();
         this.attributeName = null;
         // CPPONLY: this.nonInternedAttributeName = new AttributeName();
         this.doctypeName = null;
         this.publicIdentifier = null;
         this.systemIdentifier = null;
         // [NOCPP[
         this.attributes = null;
         // ]NOCPP]
         // CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null;
         // CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder();
+        this.shouldSuspend = false;
+        this.confident = false;
+        this.line = 0;
+        this.attributeLine = 0;
+        this.interner = null;
         // CPPONLY: this.viewingXmlSource = viewingXmlSource;
     }
 
     public void setInterner(Interner interner) {
         this.interner = interner;
     }
 
     public void initLocation(String newPublicId, String newSystemId) {
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -126,33 +126,33 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtm
                                    bool viewingXmlSource)
   : tokenHandler(tokenHandler)
   , encodingDeclarationHandler(nullptr)
   , lastCR(false)
   , stateSave(0)
   , returnStateSave(0)
   , index(0)
   , forceQuirks(false)
-  , additional(u'\0')
+  , additional('\0')
   , entCol(0)
   , firstCharKey(0)
   , lo(0)
   , hi(0)
   , candidate(0)
   , charRefBufMark(0)
   , value(0)
   , seenDigits(false)
   , cstart(0)
   , strBufLen(0)
   , charRefBuf(jArray<char16_t, int32_t>::newJArray(32))
   , charRefBufLen(0)
   , bmpChar(jArray<char16_t, int32_t>::newJArray(1))
   , astralChar(jArray<char16_t, int32_t>::newJArray(2))
   , endTagExpectation(nullptr)
-  , endTagExpectationAsArray{}
+  , endTagExpectationAsArray(jArray<char16_t, int32_t>::newJArray(0))
   , endTag(false)
   , containsHyphen(false)
   , tagName(nullptr)
   , nonInternedTagName(new nsHtml5ElementName())
   , attributeName(nullptr)
   , nonInternedAttributeName(new nsHtml5AttributeName())
   , doctypeName(nullptr)
   , publicIdentifier(nullptr)