Bug 1510717 - Part 2: Remove unused flag ReadableStreamController::Flag_TeeBranch. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 04 Dec 2018 19:55:13 +0000
changeset 508538 a9aecbc2d273351da812e8a365485a0ea67e6bea
parent 508537 e31ab8b54aa37a2f8f6adf0f242c8c2b62e1fa55
child 508539 146b5bd178c1f3554aa9dd47854ee84e28e2c6e0
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1510717
milestone65.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 1510717 - Part 2: Remove unused flag ReadableStreamController::Flag_TeeBranch. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D13294
js/src/builtin/Stream.cpp
js/src/builtin/Stream.h
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -380,37 +380,33 @@ class TeeState : public NativeObject {
     return &getFixedSlot(Slot_CancelPromise).toObject().as<PromiseObject>();
   }
 
   ReadableStreamDefaultController* branch1() {
     ReadableStreamDefaultController* controller =
         &getFixedSlot(Slot_Branch1)
              .toObject()
              .as<ReadableStreamDefaultController>();
-    MOZ_ASSERT(controller->flags() & ReadableStreamController::Flag_TeeBranch);
     MOZ_ASSERT(controller->isTeeBranch1());
     return controller;
   }
   void setBranch1(ReadableStreamDefaultController* controller) {
-    MOZ_ASSERT(controller->flags() & ReadableStreamController::Flag_TeeBranch);
     MOZ_ASSERT(controller->isTeeBranch1());
     setFixedSlot(Slot_Branch1, ObjectValue(*controller));
   }
 
   ReadableStreamDefaultController* branch2() {
     ReadableStreamDefaultController* controller =
         &getFixedSlot(Slot_Branch2)
              .toObject()
              .as<ReadableStreamDefaultController>();
-    MOZ_ASSERT(controller->flags() & ReadableStreamController::Flag_TeeBranch);
     MOZ_ASSERT(controller->isTeeBranch2());
     return controller;
   }
   void setBranch2(ReadableStreamDefaultController* controller) {
-    MOZ_ASSERT(controller->flags() & ReadableStreamController::Flag_TeeBranch);
     MOZ_ASSERT(controller->isTeeBranch2());
     setFixedSlot(Slot_Branch2, ObjectValue(*controller));
   }
 
   static TeeState* create(JSContext* cx,
                           Handle<ReadableStream*> unwrappedStream) {
     Rooted<TeeState*> state(cx, NewBuiltinClassInstance<TeeState>(cx));
     if (!state) {
--- a/js/src/builtin/Stream.h
+++ b/js/src/builtin/Stream.h
@@ -260,21 +260,20 @@ class ReadableStreamController : public 
     SlotCount
   };
 
   enum ControllerFlags {
     Flag_Started = 1 << 0,
     Flag_Pulling = 1 << 1,
     Flag_PullAgain = 1 << 2,
     Flag_CloseRequested = 1 << 3,
-    Flag_TeeBranch = 1 << 4,
-    Flag_TeeBranch1 = 1 << 5,
-    Flag_TeeBranch2 = 1 << 6,
-    Flag_ExternalSource = 1 << 7,
-    Flag_SourceLocked = 1 << 8,
+    Flag_TeeBranch1 = 1 << 4,
+    Flag_TeeBranch2 = 1 << 5,
+    Flag_ExternalSource = 1 << 6,
+    Flag_SourceLocked = 1 << 7,
   };
 
   ReadableStream* stream() const {
     return &getFixedSlot(Slot_Stream).toObject().as<ReadableStream>();
   }
   void setStream(ReadableStream* stream) {
     setFixedSlot(Slot_Stream, ObjectValue(*stream));
   }
@@ -310,19 +309,25 @@ class ReadableStreamController : public 
   bool pulling() const { return flags() & Flag_Pulling; }
   void setPulling() { addFlags(Flag_Pulling); }
   void clearPullFlags() { removeFlags(Flag_Pulling | Flag_PullAgain); }
   bool pullAgain() const { return flags() & Flag_PullAgain; }
   void setPullAgain() { addFlags(Flag_PullAgain); }
   bool closeRequested() const { return flags() & Flag_CloseRequested; }
   void setCloseRequested() { addFlags(Flag_CloseRequested); }
   bool isTeeBranch1() const { return flags() & Flag_TeeBranch1; }
-  void setTeeBranch1() { addFlags(Flag_TeeBranch | Flag_TeeBranch1); }
+  void setTeeBranch1() {
+    MOZ_ASSERT(!isTeeBranch2());
+    addFlags(Flag_TeeBranch1);
+  }
   bool isTeeBranch2() const { return flags() & Flag_TeeBranch2; }
-  void setTeeBranch2() { addFlags(Flag_TeeBranch | Flag_TeeBranch2); }
+  void setTeeBranch2() {
+    MOZ_ASSERT(!isTeeBranch1());
+    addFlags(Flag_TeeBranch2);
+  }
   bool hasExternalSource() const { return flags() & Flag_ExternalSource; }
   bool sourceLocked() const { return flags() & Flag_SourceLocked; }
   void setSourceLocked() { addFlags(Flag_SourceLocked); }
   void clearSourceLocked() { removeFlags(Flag_SourceLocked); }
 };
 
 class ReadableStreamDefaultController : public ReadableStreamController {
  private: