[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 21/36: Bug 1791363 - Rename GCMarker::color to avoid confusion with local variables r=sfink a=RyanVM



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to annotated tag FIREFOX_102_4_0esr_BUILD1
in repository tor-browser.

commit aa76591919e4600449de9b0365d4b5d6958872fd
Author: Jon Coppeard <jcoppeard@xxxxxxxxxxx>
AuthorDate: Wed Sep 21 08:37:14 2022 +0000

    Bug 1791363 - Rename GCMarker::color to avoid confusion with local variables r=sfink a=RyanVM
    
    It's pretty confusing that this name is sometimes used for local variables and
    sometimes refers to the current mark color.
    
    Depends on D157733
    
    Differential Revision: https://phabricator.services.mozilla.com/D157734
---
 js/src/gc/GCMarker.h  |  6 +++---
 js/src/gc/Marking.cpp | 18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/js/src/gc/GCMarker.h b/js/src/gc/GCMarker.h
index 7c93b6330c13..7f1382d82764 100644
--- a/js/src/gc/GCMarker.h
+++ b/js/src/gc/GCMarker.h
@@ -311,7 +311,7 @@ class GCMarker final : public JSTracer {
    * objects that are still reachable.
    */
   void setMarkColor(gc::MarkColor newColor);
-  gc::MarkColor markColor() const { return color; }
+  gc::MarkColor markColor() const { return markColor_; }
 
   bool enterWeakMarkingMode();
   void leaveWeakMarkingMode();
@@ -475,8 +475,8 @@ class GCMarker final : public JSTracer {
   /* Stack entries at positions below this are considered gray. */
   MainThreadOrGCTaskData<size_t> grayPosition;
 
-  /* The color is only applied to objects and functions. */
-  MainThreadOrGCTaskData<gc::MarkColor> color;
+  /* The current mark color. This is only applied to objects and functions. */
+  MainThreadOrGCTaskData<gc::MarkColor> markColor_;
 
   /* Pointer to the top of the stack of arenas we are delaying marking on. */
   MainThreadOrGCTaskData<js::gc::Arena*> delayedMarkingList;
diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp
index ab2f79b4e7ed..45eb832344b0 100644
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -2373,7 +2373,7 @@ GCMarker::GCMarker(JSRuntime* rt)
                                 JS::WeakEdgeTraceAction::Skip)),
       stack(),
       grayPosition(0),
-      color(MarkColor::Black),
+      markColor_(MarkColor::Black),
       delayedMarkingList(nullptr),
       delayedMarkingWorkAdded(false),
       state(MarkingState::NotActive),
@@ -2402,7 +2402,7 @@ bool GCMarker::isDrained() {
 void GCMarker::start() {
   MOZ_ASSERT(state == MarkingState::NotActive);
   state = MarkingState::RegularMarking;
-  color = MarkColor::Black;
+  markColor_ = MarkColor::Black;
 
 #ifdef DEBUG
   queuePos = 0;
@@ -2452,7 +2452,7 @@ inline void GCMarker::forEachDelayedMarkingArena(F&& f) {
 }
 
 void GCMarker::reset() {
-  color = MarkColor::Black;
+  markColor_ = MarkColor::Black;
 
   barrierBuffer().clearAndFree();
   stack.clear();
@@ -2474,14 +2474,14 @@ void GCMarker::reset() {
 }
 
 void GCMarker::setMarkColor(gc::MarkColor newColor) {
-  if (color == newColor) {
+  if (markColor_ == newColor) {
     return;
   }
 
   MOZ_ASSERT(!hasBlackEntries());
 
-  color = newColor;
-  if (color == MarkColor::Black) {
+  markColor_ = newColor;
+  if (markColor_ == MarkColor::Black) {
     grayPosition = stack.position();
   } else {
     grayPosition = SIZE_MAX;
@@ -2621,7 +2621,7 @@ void GCMarker::delayMarkingChildren(Cell* cell) {
   }
   JS::TraceKind kind = MapAllocToTraceKind(arena->getAllocKind());
   MarkColor colorToMark =
-      TraceKindCanBeMarkedGray(kind) ? color : MarkColor::Black;
+      TraceKindCanBeMarkedGray(kind) ? markColor() : MarkColor::Black;
   if (!arena->hasDelayedMarking(colorToMark)) {
     arena->setHasDelayedMarking(colorToMark, true);
     delayedMarkingWorkAdded = true;
@@ -2630,10 +2630,10 @@ void GCMarker::delayMarkingChildren(Cell* cell) {
 
 void GCMarker::markDelayedChildren(Arena* arena) {
   JS::TraceKind kind = MapAllocToTraceKind(arena->getAllocKind());
-  MOZ_ASSERT_IF(color == MarkColor::Gray, TraceKindCanBeMarkedGray(kind));
+  MOZ_ASSERT_IF(markColor() == MarkColor::Gray, TraceKindCanBeMarkedGray(kind));
 
   for (ArenaCellIterUnderGC cell(arena); !cell.done(); cell.next()) {
-    if (cell->isMarked(color)) {
+    if (cell->isMarked(markColor())) {
       JS::TraceChildren(this, JS::GCCellPtr(cell, kind));
     }
   }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits