Merge backout on a CLOSED TREE.
authorKyle Huey <khuey@kylehuey.com>
Mon, 18 Mar 2013 13:00:28 -0700
changeset 125281 75b300cd1c3dbb0017420606d5157c707ff7163b
parent 125280 20152b50f68a57c7edde43d02701f9a950613d35 (current diff)
parent 125279 d764382ed4cf45467027f632018c6b8b8ec18df5 (diff)
child 125282 284df6d78bc55ec816f7c162d858cb8361239c0f
push idunknown
push userunknown
push dateunknown
milestone22.0a1
Merge backout on a CLOSED TREE.
build/unix/add_phony_targets.py
js/src/build/unix/add_phony_targets.py
--- a/build/cl.py
+++ b/build/cl.py
@@ -52,12 +52,11 @@ def InvokeClWithDependencyGeneration(cmd
         except OSError:
             pass # This suppresses the error we get when the dir exists, at the
                  # cost of masking failure to create the directory.  We'll just
                  # die on the next line though, so it's not that much of a loss.
 
     f = open(depstarget, "w")
     for dep in sorted(deps):
         print >>f, "%s: %s" % (target, dep)
-        print >>f, "%s:" % dep
 
 if __name__ == "__main__":
     InvokeClWithDependencyGeneration(sys.argv[1:])
deleted file mode 100644
--- a/build/unix/add_phony_targets.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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/.
-
-import pymake.data
-import pymake.parser
-import pymake.parserdata
-import sys
-
-'''
-Modifies the output of Sun Studio's -xM to look more like the output
-of gcc's -MD -MP, adding phony targets for dependencies.
-'''
-
-
-def add_phony_targets(path):
-    print path
-    deps = set()
-    targets = set()
-    for stmt in pymake.parser.parsefile(path):
-        if isinstance(stmt, pymake.parserdata.Rule):
-            assert isinstance(stmt.depexp, pymake.data.StringExpansion)
-            assert isinstance(stmt.targetexp, pymake.data.StringExpansion)
-            for d in stmt.depexp.s.split():
-                deps.add(d)
-            for t in stmt.targetexp.s.split():
-                targets.add(t)
-    phony_targets = deps - targets
-    if not phony_targets:
-        return
-    with open(path, 'a') as f:
-        f.writelines('%s:\n' % d for d in phony_targets)
-
-
-if __name__ == '__main__':
-    for f in sys.argv[1:]:
-        add_phony_targets(f)
--- a/config/expandlibs_exec.py
+++ b/config/expandlibs_exec.py
@@ -324,14 +324,11 @@ def main():
         if proc.returncode:
             exit(proc.returncode)
     if not options.depend:
         return
     ensureParentDir(options.depend)
     with open(options.depend, 'w') as depfile:
         depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target)))
 
-        for dep in deps:
-            if os.path.isfile(dep) and dep != options.target:
-                depfile.write("%s :\n" % dep)
 
 if __name__ == '__main__':
     main()
--- a/config/expandlibs_gen.py
+++ b/config/expandlibs_gen.py
@@ -39,12 +39,9 @@ if __name__ == '__main__':
         raise Exception("Missing option: -o")
 
     ensureParentDir(options.output)
     with open(options.output, 'w') as outfile:
         print >>outfile, generate(args)
     if options.depend:
         ensureParentDir(options.depend)
         with open(options.depend, 'w') as depfile:
-            deps = ExpandLibsDeps(args)
-            depfile.write("%s : %s\n" % (options.output, ' '.join(deps)))
-            for dep in deps:
-                depfile.write("%s :\n" % dep)
+            depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args))))
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -981,29 +981,27 @@ endif
 
 ifeq ($(SOLARIS_SUNPRO_CC),1)
 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
 
 define MAKE_DEPS_AUTO_CC
 if test -d $(@D); then \
 	echo "Building deps for $< using Sun Studio cc"; \
 	$(CC) $(COMPILE_CFLAGS) -xM  $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 define MAKE_DEPS_AUTO_CXX
 if test -d $(@D); then \
 	echo "Building deps for $< using Sun Studio CC"; \
 	$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 endif # Sun Studio on Solaris
 
-$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
+$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS)
 
 # Rules for building native targets must come first because of the host_ prefix
 $(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c
 	$(REPORT_BUILD)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CPPOBJS): host_%.$(OBJ_SUFFIX): %.cpp
 	$(REPORT_BUILD)
@@ -1610,17 +1608,24 @@ endif
 #   a previous build in the source tree) and thus neglect to create a
 #   dependency directory in the object directory, where we really need
 #   it.
 
 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
 MDDEPEND_FILES		:= $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
 
 ifneq (,$(MDDEPEND_FILES))
-include $(MDDEPEND_FILES)
+# The script mddepend.pl checks the dependencies and writes to stdout
+# one rule to force out-of-date objects. For example,
+#   foo.o boo.o: FORCE
+# The script has an advantage over including the *.pp files directly
+# because it handles the case when header files are removed from the build.
+# 'make' would complain that there is no way to build missing headers.
+ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES))
+$(eval $(ALL_PP_RESULTS))
 endif
 
 endif
 #############################################################################
 
 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
 -include $(MY_RULES)
 
--- a/configure.in
+++ b/configure.in
@@ -7930,17 +7930,17 @@ fi # COMPILE_ENVIRONMENT
 dnl ========================================================
 dnl =
 dnl = Build depencency options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Build dependencies)
 
 if test "$GNU_CC" -a "$GNU_CXX"; then
-  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
+  _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
 elif test "$SOLARIS_SUNPRO_CC"; then
   _DEPEND_CFLAGS=
 else
   dnl Don't override this for MSVC
   if test -z "$_WIN32_MSVC"; then
     _USE_CPP_INCLUDE_FLAG=
     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
--- a/content/svg/content/src/SVGComponentTransferFunctionElement.h
+++ b/content/svg/content/src/SVGComponentTransferFunctionElement.h
@@ -33,17 +33,16 @@ protected:
     SetIsDOMBinding();
   }
 
 public:
   // interfaces:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT
 
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsIAtom* aAttribute) const;
 
   virtual int32_t GetChannel() = 0;
   bool GenerateLookupTable(uint8_t* aTable);
 
   // WebIDL
@@ -57,17 +56,16 @@ public:
   already_AddRefed<nsIDOMSVGAnimatedNumber> Exponent();
   already_AddRefed<nsIDOMSVGAnimatedNumber> Offset();
 
 protected:
   virtual NumberAttributesInfo GetNumberInfo();
   virtual EnumAttributesInfo GetEnumInfo();
   virtual NumberListAttributesInfo GetNumberListInfo();
 
-  // nsIDOMSVGComponentTransferFunctionElement properties:
   enum { TABLEVALUES };
   SVGAnimatedNumberList mNumberListAttributes[1];
   static NumberListInfo sNumberListInfo[1];
 
   enum { SLOPE, INTERCEPT, AMPLITUDE, EXPONENT, OFFSET };
   nsSVGNumber2 mNumberAttributes[5];
   static NumberInfo sNumberInfo[5];
 
@@ -82,34 +80,30 @@ protected:
 
 nsresult NS_NewSVGFEFuncRElement(
     nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncRElement : public SVGComponentTransferFunctionElement,
-                          public nsIDOMSVGFEFuncRElement
+                          public nsIDOMSVGElement
 {
   friend nsresult (::NS_NewSVGFEFuncRElement(
     nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  SVGFEFuncRElement(already_AddRefed<nsINodeInfo> aNodeInfo) 
+  SVGFEFuncRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
     : SVGComponentTransferFunctionElement(aNodeInfo) {}
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
+  virtual int32_t GetChannel() { return 0; }
 
-  NS_DECL_NSIDOMSVGFEFUNCRELEMENT
-
-  virtual int32_t GetChannel() { return 0; }
-  
   NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
@@ -122,32 +116,28 @@ public:
 
 nsresult NS_NewSVGFEFuncGElement(
   nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncGElement : public SVGComponentTransferFunctionElement,
-                          public nsIDOMSVGFEFuncGElement
+                          public nsIDOMSVGElement
 {
   friend nsresult (::NS_NewSVGFEFuncGElement(
     nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  SVGFEFuncGElement(already_AddRefed<nsINodeInfo> aNodeInfo) 
+  SVGFEFuncGElement(already_AddRefed<nsINodeInfo> aNodeInfo)
     : SVGComponentTransferFunctionElement(aNodeInfo) {}
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
-
-  NS_DECL_NSIDOMSVGFEFUNCGELEMENT
-
   virtual int32_t GetChannel() { return 1; }
 
   NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
@@ -162,32 +152,28 @@ public:
 
 nsresult NS_NewSVGFEFuncBElement(
   nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncBElement : public SVGComponentTransferFunctionElement,
-                          public nsIDOMSVGFEFuncBElement
+                          public nsIDOMSVGElement
 {
   friend nsresult (::NS_NewSVGFEFuncBElement(
     nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  SVGFEFuncBElement(already_AddRefed<nsINodeInfo> aNodeInfo) 
+  SVGFEFuncBElement(already_AddRefed<nsINodeInfo> aNodeInfo)
     : SVGComponentTransferFunctionElement(aNodeInfo) {}
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
-
-  NS_DECL_NSIDOMSVGFEFUNCBELEMENT
-
   virtual int32_t GetChannel() { return 2; }
 
   NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
@@ -202,32 +188,28 @@ public:
 
 nsresult NS_NewSVGFEFuncAElement(
   nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 class SVGFEFuncAElement : public SVGComponentTransferFunctionElement,
-                          public nsIDOMSVGFEFuncAElement
+                          public nsIDOMSVGElement
 {
   friend nsresult (::NS_NewSVGFEFuncAElement(
     nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  SVGFEFuncAElement(already_AddRefed<nsINodeInfo> aNodeInfo) 
+  SVGFEFuncAElement(already_AddRefed<nsINodeInfo> aNodeInfo)
     : SVGComponentTransferFunctionElement(aNodeInfo) {}
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
-
-  NS_DECL_NSIDOMSVGFEFUNCAELEMENT
-
   virtual int32_t GetChannel() { return 3; }
 
   NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -48,16 +48,23 @@
 #undef LoadImage
 #endif
 
 #define NUM_ENTRIES_IN_4x5_MATRIX 20
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0;
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1;
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE    = 2;
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3;
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR   = 4;
+static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA    = 5;
+
 void
 CopyDataRect(uint8_t *aDest, const uint8_t *aSrc, uint32_t aStride,
              const nsIntRect& aDataRect)
 {
   for (int32_t y = aDataRect.y; y < aDataRect.YMost(); y++) {
     memcpy(aDest + y * aStride + 4 * aDataRect.x,
            aSrc + y * aStride + 4 * aDataRect.x,
            4 * aDataRect.width);
@@ -1474,33 +1481,33 @@ nsSVGElement::NumberInfo SVGComponentTra
   { &nsGkAtoms::intercept, 0, false },
   { &nsGkAtoms::amplitude, 1, false },
   { &nsGkAtoms::exponent,  1, false },
   { &nsGkAtoms::offset,    0, false }
 };
 
 nsSVGEnumMapping SVGComponentTransferFunctionElement::sTypeMap[] = {
   {&nsGkAtoms::identity,
-   nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY},
+   SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY},
   {&nsGkAtoms::table,
-   nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE},
+   SVG_FECOMPONENTTRANSFER_TYPE_TABLE},
   {&nsGkAtoms::discrete,
-   nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE},
+   SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE},
   {&nsGkAtoms::linear,
-   nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR},
+   SVG_FECOMPONENTTRANSFER_TYPE_LINEAR},
   {&nsGkAtoms::gamma,
-   nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA},
+   SVG_FECOMPONENTTRANSFER_TYPE_GAMMA},
   {nullptr, 0}
 };
 
 nsSVGElement::EnumInfo SVGComponentTransferFunctionElement::sEnumInfo[1] =
 {
   { &nsGkAtoms::type,
     sTypeMap,
-    nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY
+    SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY
   }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ADDREF_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransferFunctionElementBase)
 NS_IMPL_RELEASE_INHERITED(SVGComponentTransferFunctionElement,SVGComponentTransferFunctionElementBase)
@@ -1516,115 +1523,72 @@ NS_INTERFACE_MAP_BEGIN(SVGComponentTrans
 NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElementBase)
 
 
 //----------------------------------------------------------------------
 // nsFEUnstyledElement methods
 
 bool
 SVGComponentTransferFunctionElement::AttributeAffectsRendering(int32_t aNameSpaceID,
-                                                                 nsIAtom* aAttribute) const
+                                                               nsIAtom* aAttribute) const
 {
   return aNameSpaceID == kNameSpaceID_None &&
          (aAttribute == nsGkAtoms::tableValues ||
           aAttribute == nsGkAtoms::slope ||
           aAttribute == nsGkAtoms::intercept ||
           aAttribute == nsGkAtoms::amplitude ||
           aAttribute == nsGkAtoms::exponent ||
           aAttribute == nsGkAtoms::offset ||
           aAttribute == nsGkAtoms::type);
 }
 
 //----------------------------------------------------------------------
-// nsIDOMSVGComponentTransferFunctionElement methods
-
-/* readonly attribute nsIDOMSVGAnimatedEnumeration type; */
+
 already_AddRefed<nsIDOMSVGAnimatedEnumeration>
 SVGComponentTransferFunctionElement::Type()
 {
   return mEnumAttributes[TYPE].ToDOMAnimatedEnum(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetType(nsIDOMSVGAnimatedEnumeration * *aType)
-{
-  *aType = Type().get();
-  return NS_OK;
-}
-
-/* readonly attribute DOMSVGAnimatedNumberList tableValues; */
+
 already_AddRefed<DOMSVGAnimatedNumberList>
 SVGComponentTransferFunctionElement::TableValues()
 {
   return DOMSVGAnimatedNumberList::GetDOMWrapper(
     &mNumberListAttributes[TABLEVALUES], this, TABLEVALUES);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetTableValues(nsISupports * *aTableValues)
-{
-  *aTableValues = TableValues().get();
-  return NS_OK;
-}
-
-/* readonly attribute nsIDOMSVGAnimatedNumber slope; */
+
 already_AddRefed<nsIDOMSVGAnimatedNumber>
 SVGComponentTransferFunctionElement::Slope()
 {
   return mNumberAttributes[SLOPE].ToDOMAnimatedNumber(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetSlope(nsIDOMSVGAnimatedNumber * *aSlope)
-{
-  *aSlope = Slope().get();
-  return NS_OK;
-}
-
-/* readonly attribute nsIDOMSVGAnimatedNumber intercept; */
+
 already_AddRefed<nsIDOMSVGAnimatedNumber>
 SVGComponentTransferFunctionElement::Intercept()
 {
   return mNumberAttributes[INTERCEPT].ToDOMAnimatedNumber(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetIntercept(nsIDOMSVGAnimatedNumber * *aIntercept)
-{
-  *aIntercept = Intercept().get();
-  return NS_OK;
-}
-
-/* readonly attribute nsIDOMSVGAnimatedNumber amplitude; */
+
 already_AddRefed<nsIDOMSVGAnimatedNumber>
 SVGComponentTransferFunctionElement::Amplitude()
 {
   return mNumberAttributes[AMPLITUDE].ToDOMAnimatedNumber(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetAmplitude(nsIDOMSVGAnimatedNumber * *aAmplitude)
-{
-  *aAmplitude = Amplitude().get();
-  return NS_OK;
-}
-
-/* readonly attribute nsIDOMSVGAnimatedNumber exponent; */
+
 already_AddRefed<nsIDOMSVGAnimatedNumber>
 SVGComponentTransferFunctionElement::Exponent()
 {
   return mNumberAttributes[EXPONENT].ToDOMAnimatedNumber(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetExponent(nsIDOMSVGAnimatedNumber * *aExponent)
-{
-  *aExponent = Exponent().get();
-  return NS_OK;
-}
-
-/* readonly attribute nsIDOMSVGAnimatedNumber offset; */
+
 already_AddRefed<nsIDOMSVGAnimatedNumber>
 SVGComponentTransferFunctionElement::Offset()
 {
   return mNumberAttributes[OFFSET].ToDOMAnimatedNumber(this);
 }
-NS_IMETHODIMP SVGComponentTransferFunctionElement::GetOffset(nsIDOMSVGAnimatedNumber * *aOffset)
-{
-  *aOffset = Offset().get();
-  return NS_OK;
-}
 
 bool
 SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
 {
   uint16_t type = mEnumAttributes[TYPE].GetAnimValue();
 
   float slope, intercept, amplitude, exponent, offset;
   GetAnimatedNumberValues(&slope, &intercept, &amplitude, 
@@ -1632,17 +1596,17 @@ SVGComponentTransferFunctionElement::Gen
 
   const SVGNumberList &tableValues =
     mNumberListAttributes[TABLEVALUES].GetAnimValue();
   uint32_t tvLength = tableValues.Length();
 
   uint32_t i;
 
   switch (type) {
-  case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
+  case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
   {
     if (tableValues.Length() < 2)
       return false;
 
     for (i = 0; i < 256; i++) {
       uint32_t k = (i * (tvLength - 1)) / 255;
       float v1 = tableValues[k];
       float v2 = tableValues[std::min(k + 1, tvLength - 1)];
@@ -1650,56 +1614,56 @@ SVGComponentTransferFunctionElement::Gen
         int32_t(255 * (v1 + (i/255.0f - k/float(tvLength-1))*(tvLength - 1)*(v2 - v1)));
       val = std::min(255, val);
       val = std::max(0, val);
       aTable[i] = val;
     }
     break;
   }
 
-  case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
+  case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
   {
     if (tableValues.Length() < 1)
       return false;
 
     for (i = 0; i < 256; i++) {
       uint32_t k = (i * tvLength) / 255;
       k = std::min(k, tvLength - 1);
       float v = tableValues[k];
       int32_t val = int32_t(255 * v);
       val = std::min(255, val);
       val = std::max(0, val);
       aTable[i] = val;
     }
     break;
   }
 
-  case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
+  case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
   {
     for (i = 0; i < 256; i++) {
       int32_t val = int32_t(slope * i + 255 * intercept);
       val = std::min(255, val);
       val = std::max(0, val);
       aTable[i] = val;
     }
     break;
   }
 
-  case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
+  case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
   {
     for (i = 0; i < 256; i++) {
       int32_t val = int32_t(255 * (amplitude * pow(i / 255.0f, exponent) + offset));
       val = std::min(255, val);
       val = std::max(0, val);
       aTable[i] = val;
     }
     break;
   }
 
-  case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
+  case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
   default:
     break;
   }
   return true;
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
@@ -1720,22 +1684,20 @@ SVGComponentTransferFunctionElement::Get
 
 nsSVGElement::NumberAttributesInfo
 SVGComponentTransferFunctionElement::GetNumberInfo()
 {
   return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
                               ArrayLength(sNumberInfo));
 }
 
-NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncRElement,
+NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncRElement,
                              SVGComponentTransferFunctionElement,
                              nsIDOMNode, nsIDOMElement,
-                             nsIDOMSVGElement,
-                             nsIDOMSVGComponentTransferFunctionElement,
-                             nsIDOMSVGFEFuncRElement)
+                             nsIDOMSVGElement)
 
 /* virtual */ JSObject*
 SVGFEFuncRElement::WrapNode(JSContext* aCx, JSObject* aScope)
 {
   return SVGFEFuncRElementBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
@@ -1743,22 +1705,20 @@ SVGFEFuncRElement::WrapNode(JSContext* a
 
 NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFuncR)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncRElement)
 
-NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncGElement,
+NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncGElement,
                              SVGComponentTransferFunctionElement,
                              nsIDOMNode, nsIDOMElement,
-                             nsIDOMSVGElement,
-                             nsIDOMSVGComponentTransferFunctionElement,
-                             nsIDOMSVGFEFuncGElement)
+                             nsIDOMSVGElement)
 
 /* virtual */ JSObject*
 SVGFEFuncGElement::WrapNode(JSContext* aCx, JSObject* aScope)
 {
   return SVGFEFuncGElementBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
@@ -1766,22 +1726,20 @@ SVGFEFuncGElement::WrapNode(JSContext* a
 
 NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFuncG)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncGElement)
 
-NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncBElement,
+NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncBElement,
                              SVGComponentTransferFunctionElement,
                              nsIDOMNode, nsIDOMElement,
-                             nsIDOMSVGElement,
-                             nsIDOMSVGComponentTransferFunctionElement,
-                             nsIDOMSVGFEFuncBElement)
+                             nsIDOMSVGElement)
 
 /* virtual */ JSObject*
 SVGFEFuncBElement::WrapNode(JSContext* aCx, JSObject* aScope)
 {
   return SVGFEFuncBElementBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
@@ -1789,22 +1747,20 @@ SVGFEFuncBElement::WrapNode(JSContext* a
 
 NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFuncB)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncBElement)
 
-NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncAElement,
+NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncAElement,
                              SVGComponentTransferFunctionElement,
                              nsIDOMNode, nsIDOMElement,
-                             nsIDOMSVGElement,
-                             nsIDOMSVGComponentTransferFunctionElement,
-                             nsIDOMSVGFEFuncAElement)
+                             nsIDOMSVGElement)
 
 /* virtual */ JSObject*
 SVGFEFuncAElement::WrapNode(JSContext* aCx, JSObject* aScope)
 {
   return SVGFEFuncAElementBinding::Wrap(aCx, aScope, this);
 }
 
 } // namespace dom
--- a/dom/interfaces/svg/nsIDOMSVGFilters.idl
+++ b/dom/interfaces/svg/nsIDOMSVGFilters.idl
@@ -32,37 +32,16 @@ interface nsIDOMSVGFEColorMatrixElement 
     const unsigned short SVG_FECOLORMATRIX_TYPE_LUMINANCE_TO_ALPHA = 4;
 
     readonly attribute nsIDOMSVGAnimatedString in1;
     readonly attribute nsIDOMSVGAnimatedEnumeration type;
     // SVGAnimatedNumberList
     readonly attribute nsISupports  values;
 };
 
-[scriptable, uuid(3fa8c369-df5b-4bfb-9651-c999bc22fbc7)]
-interface nsIDOMSVGComponentTransferFunctionElement : nsIDOMSVGElement
-{
-    // Component Transfer Types
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0;
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1;
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE    = 2;
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3;
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR   = 4;
-    const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA    = 5;
-
-    readonly attribute nsIDOMSVGAnimatedEnumeration type;
-    // SVGAnimatedNumberList
-    readonly attribute nsISupports                  tableValues;
-    readonly attribute nsIDOMSVGAnimatedNumber      slope;
-    readonly attribute nsIDOMSVGAnimatedNumber      intercept;
-    readonly attribute nsIDOMSVGAnimatedNumber      amplitude;
-    readonly attribute nsIDOMSVGAnimatedNumber      exponent;
-    readonly attribute nsIDOMSVGAnimatedNumber      offset;
-};
-
 [scriptable, uuid(f264fd1f-b272-4796-99b5-68c90cbd030c)]
 interface nsIDOMSVGFECompositeElement : nsIDOMSVGFilterPrimitiveStandardAttributes
 {
     // Operator Types
     const unsigned short SVG_OPERATOR_UNKNOWN    = 0;
     const unsigned short SVG_OPERATOR_OVER       = 1;
     const unsigned short SVG_OPERATOR_IN         = 2;
     const unsigned short SVG_OPERATOR_OUT        = 3;
@@ -77,36 +56,16 @@ interface nsIDOMSVGFECompositeElement : 
     readonly attribute nsIDOMSVGAnimatedNumber  k3;
     readonly attribute nsIDOMSVGAnimatedNumber  k4;
     readonly attribute nsIDOMSVGAnimatedEnumeration operator;
     
     void setK ( in float k1, in float k2, in float k3, in float k4 );
 
 };
 
-[scriptable, uuid(7ff6cba9-65e0-48d2-9d81-4ab26782a945)]
-interface nsIDOMSVGFEFuncRElement : nsIDOMSVGComponentTransferFunctionElement
-{
-};
-
-[scriptable, uuid(b6a7ad39-724f-42ab-8d3f-a05d1cf7ab0c)]
-interface nsIDOMSVGFEFuncGElement : nsIDOMSVGComponentTransferFunctionElement
-{
-};
-
-[scriptable, uuid(c414b7dd-7ff2-4158-988a-20943d22db52)]
-interface nsIDOMSVGFEFuncBElement : nsIDOMSVGComponentTransferFunctionElement
-{
-};
-
-[scriptable, uuid(f4f5fe63-9570-48f7-ba7e-a5300fa71aed)]
-interface nsIDOMSVGFEFuncAElement : nsIDOMSVGComponentTransferFunctionElement
-{
-};
-
 [scriptable, uuid(08f2d7e5-b79f-405c-8140-7faa72c53ead)]
 interface nsIDOMSVGFEGaussianBlurElement : nsIDOMSVGFilterPrimitiveStandardAttributes
 { 
     readonly attribute nsIDOMSVGAnimatedString in1;
     readonly attribute nsIDOMSVGAnimatedNumber stdDeviationX;
     readonly attribute nsIDOMSVGAnimatedNumber stdDeviationY;
 
     void setStdDeviation ( in float stdDeviationX, in float stdDeviationY );
--- a/ipc/chromium/src/base/histogram.cc
+++ b/ipc/chromium/src/base/histogram.cc
@@ -91,17 +91,16 @@ Histogram* Histogram::FactoryGet(const s
     minimum = 1;
   if (maximum > kSampleType_MAX - 1)
     maximum = kSampleType_MAX - 1;
 
   if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
     // Extra variable is not needed... but this keeps this section basically
     // identical to other derived classes in this file (and compiler will
     // optimize away the extra variable.
-    // To avoid racy destruction at shutdown, the following will be leaked.
     Histogram* tentative_histogram =
         new Histogram(name, minimum, maximum, bucket_count);
     tentative_histogram->InitializeBucketRange();
     tentative_histogram->SetFlags(flags);
     histogram =
         StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
   }
 
@@ -848,17 +847,16 @@ Histogram* LinearHistogram::FactoryGet(c
   Histogram* histogram(NULL);
 
   if (minimum < 1)
     minimum = 1;
   if (maximum > kSampleType_MAX - 1)
     maximum = kSampleType_MAX - 1;
 
   if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
-    // To avoid racy destruction at shutdown, the following will be leaked.
     LinearHistogram* tentative_histogram =
         new LinearHistogram(name, minimum, maximum, bucket_count);
     tentative_histogram->InitializeBucketRange();
     tentative_histogram->SetFlags(flags);
     histogram =
         StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
   }
 
@@ -944,17 +942,16 @@ bool LinearHistogram::PrintEmptyBucket(s
 //------------------------------------------------------------------------------
 // This section provides implementation for BooleanHistogram.
 //------------------------------------------------------------------------------
 
 Histogram* BooleanHistogram::FactoryGet(const std::string& name, Flags flags) {
   Histogram* histogram(NULL);
 
   if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
-    // To avoid racy destruction at shutdown, the following will be leaked.
     BooleanHistogram* tentative_histogram = new BooleanHistogram(name);
     tentative_histogram->InitializeBucketRange();
     tentative_histogram->SetFlags(flags);
     histogram =
         StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
   }
 
   DCHECK_EQ(BOOLEAN_HISTOGRAM, histogram->histogram_type());
@@ -986,17 +983,16 @@ BooleanHistogram::Accumulate(Sample valu
 //------------------------------------------------------------------------------
 
 Histogram *
 FlagHistogram::FactoryGet(const std::string &name, Flags flags)
 {
   Histogram *h(nullptr);
 
   if (!StatisticsRecorder::FindHistogram(name, &h)) {
-    // To avoid racy destruction at shutdown, the following will be leaked.
     FlagHistogram *fh = new FlagHistogram(name);
     fh->InitializeBucketRange();
     fh->SetFlags(flags);
     size_t zero_index = fh->BucketIndex(0);
     fh->LinearHistogram::Accumulate(0, 1, zero_index);
     h = StatisticsRecorder::RegisterOrDeleteDuplicate(fh);
   }
 
@@ -1070,17 +1066,16 @@ Histogram* CustomHistogram::FactoryGet(c
     DCHECK(false);
     // Note that we pushed a 0 in above, so for defensive code....
     ranges.push_back(1);  // Put in some data so we can index to [1].
   }
 
   DCHECK_LT(ranges.back(), kSampleType_MAX);
 
   if (!StatisticsRecorder::FindHistogram(name, &histogram)) {
-    // To avoid racy destruction at shutdown, the following will be leaked.
     CustomHistogram* tentative_histogram = new CustomHistogram(name, ranges);
     tentative_histogram->InitializedCustomBucketRange(ranges);
     tentative_histogram->SetFlags(flags);
     histogram =
         StatisticsRecorder::RegisterOrDeleteDuplicate(tentative_histogram);
   }
 
   DCHECK_EQ(histogram->histogram_type(), CUSTOM_HISTOGRAM);
@@ -1147,16 +1142,23 @@ StatisticsRecorder::~StatisticsRecorder(
     LOG(INFO) << output;
   }
   // Clean up.
   HistogramMap* histograms = NULL;
   {
     base::AutoLock auto_lock(*lock_);
     histograms = histograms_;
     histograms_ = NULL;
+    for (HistogramMap::iterator it = histograms->begin();
+         histograms->end() != it;
+         ++it) {
+      // No other clients permanently hold Histogram references, so we
+      // have the only one and it is safe to delete it.
+      delete it->second;
+    }
   }
   delete histograms;
   // We don't delete lock_ on purpose to avoid having to properly protect
   // against it going away after we checked for NULL in the static methods.
 }
 
 // static
 bool StatisticsRecorder::IsActive() {
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -41,17 +41,16 @@ include $(MFBT_ROOT)/exported_headers.mk
 
 VPATH		+= \
 		$(srcdir) \
 		$(srcdir)/builtin \
 		$(srcdir)/devtools \
 		$(srcdir)/ds \
 		$(srcdir)/frontend \
 		$(srcdir)/gc \
-		$(srcdir)/ion \
 		$(srcdir)/vm \
 		$(NULL)
 
 CPPSRCS		= \
 		jsalloc.cpp \
 		jsanalyze.cpp \
 		jsapi.cpp \
 		jsarray.cpp \
@@ -140,19 +139,16 @@ CPPSRCS		= \
 		StoreBuffer.cpp \
 		Iteration.cpp \
 		Zone.cpp \
 		Verifier.cpp \
 		StringBuffer.cpp \
 		Unicode.cpp \
 		Xdr.cpp \
 		Module.cpp \
-		AsmJS.cpp \
-		AsmJSLink.cpp \
-		AsmJSSignalHandlers.cpp \
 		$(NULL)
 
 # Changes to internal header files, used externally, massively slow down
 # browser builds.  Don't add new files here unless you know what you're
 # doing!
 INSTALLED_HEADERS = \
 		js-config.h \
 		jscpucfg.h \
@@ -290,16 +286,19 @@ CPPSRCS +=	MIR.cpp \
 		ValueNumbering.cpp \
 		RangeAnalysis.cpp \
 		VMFunctions.cpp \
 		ParallelFunctions.cpp \
 		AliasAnalysis.cpp \
 		ParallelArrayAnalysis.cpp \
 		UnreachableCodeElimination.cpp \
 		EffectiveAddressAnalysis.cpp \
+		AsmJS.cpp \
+		AsmJSLink.cpp \
+		AsmJSSignalHandlers.cpp \
 		$(NULL)
 endif #ENABLE_ION
 ifeq (86, $(findstring 86,$(TARGET_CPU)))
 ifdef ENABLE_ION
 CPPSRCS +=	CodeGenerator-x86-shared.cpp
 CPPSRCS +=	IonFrames-x86-shared.cpp
 CPPSRCS +=	MoveEmitter-x86-shared.cpp
 CPPSRCS +=	Assembler-x86-shared.cpp
--- a/js/src/build/cl.py
+++ b/js/src/build/cl.py
@@ -52,12 +52,11 @@ def InvokeClWithDependencyGeneration(cmd
         except OSError:
             pass # This suppresses the error we get when the dir exists, at the
                  # cost of masking failure to create the directory.  We'll just
                  # die on the next line though, so it's not that much of a loss.
 
     f = open(depstarget, "w")
     for dep in sorted(deps):
         print >>f, "%s: %s" % (target, dep)
-        print >>f, "%s:" % dep
 
 if __name__ == "__main__":
     InvokeClWithDependencyGeneration(sys.argv[1:])
deleted file mode 100644
--- a/js/src/build/unix/add_phony_targets.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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/.
-
-import pymake.data
-import pymake.parser
-import pymake.parserdata
-import sys
-
-'''
-Modifies the output of Sun Studio's -xM to look more like the output
-of gcc's -MD -MP, adding phony targets for dependencies.
-'''
-
-
-def add_phony_targets(path):
-    print path
-    deps = set()
-    targets = set()
-    for stmt in pymake.parser.parsefile(path):
-        if isinstance(stmt, pymake.parserdata.Rule):
-            assert isinstance(stmt.depexp, pymake.data.StringExpansion)
-            assert isinstance(stmt.targetexp, pymake.data.StringExpansion)
-            for d in stmt.depexp.s.split():
-                deps.add(d)
-            for t in stmt.targetexp.s.split():
-                targets.add(t)
-    phony_targets = deps - targets
-    if not phony_targets:
-        return
-    with open(path, 'a') as f:
-        f.writelines('%s:\n' % d for d in phony_targets)
-
-
-if __name__ == '__main__':
-    for f in sys.argv[1:]:
-        add_phony_targets(f)
new file mode 100644
--- /dev/null
+++ b/js/src/build/unix/mddepend.pl
@@ -0,0 +1,139 @@
+#!/usr/bin/env perl
+
+# 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/.
+
+# mddepend.pl - Reads in dependencies generated my -MD flag. Prints list
+#   of objects that need to be rebuilt. These can then be added to the
+#   PHONY target. Using this script copes with the problem of header
+#   files that have been removed from the build.
+#    
+# Usage:
+#   mddepend.pl <output_file> <dependency_files...>
+#
+# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
+
+use strict;
+
+use constant DEBUG => 0;
+
+my $outfile = shift @ARGV;
+my $silent = $ENV{MAKEFLAGS} =~ /^\w*s|\s-s/;
+
+my $line = '';
+my %alldeps;
+# Parse dependency files
+while (<>) {
+  s/\r?\n$//; # Handle both unix and DOS line endings
+  $line .= $_;
+  if ($line =~ /\\$/) {
+    chop $line;
+    next;
+  }
+
+  $line =~ s|\\|/|g;
+
+  my ($obj,$rest) = split /\s*:\s+/, $line, 2;
+  $line = '';
+  next if !$obj || !$rest;
+
+  my @deps = split /\s+/, $rest;
+  push @{$alldeps{$obj}}, @deps;
+  if (DEBUG >= 2) {
+    foreach my $dep (@deps) { print STDERR "add $obj $dep\n"; }
+  }
+}
+
+# Test dependencies
+my %modtimes; # cache
+my @objs;     # force rebuild on these
+OBJ_LOOP: foreach my $obj (keys %alldeps) {
+  my $mtime = (stat $obj)[9] or next;
+
+  my %not_in_cache;
+  my $deps = $alldeps{$obj};
+  foreach my $dep_file (@{$deps}) {
+    my $dep_mtime = $modtimes{$dep_file};
+    if (not defined $dep_mtime) {
+      print STDERR "Skipping $dep_file for $obj, will stat() later\n" if DEBUG >= 2;
+      $not_in_cache{$dep_file} = 1;
+      next;
+    }
+
+    print STDERR "Found $dep_file in cache\n" if DEBUG >= 2;
+
+    if ($dep_mtime > $mtime) {
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+    }
+    elsif ($dep_mtime == -1) {
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
+    }
+    else {
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      next;
+    }
+
+    push @objs, $obj; # dependency is missing or newer
+    next OBJ_LOOP; # skip checking the rest of the dependencies
+  }
+
+  foreach my $dep_file (keys %not_in_cache) {
+    print STDERR "STAT $dep_file for $obj\n" if DEBUG >= 2;
+    my $dep_mtime = $modtimes{$dep_file} = (stat $dep_file)[9] || -1;
+
+    if ($dep_mtime > $mtime) {
+      print STDERR "$dep_file($dep_mtime) newer than $obj($mtime)\n" if DEBUG;
+    }
+    elsif ($dep_mtime == -1) {
+      print STDERR "Couldn't stat $dep_file for $obj\n" if DEBUG;
+    }
+    else {
+      print STDERR "$dep_file($dep_mtime) older than $obj($mtime)\n" if DEBUG >= 2;
+      next;
+    }
+
+    push @objs, $obj; # dependency is missing or newer
+    next OBJ_LOOP; # skip checking the rest of the dependencies
+  }
+
+  # If we get here it means nothing needs to be done for $obj
+}
+
+# Output objects to rebuild (if needed).
+if ($outfile eq '-') {
+    if (@objs) {
+	print "@objs: FORCE\n";
+    }
+} elsif (@objs) {
+  my $old_output;
+  my $new_output = "@objs: FORCE\n";
+
+  # Read in the current dependencies file.
+  open(OLD, "<$outfile")
+    and $old_output = <OLD>;
+  close(OLD);
+
+  # Only write out the dependencies if they are different.
+  if ($new_output ne $old_output) {
+    open(OUT, ">$outfile") and print OUT "$new_output";
+    print "Updating dependencies file, $outfile\n" unless $silent;
+    if (DEBUG) {
+      print "new: $new_output\n";
+      print "was: $old_output\n" if $old_output ne '';
+    }
+  }
+} elsif (-s $outfile) {
+  # Remove the old dependencies because all objects are up to date.
+  print "Removing old dependencies file, $outfile\n" unless $silent;
+
+  if (DEBUG) {
+    my $old_output;
+    open(OLD, "<$outfile")
+      and $old_output = <OLD>;
+    close(OLD);
+    print "was: $old_output\n";
+  }
+
+  unlink $outfile;
+}
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -900,16 +900,26 @@ js::testingFunc_inParallelSection(JSCont
 {
     // If we were actually *in* a parallel section, then this function
     // would be inlined to TRUE in ion-generated code.
     JS_ASSERT(!InParallelSection());
     JS_SET_RVAL(cx, vp, JSVAL_FALSE);
     return true;
 }
 
+#ifndef JS_ION
+JSBool
+js::IsAsmJSCompilationAvailable(JSContext *cx, unsigned argc, Value *vp)
+{
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().set(BooleanValue(false));
+    return true;
+}
+#endif
+
 static JSFunctionSpecWithHelp TestingFunctions[] = {
     JS_FN_HELP("gc", ::GC, 0, 0,
 "gc([obj] | 'compartment')",
 "  Run the garbage collector. When obj is given, GC only its compartment.\n"
 "  If 'compartment' is given, GC any compartments that were scheduled for\n"
 "  GC via schedulegc."),
 
     JS_FN_HELP("gcparam", GCParameter, 2, 0,
--- a/js/src/config/expandlibs_exec.py
+++ b/js/src/config/expandlibs_exec.py
@@ -324,14 +324,11 @@ def main():
         if proc.returncode:
             exit(proc.returncode)
     if not options.depend:
         return
     ensureParentDir(options.depend)
     with open(options.depend, 'w') as depfile:
         depfile.write("%s : %s\n" % (options.target, ' '.join(dep for dep in deps if os.path.isfile(dep) and dep != options.target)))
 
-        for dep in deps:
-            if os.path.isfile(dep) and dep != options.target:
-                depfile.write("%s :\n" % dep)
 
 if __name__ == '__main__':
     main()
--- a/js/src/config/expandlibs_gen.py
+++ b/js/src/config/expandlibs_gen.py
@@ -39,12 +39,9 @@ if __name__ == '__main__':
         raise Exception("Missing option: -o")
 
     ensureParentDir(options.output)
     with open(options.output, 'w') as outfile:
         print >>outfile, generate(args)
     if options.depend:
         ensureParentDir(options.depend)
         with open(options.depend, 'w') as depfile:
-            deps = ExpandLibsDeps(args)
-            depfile.write("%s : %s\n" % (options.output, ' '.join(deps)))
-            for dep in deps:
-                depfile.write("%s :\n" % dep)
+            depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args))))
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -981,29 +981,27 @@ endif
 
 ifeq ($(SOLARIS_SUNPRO_CC),1)
 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
 
 define MAKE_DEPS_AUTO_CC
 if test -d $(@D); then \
 	echo "Building deps for $< using Sun Studio cc"; \
 	$(CC) $(COMPILE_CFLAGS) -xM  $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 define MAKE_DEPS_AUTO_CXX
 if test -d $(@D); then \
 	echo "Building deps for $< using Sun Studio CC"; \
 	$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 endif # Sun Studio on Solaris
 
-$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
+$(OBJS) $(HOST_OBJS): $(GLOBAL_DEPS)
 
 # Rules for building native targets must come first because of the host_ prefix
 $(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c
 	$(REPORT_BUILD)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CPPOBJS): host_%.$(OBJ_SUFFIX): %.cpp
 	$(REPORT_BUILD)
@@ -1610,17 +1608,24 @@ endif
 #   a previous build in the source tree) and thus neglect to create a
 #   dependency directory in the object directory, where we really need
 #   it.
 
 ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
 MDDEPEND_FILES		:= $(strip $(wildcard $(foreach file,$(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS) $(TARGETS) $(XPIDLSRCS:.idl=.h) $(XPIDLSRCS:.idl=.xpt),$(MDDEPDIR)/$(notdir $(file)).pp) $(addprefix $(MDDEPDIR)/,$(EXTRA_MDDEPEND_FILES))))
 
 ifneq (,$(MDDEPEND_FILES))
-include $(MDDEPEND_FILES)
+# The script mddepend.pl checks the dependencies and writes to stdout
+# one rule to force out-of-date objects. For example,
+#   foo.o boo.o: FORCE
+# The script has an advantage over including the *.pp files directly
+# because it handles the case when header files are removed from the build.
+# 'make' would complain that there is no way to build missing headers.
+ALL_PP_RESULTS = $(shell $(PERL) $(BUILD_TOOLS)/mddepend.pl - $(MDDEPEND_FILES))
+$(eval $(ALL_PP_RESULTS))
 endif
 
 endif
 #############################################################################
 
 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-rules.mk
 -include $(MY_RULES)
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3971,17 +3971,17 @@ MOZ_EXPAND_LIBS
 dnl ========================================================
 dnl =
 dnl = Build depencency options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Build dependencies)
 
 if test "$GNU_CC" -a "$GNU_CXX"; then
-  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
+  _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
 elif test "$SOLARIS_SUNPRO_CC"; then
   _DEPEND_CFLAGS=
 else
   dnl Don't override this for MSVC
   if test -z "$_WIN32_MSVC"; then
     _USE_CPP_INCLUDE_FLAG=
     _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -402,22 +402,24 @@ frontend::CompileFunctionBody(JSContext 
 
     if (fn->pn_body) {
         JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
         fn->pn_body->append(pn);
         fn->pn_body->pn_pos = pn->pn_pos;
         pn = fn->pn_body;
     }
 
+#ifdef JS_ION
     /*
      * Do asm.js compilation once the parse tree has been fully assembled but
      * before emitting since we need to know whether to emit JSOP_LINKASMJS.
      */
     if (fn->pn_funbox->useAsm && !CompileAsmJS(cx, parser.tokenStream, fn, script))
         return false;
+#endif
 
     if (!SetSourceMap(cx, parser.tokenStream, ss, script))
         return false;
 
     if (!EmitFunctionScript(cx, &funbce, pn))
         return false;
 
     if (!sct.complete())
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -4387,22 +4387,24 @@ EmitFunc(JSContext *cx, BytecodeEmitter 
                                                       parent->staticLevel + 1,
                                                       bce->script->scriptSource(),
                                                       funbox->bufStart, funbox->bufEnd));
         if (!script)
             return false;
 
         script->bindings = funbox->bindings;
 
+#ifdef JS_ION
         // Do asm.js compilation at the beginning of emitting to avoid
         // compiling twice when JS_BufferIsCompilableUnit and to know whether
         // to emit JSOP_LINKASMJS. Don't fold constants as this will
         // misrepresent the source JS as written to the type checker.
         if (funbox->useAsm && !CompileAsmJS(cx, *bce->tokenStream(), pn, script))
             return false;
+#endif
 
         BytecodeEmitter bce2(bce, bce->parser, funbox, script, bce->evalCaller,
                              bce->hasGlobalScope, pn->pn_pos.begin.lineno, bce->selfHostingMode);
         if (!bce2.init())
             return false;
 
         /* We measured the max scope depth when we parsed the function. */
         if (!EmitFunctionScript(cx, &bce2, pn->pn_body))
--- a/js/src/ion/AsmJS.cpp
+++ b/js/src/ion/AsmJS.cpp
@@ -11,24 +11,24 @@
 #include "ion/AsmJSModule.h"
 
 #include "frontend/ParseNode-inl.h"
 
 using namespace js;
 using namespace js::frontend;
 using namespace mozilla;
 
-#ifdef JS_ASMJS
-
 #include "ion/CodeGenerator.h"
 #include "ion/MIR.h"
 #include "ion/MIRGraph.h"
 
 using namespace js::ion;
 
+#ifdef JS_ASMJS
+
 /*****************************************************************************/
 // ParseNode utilities
 
 static inline ParseNode *
 NextNode(ParseNode *pn)
 {
     return pn->pn_next;
 }
--- a/js/src/ion/AsmJSLink.cpp
+++ b/js/src/ion/AsmJSLink.cpp
@@ -12,16 +12,18 @@
 
 #include "AsmJS.h"
 #include "AsmJSModule.h"
 
 using namespace js;
 using namespace js::ion;
 using namespace mozilla;
 
+#ifdef JS_ASMJS
+
 static bool
 LinkFail(JSContext *cx, const char *str)
 {
     JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage,
                                  NULL, JSMSG_USE_ASM_LINK_FAIL, str);
     return false;
 }
 
@@ -398,8 +400,10 @@ js::LinkAsmJS(JSContext *cx, StackFrame 
         RootedValue val(cx, ObjectValue(*fun));
         if (!DefineNativeProperty(cx, obj, id, val, NULL, NULL, JSPROP_ENUMERATE, 0, 0))
             return false;
     }
 
     rval.set(ObjectValue(*obj));
     return true;
 }
+
+#endif  // defined(JS_ASMJS)
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -1100,16 +1100,32 @@ XPCJSRuntime::ActivityCallback(void *arg
             self->mWatchdogHibernating = false;
             PR_NotifyCondVar(self->mWatchdogWakeup);
         }
     } else {
         self->mLastActiveTime = PR_Now();
     }
 }
 
+// static
+//
+// JS-CTypes creates and caches a JSContext that it uses when executing JS
+// callbacks. When we're notified that ctypes is about to call into some JS,
+// push the cx to maintain the integrity of the context stack.
+void
+XPCJSRuntime::CTypesActivityCallback(JSContext *cx, js::CTypesActivityType type)
+{
+  if (type == js::CTYPES_CALLBACK_BEGIN) {
+    if (!Get()->GetJSContextStack()->Push(cx))
+      MOZ_CRASH();
+  } else if (type == js::CTYPES_CALLBACK_END) {
+    Get()->GetJSContextStack()->Pop();
+  }
+}
+
 size_t
 XPCJSRuntime::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
     n += mallocSizeOf(this);
     n += mWrappedJSMap->SizeOfIncludingThis(mallocSizeOf);
     n += mIID2NativeInterfaceMap->SizeOfIncludingThis(mallocSizeOf);
     n += mClassInfo2NativeSetMap->ShallowSizeOfIncludingThis(mallocSizeOf);
@@ -2633,16 +2649,17 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* 
     JS_EnumerateDiagnosticMemoryRegions(DiagnosticMemoryCallback);
 #endif
 #ifdef MOZ_ENABLE_PROFILER_SPS
     if (PseudoStack *stack = mozilla_get_pseudo_stack())
         stack->sampleRuntime(mJSRuntime);
 #endif
     JS_SetAccumulateTelemetryCallback(mJSRuntime, AccumulateTelemetryCallback);
     js::SetActivityCallback(mJSRuntime, ActivityCallback, this);
+    js::SetCTypesActivityCallback(mJSRuntime, CTypesActivityCallback);
 
     // The JS engine needs to keep the source code around in order to implement
     // Function.prototype.toSource(). It'd be nice to not have to do this for
     // chrome code and simply stub out requests for source on it. Life is not so
     // easy, unfortunately. Nobody relies on chrome toSource() working in core
     // browser code, but chrome tests use it. The worst offenders are addons,
     // which like to monkeypatch chrome functions by calling toSource() on them
     // and using regular expressions to modify them. We avoid keeping most browser
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -892,16 +892,18 @@ private:
    JSDHashTable* DEBUG_WrappedNativeHashtable;
 public:
 #endif
 
     void AddGCCallback(JSGCCallback cb);
     void RemoveGCCallback(JSGCCallback cb);
 
     static void ActivityCallback(void *arg, JSBool active);
+    static void CTypesActivityCallback(JSContext *cx,
+                                       js::CTypesActivityType type);
 
     bool XBLScopesEnabled() {
         return gXBLScopesEnabled;
     }
 
     size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf);
 
     AutoMarkingPtr**  GetAutoRootsAdr() {return &mAutoRoots;}
--- a/memory/mozalloc/mozalloc_oom.cpp
+++ b/memory/mozalloc/mozalloc_oom.cpp
@@ -6,41 +6,45 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if defined(XP_WIN) || defined(XP_OS2)
 #  define MOZALLOC_EXPORT __declspec(dllexport)
 #endif
 
 #include "mozilla/mozalloc_abort.h"
 #include "mozilla/mozalloc_oom.h"
+#include "mozilla/Assertions.h"
 
 static mozalloc_oom_abort_handler gAbortHandler;
 
 #define OOM_MSG_LEADER "out of memory: 0x"
 #define OOM_MSG_DIGITS "0000000000000000" // large enough for 2^64
 #define OOM_MSG_TRAILER " bytes requested"
 #define OOM_MSG_FIRST_DIGIT_OFFSET sizeof(OOM_MSG_LEADER) - 1
 #define OOM_MSG_LAST_DIGIT_OFFSET sizeof(OOM_MSG_LEADER) + \
                                   sizeof(OOM_MSG_DIGITS) - 3
 
 static const char *hex = "0123456789ABCDEF";
 
 void
 mozalloc_handle_oom(size_t size)
 {
     char oomMsg[] = OOM_MSG_LEADER OOM_MSG_DIGITS OOM_MSG_TRAILER;
-    int i;
+    size_t i;
 
     // NB: this is handle_oom() stage 1, which simply aborts on OOM.
     // we might proceed to a stage 2 in which an attempt is made to
     // reclaim memory
 
     if (gAbortHandler)
         gAbortHandler(size);
 
+    MOZ_STATIC_ASSERT(OOM_MSG_FIRST_DIGIT_OFFSET > 0,
+                      "Loop below will never terminate (i can't go below 0)");
+
     // Insert size into the diagnostic message using only primitive operations
     for (i = OOM_MSG_LAST_DIGIT_OFFSET;
          size && i >= OOM_MSG_FIRST_DIGIT_OFFSET; i--) {
       oomMsg[i] = hex[size % 16];
       size /= 16;
     }
 
     mozalloc_abort(oomMsg);
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -26,17 +26,17 @@ ifneq ($(android_devices),device)
 install::
 	@echo "Multiple devices are connected. Define ANDROID_SERIAL to specify the install target."
 	$(ANDROID_PLATFORM_TOOLS)/adb devices
 	@exit 1
 endif
 endif
 
 install::
-	$(ANDROID_PLATFORM_TOOLS)/adb install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
+	$(ANDROID_PLATFORM_TOOLS)/adb install -r -d $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
 else
 	@echo "Mobile can't be installed directly."
 	@exit 1
 endif
 
 deb: package
 	@$(MAKE) -C mobile/android/installer deb
 
--- a/python/codegen/makeutils.py
+++ b/python/codegen/makeutils.py
@@ -13,11 +13,9 @@ def writeMakeDependOutput(filename):
     with open(filename, 'w') as f:
         if len(targets) > 0:
             f.write("%s:" % makeQuote(targets[0]))
             for filename in dependencies:
                 f.write(' \\\n\t\t%s' % makeQuote(filename))
             f.write('\n\n')
             for filename in targets[1:]:
                 f.write('%s: %s\n' % (makeQuote(filename), makeQuote(targets[0])))
-            for filename in dependencies:
-                f.write('%s:\n' % filename)
 
--- a/testing/mochitest/b2g.json
+++ b/testing/mochitest/b2g.json
@@ -254,16 +254,17 @@
 	"dom/imptests/editing/conformancetest/test_event.html":"",
 	"dom/imptests/editing/conformancetest/test_runtest.html":"",
 	"dom/imptests/editing/selecttest/test_Document-open.html":"",
 	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-cloneContents.html":"",
 	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-deleteContents.html":"",
 	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-extractContents.html":"",
 	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-insertNode.html":"",
 	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-surroundContents.html":"",
+	"dom/imptests/webapps/DOMCore/tests/approved/test_Range-mutations.html":" Test timed out.",
 	"dom/indexedDB/": "",
 	"dom/mobilemessage/tests/test_sms_basics.html": "",
 	"dom/media/tests/mochitest/test_getUserMedia_exceptions.html":"",
 	"dom/network/tests/test_networkstats_basics.html":"",
 	"dom/permission/tests/test_permission_basics.html":"",
 	"dom/settings/tests/test_settings_basics.html":"",
 	"dom/settings/tests/test_settings_onsettingchange.html":"",
 	"dom/tests/mochitest/ajax/jquery/test_jQuery.html":"",
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
@@ -2623,16 +2623,25 @@ function run_single_closure_tests(librar
   var closure64 = fn_64_t(closure_fn_64, null, bignum2);
   do_check_eq(ctypes.UInt64.compare(closure64(false), bignum1), 0);
   do_check_eq(ctypes.UInt64.compare(closure64(true), bignum2), 0);
 
   // Test a callback that returns void (see bug 682504).
   var fn_v_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, []).ptr;
   fn_v_t(function() {})(); // Don't crash
 
+  // Code evaluated in a sandbox uses (and pushes) a separate JSContext.
+  // Make sure that we don't run into an assertion caused by a cx stack
+  // mismatch with the cx stashed in the closure.
+  try {
+    var sb = Components.utils.Sandbox("http://www.example.com");
+    sb.fn = fn_v_t(function() {sb.foo = {};});
+    Components.utils.evalInSandbox("fn();", sb);
+  } catch (e) {} // Components not available in workers.
+
   // Make sure that a void callback can't return an error sentinel.
   var sentinelThrew = false;
   try {
   fn_v_t(function() {}, null, -1);
   } catch(e) {
     sentinelThrew = true;
   }
   do_check_true(sentinelThrew);
--- a/xpcom/idl-parser/header.py
+++ b/xpcom/idl-parser/header.py
@@ -533,10 +533,8 @@ if __name__ == '__main__':
             try:
                 os.makedirs(dirname)
             except:
                 pass
         depfd = open(options.depfile, 'w')
         deps = [dep.replace('\\', '/') for dep in idl.deps]
 
         print >>depfd, "%s: %s" % (options.outfile, " ".join(deps))
-        for dep in deps:
-            print >>depfd, "%s:" % dep