Backed out changeset 3a7ba1ce51d6 (bug 1275033)
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 26 May 2016 11:02:47 +0100
changeset 299119 0f9c0cf0905b749ab833d6295f0748e0f24a5c43
parent 299118 3dd0686489c6a7ca3a7958e557beea5bb74a89c7
child 299120 432400265fed0d1b578877a181f45bc77ab2329e
push id77443
push userjcoppeard@mozilla.com
push dateThu, 26 May 2016 10:04:43 +0000
treeherdermozilla-inbound@0f9c0cf0905b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1275033
milestone49.0a1
backs out3a7ba1ce51d6be815e7ff170025349176ef25cf4
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
Backed out changeset 3a7ba1ce51d6 (bug 1275033)
js/src/jit/CodeGenerator.cpp
js/src/jit/VMFunctions.cpp
js/src/jscompartment.cpp
js/src/jscompartment.h
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -3465,30 +3465,18 @@ CodeGenerator::emitPostWriteBarrier(Regi
     AllocatableGeneralRegisterSet regs(GeneralRegisterSet::Volatile());
     regs.takeUnchecked(objreg);
     EmitPostWriteBarrier(masm, objreg, false, regs);
 }
 
 void
 CodeGenerator::visitOutOfLineCallPostWriteBarrier(OutOfLineCallPostWriteBarrier* ool)
 {
+    saveLiveVolatile(ool->lir());
     const LAllocation* obj = ool->object();
-
-    // Check whether the object is a global that we have already barriered
-    // before calling into the VM.
-    if (obj->isConstant()) {
-        JSObject* object = &obj->toConstant()->toObject();
-        if (object->is<GlobalObject>()) {
-            JSCompartment* comp = object->compartment();
-            AbsoluteAddress addr(&comp->globalWriteBarriered);
-            masm.branch32(Assembler::NotEqual, addr, Imm32(0), ool->rejoin());
-        }
-    }
-
-    saveLiveVolatile(ool->lir());
     emitPostWriteBarrier(obj);
     restoreLiveVolatile(ool->lir());
 
     masm.jump(ool->rejoin());
 }
 
 template <class LPostBarrierType>
 void
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -627,17 +627,17 @@ PostWriteElementBarrier(JSRuntime* rt, J
 }
 
 void
 PostGlobalWriteBarrier(JSRuntime* rt, JSObject* obj)
 {
     MOZ_ASSERT(obj->is<GlobalObject>());
     if (!obj->compartment()->globalWriteBarriered) {
         PostWriteBarrier(rt, obj);
-        obj->compartment()->globalWriteBarriered = 1;
+        obj->compartment()->globalWriteBarriered = true;
     }
 }
 
 uint32_t
 GetIndexFromString(JSString* str)
 {
     // Masks the return value UINT32_MAX as failure to get the index.
     // I.e. it is impossible to distinguish between failing to get the index
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -58,17 +58,17 @@ JSCompartment::JSCompartment(Zone* zone,
 #endif
     global_(nullptr),
     enterCompartmentDepth(0),
     performanceMonitoring(runtime_),
     data(nullptr),
     allocationMetadataBuilder(nullptr),
     lastAnimationTime(0),
     regExps(runtime_),
-    globalWriteBarriered(0),
+    globalWriteBarriered(false),
     detachedTypedObjects(0),
     objectMetadataState(ImmediateMetadata()),
     propertyTree(thisForCtor()),
     baseShapes(zone, BaseShapeSet()),
     initialShapes(zone, InitialShapeSet()),
     selfHostingScriptSource(nullptr),
     objectMetadataTable(nullptr),
     lazyArrayBuffers(nullptr),
@@ -675,17 +675,17 @@ JSCompartment::traceRoots(JSTracer* trc,
 
     if (nonSyntacticLexicalScopes_)
         nonSyntacticLexicalScopes_->trace(trc);
 }
 
 void
 JSCompartment::sweepAfterMinorGC()
 {
-    globalWriteBarriered = 0;
+    globalWriteBarriered = false;
 
     if (innerViews.needsSweepAfterMinorGC())
         innerViews.sweepAfterMinorGC();
 }
 
 void
 JSCompartment::sweepInnerViews()
 {
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -422,20 +422,20 @@ struct JSCompartment
     int64_t                      lastAnimationTime;
 
     js::RegExpCompartment        regExps;
 
     /*
      * For generational GC, record whether a write barrier has added this
      * compartment's global to the store buffer since the last minor GC.
      *
-     * This is used to avoid calling into the VM every time a nursery object is
-     * written to a property of the global.
+     * This is used to avoid adding it to the store buffer on every write, which
+     * can quickly fill the buffer and also cause performance problems.
      */
-    uint32_t                     globalWriteBarriered;
+    bool                         globalWriteBarriered;
 
     // Non-zero if the storage underlying any typed object in this compartment
     // might be detached.
     int32_t                      detachedTypedObjects;
 
   private:
     friend class js::AutoSetNewObjectMetadata;
     js::NewObjectMetadataState objectMetadataState;