Backed out changeset a6fa096f9853 and ec1c41143ff6 (bug 1147766) since I messed up the warning fix.
authorCameron McCormack <cam@mcc.id.au>
Sat, 23 May 2015 15:51:14 +1000
changeset 264913 4ac52fce1beb0a3f3fd5f1c85e16e0ffbe909e6e
parent 264912 ec1c41143ff63c9f9f144664079fed63b3063346
child 264914 0100fb165a6ccca2afed2dbb88996a83bd73cd01
push id8157
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:36:23 +0000
treeherdermozilla-aurora@d480e05bd276 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1147766
milestone41.0a1
backs outa6fa096f98530c99d636cb849f1d5aa7adccd993
Backed out changeset a6fa096f9853 and ec1c41143ff6 (bug 1147766) since I messed up the warning fix.
layout/style/nsRuleNode.h
mfbt/RangedArray.h
mfbt/moz.build
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -6,35 +6,52 @@
 /*
  * a node in the lexicographic tree of rules that match an element,
  * responsible for converting the rules' information into computed style
  */
 
 #ifndef nsRuleNode_h___
 #define nsRuleNode_h___
 
-#include "mozilla/RangedArray.h"
 #include "nsPresContext.h"
 #include "nsStyleStruct.h"
 
 class nsStyleContext;
 struct nsRuleData;
 class nsIStyleRule;
 struct nsCSSValueList;
 class nsCSSPropertySet;
 class nsCSSValue;
 
 class nsStyleCoord;
 struct nsCSSValuePairList;
 
+template <nsStyleStructID MinIndex, nsStyleStructID Count>
+class FixedStyleStructArray
+{
+private:
+  void* mArray[Count];
+public:
+  void*& operator[](nsStyleStructID aIndex) {
+    MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count),
+               "out of range");
+    return mArray[aIndex - MinIndex];
+  }
+
+  const void* operator[](nsStyleStructID aIndex) const {
+    MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count),
+               "out of range");
+    return mArray[aIndex - MinIndex];
+  }
+};
+
 struct nsInheritedStyleData
 {
-  mozilla::RangedArray<void*,
-                       nsStyleStructID_Inherited_Start,
-                       nsStyleStructID_Inherited_Count> mStyleStructs;
+  FixedStyleStructArray<nsStyleStructID_Inherited_Start,
+                        nsStyleStructID_Inherited_Count> mStyleStructs;
 
   void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
     return aContext->PresShell()->
       AllocateByObjectID(nsPresArena::nsInheritedStyleData_id, sz);
   }
 
   void DestroyStructs(uint64_t aBits, nsPresContext* aContext) {
 #define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
@@ -61,19 +78,18 @@ struct nsInheritedStyleData
          i = nsStyleStructID(i + 1)) {
       mStyleStructs[i] = nullptr;
     }
   }
 };
 
 struct nsResetStyleData
 {
-  mozilla::RangedArray<void*,
-                       nsStyleStructID_Reset_Start,
-                       nsStyleStructID_Reset_Count> mStyleStructs;
+  FixedStyleStructArray<nsStyleStructID_Reset_Start,
+                        nsStyleStructID_Reset_Count> mStyleStructs;
 
   nsResetStyleData()
   {
     for (nsStyleStructID i = nsStyleStructID_Reset_Start;
          i < nsStyleStructID_Reset_Start + nsStyleStructID_Reset_Count;
          i = nsStyleStructID(i + 1)) {
       mStyleStructs[i] = nullptr;
     }
deleted file mode 100644
--- a/mfbt/RangedArray.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-/*
- * A compile-time constant-length array, with bounds-checking assertions -- but
- * unlike mozilla::Array, with indexes biased by a constant.
- *
- * Thus where mozilla::Array<int, 3> is a three-element array indexed by [0, 3),
- * mozilla::RangedArray<int, 8, 3> is a three-element array indexed by [8, 11).
- */
-
-#ifndef mozilla_RangedArray_h
-#define mozilla_RangedArray_h
-
-#include "mozilla/Array.h"
-
-namespace mozilla {
-
-template<typename T, size_t MinIndex, size_t Length>
-class RangedArray
-{
-public:
-  T& operator[](size_t aIndex)
-  {
-    MOZ_ASSERT(MinIndex == 0 || aIndex > MinIndex);
-    return mArr[aIndex - MinIndex];
-  }
-
-  const T& operator[](size_t aIndex) const
-  {
-    MOZ_ASSERT(MinIndex == 0 || aIndex > MinIndex);
-    return mArr[aIndex - MinIndex];
-  }
-
-private:
-  Array<T, Length> mArr;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_RangedArray_h
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -54,17 +54,16 @@ EXPORTS.mozilla = [
     'MemoryReporting.h',
     'Move.h',
     'NullPtr.h',
     'NumericLimits.h',
     'Pair.h',
     'PodOperations.h',
     'Poison.h',
     'Range.h',
-    'RangedArray.h',
     'RangedPtr.h',
     'RefCountType.h',
     'ReentrancyGuard.h',
     'RefPtr.h',
     'ReverseIterator.h',
     'RollingMean.h',
     'Scoped.h',
     'SegmentedVector.h',