Bug 1335207: Add constexpr to data tables under dom/ for better codegen on Windows. r=ehsan
authorDavid Major <dmajor@mozilla.com>
Wed, 01 Feb 2017 15:42:33 +1300
changeset 331953 1d204b903989e82901423d40b8c713cca6791532
parent 331952 b03c9f4ac1b091b5e8e486715b2ca682e7d6151f
child 331954 76daf697d97ccb21064a08dec8a89d730b44270c
push id31291
push usercbook@mozilla.com
push dateWed, 01 Feb 2017 12:14:40 +0000
treeherdermozilla-central@9e7b1041929f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1335207
milestone54.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 1335207: Add constexpr to data tables under dom/ for better codegen on Windows. r=ehsan MozReview-Commit-ID: 6tEIqjq4Guo
dom/base/DOMException.cpp
dom/base/nsGlobalWindowCommands.cpp
dom/encoding/EncodingUtils.cpp
dom/encoding/FallbackEncoding.cpp
--- a/dom/base/DOMException.cpp
+++ b/dom/base/DOMException.cpp
@@ -77,17 +77,17 @@ enum DOM4ErrorTypeCodeMap {
 
   /* Push API errors */
   NotAllowedError          = 0,
 };
 
 #define DOM4_MSG_DEF(name, message, nsresult) {(nsresult), name, #name, message},
 #define DOM_MSG_DEF(val, message) {(val), NS_ERROR_GET_CODE(val), #val, message},
 
-static const struct ResultStruct
+static constexpr struct ResultStruct
 {
   nsresult mNSResult;
   uint16_t mCode;
   const char* mName;
   const char* mMessage;
 } sDOMErrorMsgMap[] = {
 #include "domerr.msg"
 };
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -264,17 +264,17 @@ IsCaretOnInWindow(nsPIDOMWindowOuter* aW
       if (docShell && docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
         caretOn = false;
       }
     }
   }
   return caretOn;
 }
 
-static const struct BrowseCommand {
+static constexpr struct BrowseCommand {
   const char *reverse, *forward;
   nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
   nsresult (NS_STDCALL nsISelectionController::*move)(bool, bool);
 } browseCommands[] = {
  { sScrollTopString, sScrollBottomString,
    &nsISelectionController::CompleteScroll },
  { sScrollPageUpString, sScrollPageDownString,
    &nsISelectionController::ScrollPage },
--- a/dom/encoding/EncodingUtils.cpp
+++ b/dom/encoding/EncodingUtils.cpp
@@ -10,21 +10,21 @@
 #include "nsUConvPropertySearch.h"
 #include "nsIUnicodeDecoder.h"
 #include "nsIUnicodeEncoder.h"
 #include "nsComponentManagerUtils.h"
 
 namespace mozilla {
 namespace dom {
 
-static const nsUConvProp labelsEncodings[] = {
+static constexpr nsUConvProp labelsEncodings[] = {
 #include "labelsencodings.properties.h"
 };
 
-static const nsUConvProp encodingsGroups[] = {
+static constexpr nsUConvProp encodingsGroups[] = {
 #include "encodingsgroups.properties.h"
 };
 
 bool
 EncodingUtils::FindEncodingForLabel(const nsACString& aLabel,
                                     nsACString& aOutEncoding)
 {
   // Save aLabel first because it may refer the same string as aOutEncoding.
--- a/dom/encoding/FallbackEncoding.cpp
+++ b/dom/encoding/FallbackEncoding.cpp
@@ -10,25 +10,25 @@
 #include "nsUConvPropertySearch.h"
 #include "nsIChromeRegistry.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 
 namespace mozilla {
 namespace dom {
 
-static const nsUConvProp localesFallbacks[] = {
+static constexpr nsUConvProp localesFallbacks[] = {
 #include "localesfallbacks.properties.h"
 };
 
-static const nsUConvProp domainsFallbacks[] = {
+static constexpr nsUConvProp domainsFallbacks[] = {
 #include "domainsfallbacks.properties.h"
 };
 
-static const nsUConvProp nonParticipatingDomains[] = {
+static constexpr nsUConvProp nonParticipatingDomains[] = {
 #include "nonparticipatingdomains.properties.h"
 };
 
 FallbackEncoding* FallbackEncoding::sInstance = nullptr;
 bool FallbackEncoding::sGuessFallbackFromTopLevelDomain = true;
 
 FallbackEncoding::FallbackEncoding()
 {