diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -4,16 +4,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * style rule processor for CSS style sheets, responsible for selector
  * matching and cascading
  */
 
+#if (_M_IX86_FP >= 1) || defined(__SSE__) || defined(_M_AMD64) || defined(__amd64__)
+#include <xmmintrin.h>
+#endif
+
 #include "nsCSSRuleProcessor.h"
 
 #include "nsAutoPtr.h"
 #include "nsRuleProcessorData.h"
 #include <algorithm>
 #include "nsAtom.h"
 #include "PLDHashTable.h"
 #include "mozilla/MemoryReporting.h"
@@ -1551,16 +1555,19 @@ static bool SelectorMatches(Element* aEl
   NS_ASSERTION(aNodeMatchContext.mStateMask.IsEmpty() ||
                !aTreeMatchContext.mForStyling,
                "mForStyling must be false if we're just testing for "
                "state-dependence");
 
   // test for pseudo class match
   for (nsPseudoClassList* pseudoClass = aSelector->mPseudoClassList;
        pseudoClass; pseudoClass = pseudoClass->mNext) {
+#if (_M_IX86_FP >= 1) || defined(__SSE__) || defined(_M_AMD64) || defined(__amd64__)
+    _mm_prefetch((char *)pseudoClass->mNext, _MM_HINT_NTA);
+#endif
     auto idx = static_cast<CSSPseudoClassTypeBase>(pseudoClass->mType);
     EventStates statesToCheck = sPseudoClassStates[idx];
     if (!statesToCheck.IsEmpty()) {
       if (!StateSelectorMatches(aElement, aSelector, aNodeMatchContext,
                                 aTreeMatchContext, aSelectorFlags, aDependence,
                                 statesToCheck)) {
         return false;
       }
@@ -2358,16 +2365,22 @@ nsCSSRuleProcessor::HasStateDependentSty
       if (isPseudoElement) {
         if (selector->PseudoType() != aPseudoType) {
           continue;
         }
         selectorForPseudo = selector;
         selector = selector->mNext;
       }
 
+#if (_M_IX86_FP >= 1) || defined(__SSE__) || defined(_M_AMD64) || defined(__amd64__)
+      if (iter + 1 != end) {
+        _mm_prefetch((char *)(iter + 1)->mSelector, _MM_HINT_NTA);
+      }
+#endif
+
       nsRestyleHint possibleChange = RestyleHintForOp(selector->mOperator);
       SelectorMatchesFlags selectorFlags = SelectorMatchesFlags::UNKNOWN;
 
       // If hint already includes all the bits of possibleChange,
       // don't bother calling SelectorMatches, since even if it returns false
       // hint won't change.
       // Also don't bother calling SelectorMatches if none of the
       // states passed in are relevant here.
