Remove more uses of the deprecated EnumSet template class.
authorbmeurer <bmeurer@chromium.org>
Fri, 10 Jul 2015 09:34:56 +0000 (02:34 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 10 Jul 2015 09:35:11 +0000 (09:35 +0000)
EnumtSet has been deprecated for quite some time, and replaced with the
more general and type safe base::Flags template class.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1229233002

Cr-Commit-Position: refs/heads/master@{#29564}

src/ast-numbering.cc
src/ast.h
src/compiler.cc
src/compiler/ast-graph-builder.cc
src/objects.cc
src/x64/full-codegen-x64.cc
src/x64/macro-assembler-x64.cc
src/x64/macro-assembler-x64.h
test/cctest/test-macro-assembler-x64.cc

index ab8a6b281c45be49576fd85d809195d4a2ec21c6..bf0f9ba2a46f4788b43b3a1af5e48dbe7b781e52 100644 (file)
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "src/v8.h"
-
 #include "src/ast.h"
 #include "src/ast-numbering.h"
 #include "src/scopes.h"
@@ -11,7 +9,6 @@
 namespace v8 {
 namespace internal {
 
-
 class AstNumberingVisitor final : public AstVisitor {
  public:
   explicit AstNumberingVisitor(Isolate* isolate, Zone* zone)
@@ -46,7 +43,7 @@ class AstNumberingVisitor final : public AstVisitor {
 
   void IncrementNodeCount() { properties_.add_node_count(1); }
   void DisableSelfOptimization() {
-    properties_.flags()->Add(kDontSelfOptimize);
+    properties_.flags() |= AstProperties::kDontSelfOptimize;
   }
   void DisableOptimization(BailoutReason reason) {
     dont_optimize_reason_ = reason;
@@ -54,10 +51,11 @@ class AstNumberingVisitor final : public AstVisitor {
   }
   void DisableCrankshaft(BailoutReason reason) {
     if (FLAG_turbo_shipping) {
-      return properties_.flags()->Add(kDontCrankshaft);
+      properties_.flags() |= AstProperties::kDontCrankshaft;
+    } else {
+      dont_optimize_reason_ = reason;
+      DisableSelfOptimization();
     }
-    dont_optimize_reason_ = reason;
-    DisableSelfOptimization();
   }
 
   template <typename Node>
index e5842c292e57b139f7073dd3f05c9508aa2db411..a6a06269cb3385a333f08a8b7a52a5b3903e2af0 100644 (file)
--- a/src/ast.h
+++ b/src/ast.h
@@ -10,6 +10,7 @@
 #include "src/assembler.h"
 #include "src/ast-value-factory.h"
 #include "src/bailout-reason.h"
+#include "src/base/flags.h"
 #include "src/factory.h"
 #include "src/isolate.h"
 #include "src/jsregexp.h"
@@ -137,9 +138,6 @@ typedef ZoneList<Handle<Object>> ZoneObjectList;
   friend class AstNodeFactory;
 
 
-enum AstPropertiesFlag { kDontSelfOptimize, kDontCrankshaft };
-
-
 class FeedbackVectorRequirements {
  public:
   FeedbackVectorRequirements(int slots, int ic_slots)
@@ -175,11 +173,18 @@ typedef List<VariableICSlotPair> ICSlotCache;
 
 class AstProperties final BASE_EMBEDDED {
  public:
-  class Flags : public EnumSet<AstPropertiesFlag, int> {};
+  enum Flag {
+    kNoFlags = 0,
+    kDontSelfOptimize = 1 << 0,
+    kDontCrankshaft = 1 << 1
+  };
+
+  typedef base::Flags<Flag> Flags;
 
   explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {}
 
-  Flags* flags() { return &flags_; }
+  Flags& flags() { return flags_; }
+  Flags flags() const { return flags_; }
   int node_count() { return node_count_; }
   void add_node_count(int count) { node_count_ += count; }
 
@@ -197,6 +202,8 @@ class AstProperties final BASE_EMBEDDED {
   ZoneFeedbackVectorSpec spec_;
 };
 
+DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags)
+
 
 class AstNode: public ZoneObject {
  public:
@@ -2587,7 +2594,7 @@ class FunctionLiteral final : public Expression {
   FunctionKind kind() const { return FunctionKindBits::decode(bitfield_); }
 
   int ast_node_count() { return ast_properties_.node_count(); }
-  AstProperties::Flags* flags() { return ast_properties_.flags(); }
+  AstProperties::Flags flags() const { return ast_properties_.flags(); }
   void set_ast_properties(AstProperties* ast_properties) {
     ast_properties_ = *ast_properties;
   }
index fbe885fe1c948dfb0c6504052a8b01f3d405f349..c4c3b4f106cfc1ce3307666a88be8a4bcdf507c9 100644 (file)
@@ -203,7 +203,8 @@ Code::Flags CompilationInfo::flags() const {
 // profiler, so they trigger their own optimization when they're called
 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
 bool CompilationInfo::ShouldSelfOptimize() {
-  return FLAG_crankshaft && !function()->flags()->Contains(kDontSelfOptimize) &&
+  return FLAG_crankshaft &&
+         !(function()->flags() & AstProperties::kDontSelfOptimize) &&
          !function()->dont_optimize() &&
          function()->scope()->AllowsLazyCompilation() &&
          (!has_shared_info() || !shared_info()->optimization_disabled());
@@ -753,7 +754,8 @@ static bool Renumber(ParseInfo* parse_info) {
     FunctionLiteral* lit = parse_info->function();
     shared_info->set_ast_node_count(lit->ast_node_count());
     MaybeDisableOptimization(shared_info, lit->dont_optimize_reason());
-    shared_info->set_dont_crankshaft(lit->flags()->Contains(kDontCrankshaft));
+    shared_info->set_dont_crankshaft(lit->flags() &
+                                     AstProperties::kDontCrankshaft);
   }
   return true;
 }
index 341aedc09910e393ea375c32184e62d981dee77a..4c76b76881f4f298544bd1fb55b9fd77374b5024 100644 (file)
@@ -3014,7 +3014,7 @@ VectorSlotPair AstGraphBuilder::CreateVectorSlotPair(
 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) {
   DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode());
   bool found_eval_scope = false;
-  EnumSet<int, uint32_t> check_depths;
+  uint32_t check_depths = 0;
   for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) {
     if (s->num_heap_slots() <= 0) continue;
     // TODO(mstarzinger): If we have reached an eval scope, we check all
@@ -3026,15 +3026,15 @@ uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) {
     if (depth > DynamicGlobalAccess::kMaxCheckDepth) {
       return DynamicGlobalAccess::kFullCheckRequired;
     }
-    check_depths.Add(depth);
+    check_depths |= 1 << depth;
   }
-  return check_depths.ToIntegral();
+  return check_depths;
 }
 
 
 uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) {
   DCHECK_EQ(DYNAMIC_LOCAL, variable->mode());
-  EnumSet<int, uint32_t> check_depths;
+  uint32_t check_depths = 0;
   for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) {
     if (s->num_heap_slots() <= 0) continue;
     if (!s->calls_sloppy_eval() && s != variable->scope()) continue;
@@ -3042,10 +3042,10 @@ uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) {
     if (depth > DynamicContextAccess::kMaxCheckDepth) {
       return DynamicContextAccess::kFullCheckRequired;
     }
-    check_depths.Add(depth);
+    check_depths |= 1 << depth;
     if (s == variable->scope()) break;
   }
-  return check_depths.ToIntegral();
+  return check_depths;
 }
 
 
index 874c775180de335ef7d8b816dc469e0a3699ece9..d1488dd9d03ca8cb67f33841a7f38c33e9965ec3 100644 (file)
@@ -10620,8 +10620,8 @@ void SharedFunctionInfo::InitFromFunctionLiteral(
   if (lit->dont_optimize_reason() != kNoReason) {
     shared_info->DisableOptimization(lit->dont_optimize_reason());
   }
-  shared_info->set_dont_crankshaft(
-      lit->flags()->Contains(AstPropertiesFlag::kDontCrankshaft));
+  shared_info->set_dont_crankshaft(lit->flags() &
+                                   AstProperties::kDontCrankshaft);
   shared_info->set_kind(lit->kind());
   shared_info->set_needs_home_object(lit->scope()->NeedsHomeObject());
   shared_info->set_asm_function(lit->scope()->asm_function());
index f5939357ccaf9889ce20c2d7bd4c93c6df5e3937..eac70192053b5a430d9a982f97ab5f101cd41fa3 100644 (file)
@@ -4974,13 +4974,15 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
       }
     }
 
-    SmiOperationExecutionMode mode;
-    mode.Add(PRESERVE_SOURCE_REGISTER);
-    mode.Add(BAILOUT_ON_NO_OVERFLOW);
+    SmiOperationConstraints constraints =
+        SmiOperationConstraint::kPreserveSourceRegister |
+        SmiOperationConstraint::kBailoutOnNoOverflow;
     if (expr->op() == Token::INC) {
-      __ SmiAddConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
+      __ SmiAddConstant(rax, rax, Smi::FromInt(1), constraints, &done,
+                        Label::kNear);
     } else {
-      __ SmiSubConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
+      __ SmiSubConstant(rax, rax, Smi::FromInt(1), constraints, &done,
+                        Label::kNear);
     }
     __ jmp(&stub_call, Label::kNear);
     __ bind(&slow);
index 092b5bc83d3a9e2d210754b8254c01bb5cab5e2d..c3d182478d968b3a411b9543eca189dc71bbb2bd 100644 (file)
@@ -1380,10 +1380,8 @@ void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) {
 }
 
 
-void MacroAssembler::SmiAddConstant(Register dst,
-                                    Register src,
-                                    Smi* constant,
-                                    SmiOperationExecutionMode mode,
+void MacroAssembler::SmiAddConstant(Register dst, Register src, Smi* constant,
+                                    SmiOperationConstraints constraints,
                                     Label* bailout_label,
                                     Label::Distance near_jump) {
   if (constant->value() == 0) {
@@ -1394,12 +1392,12 @@ void MacroAssembler::SmiAddConstant(Register dst,
     DCHECK(!dst.is(kScratchRegister));
     LoadSmiConstant(kScratchRegister, constant);
     addp(dst, kScratchRegister);
-    if (mode.Contains(BAILOUT_ON_NO_OVERFLOW)) {
+    if (constraints & SmiOperationConstraint::kBailoutOnNoOverflow) {
       j(no_overflow, bailout_label, near_jump);
-      DCHECK(mode.Contains(PRESERVE_SOURCE_REGISTER));
+      DCHECK(constraints & SmiOperationConstraint::kPreserveSourceRegister);
       subp(dst, kScratchRegister);
-    } else if (mode.Contains(BAILOUT_ON_OVERFLOW)) {
-      if (mode.Contains(PRESERVE_SOURCE_REGISTER)) {
+    } else if (constraints & SmiOperationConstraint::kBailoutOnOverflow) {
+      if (constraints & SmiOperationConstraint::kPreserveSourceRegister) {
         Label done;
         j(no_overflow, &done, Label::kNear);
         subp(dst, kScratchRegister);
@@ -1410,11 +1408,11 @@ void MacroAssembler::SmiAddConstant(Register dst,
         j(overflow, bailout_label, near_jump);
       }
     } else {
-      CHECK(mode.IsEmpty());
+      UNREACHABLE();
     }
   } else {
-    DCHECK(mode.Contains(PRESERVE_SOURCE_REGISTER));
-    DCHECK(mode.Contains(BAILOUT_ON_OVERFLOW));
+    DCHECK(constraints & SmiOperationConstraint::kPreserveSourceRegister);
+    DCHECK(constraints & SmiOperationConstraint::kBailoutOnOverflow);
     LoadSmiConstant(dst, constant);
     addp(dst, src);
     j(overflow, bailout_label, near_jump);
@@ -1446,10 +1444,8 @@ void MacroAssembler::SmiSubConstant(Register dst, Register src, Smi* constant) {
 }
 
 
-void MacroAssembler::SmiSubConstant(Register dst,
-                                    Register src,
-                                    Smi* constant,
-                                    SmiOperationExecutionMode mode,
+void MacroAssembler::SmiSubConstant(Register dst, Register src, Smi* constant,
+                                    SmiOperationConstraints constraints,
                                     Label* bailout_label,
                                     Label::Distance near_jump) {
   if (constant->value() == 0) {
@@ -1460,12 +1456,12 @@ void MacroAssembler::SmiSubConstant(Register dst,
     DCHECK(!dst.is(kScratchRegister));
     LoadSmiConstant(kScratchRegister, constant);
     subp(dst, kScratchRegister);
-    if (mode.Contains(BAILOUT_ON_NO_OVERFLOW)) {
+    if (constraints & SmiOperationConstraint::kBailoutOnNoOverflow) {
       j(no_overflow, bailout_label, near_jump);
-      DCHECK(mode.Contains(PRESERVE_SOURCE_REGISTER));
+      DCHECK(constraints & SmiOperationConstraint::kPreserveSourceRegister);
       addp(dst, kScratchRegister);
-    } else if (mode.Contains(BAILOUT_ON_OVERFLOW)) {
-      if (mode.Contains(PRESERVE_SOURCE_REGISTER)) {
+    } else if (constraints & SmiOperationConstraint::kBailoutOnOverflow) {
+      if (constraints & SmiOperationConstraint::kPreserveSourceRegister) {
         Label done;
         j(no_overflow, &done, Label::kNear);
         addp(dst, kScratchRegister);
@@ -1476,11 +1472,11 @@ void MacroAssembler::SmiSubConstant(Register dst,
         j(overflow, bailout_label, near_jump);
       }
     } else {
-      CHECK(mode.IsEmpty());
+      UNREACHABLE();
     }
   } else {
-    DCHECK(mode.Contains(PRESERVE_SOURCE_REGISTER));
-    DCHECK(mode.Contains(BAILOUT_ON_OVERFLOW));
+    DCHECK(constraints & SmiOperationConstraint::kPreserveSourceRegister);
+    DCHECK(constraints & SmiOperationConstraint::kBailoutOnOverflow);
     if (constant->value() == Smi::kMinValue) {
       DCHECK(!dst.is(kScratchRegister));
       movp(dst, src);
index 0016d99321e86168433fa0295493d6110aa1eae5..c1eda2a1de95e716cb9983c9497c26dff1f949c7 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "src/assembler.h"
 #include "src/bailout-reason.h"
+#include "src/base/flags.h"
 #include "src/frames.h"
 #include "src/globals.h"
 
@@ -32,21 +33,15 @@ enum PointersToHereCheck {
   kPointersToHereAreAlwaysInteresting
 };
 
-enum SmiOperationConstraint {
-  PRESERVE_SOURCE_REGISTER,
-  BAILOUT_ON_NO_OVERFLOW,
-  BAILOUT_ON_OVERFLOW,
-  NUMBER_OF_CONSTRAINTS
+enum class SmiOperationConstraint {
+  kPreserveSourceRegister = 1 << 0,
+  kBailoutOnNoOverflow = 1 << 1,
+  kBailoutOnOverflow = 1 << 2
 };
 
-STATIC_ASSERT(NUMBER_OF_CONSTRAINTS <= 8);
+typedef base::Flags<SmiOperationConstraint> SmiOperationConstraints;
 
-class SmiOperationExecutionMode : public EnumSet<SmiOperationConstraint, byte> {
- public:
-  SmiOperationExecutionMode() : EnumSet<SmiOperationConstraint, byte>(0) { }
-  explicit SmiOperationExecutionMode(byte bits)
-      : EnumSet<SmiOperationConstraint, byte>(bits) { }
-};
+DEFINE_OPERATORS_FOR_FLAGS(SmiOperationConstraints)
 
 #ifdef DEBUG
 bool AreAliased(Register reg1,
@@ -546,11 +541,8 @@ class MacroAssembler: public Assembler {
 
   // Add an integer constant to a tagged smi, giving a tagged smi as result,
   // or jumping to a label if the result cannot be represented by a smi.
-  void SmiAddConstant(Register dst,
-                      Register src,
-                      Smi* constant,
-                      SmiOperationExecutionMode mode,
-                      Label* bailout_label,
+  void SmiAddConstant(Register dst, Register src, Smi* constant,
+                      SmiOperationConstraints constraints, Label* bailout_label,
                       Label::Distance near_jump = Label::kFar);
 
   // Subtract an integer constant from a tagged smi, giving a tagged smi as
@@ -560,11 +552,8 @@ class MacroAssembler: public Assembler {
 
   // Subtract an integer constant from a tagged smi, giving a tagged smi as
   // result, or jumping to a label if the result cannot be represented by a smi.
-  void SmiSubConstant(Register dst,
-                      Register src,
-                      Smi* constant,
-                      SmiOperationExecutionMode mode,
-                      Label* bailout_label,
+  void SmiSubConstant(Register dst, Register src, Smi* constant,
+                      SmiOperationConstraints constraints, Label* bailout_label,
                       Label::Distance near_jump = Label::kFar);
 
   // Negating a smi can give a negative zero or too large positive value.
index 4ff8cba68b80626d08be80b8b868c5c6a6a527c0..4cc52a11e2e1b9c9d14509fcd45bd179ff83fed0 100644 (file)
@@ -736,28 +736,27 @@ static void SmiAddTest(MacroAssembler* masm,
   __ movl(rcx, Immediate(first));
   __ Integer32ToSmi(rcx, rcx);
 
-  i::SmiOperationExecutionMode mode;
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  i::SmiOperationConstraints constraints =
+      i::SmiOperationConstraint::kPreserveSourceRegister |
+      i::SmiOperationConstraint::kBailoutOnOverflow;
   __ incq(rax);
-  __ SmiAddConstant(r9, rcx, Smi::FromInt(second), mode, exit);
+  __ SmiAddConstant(r9, rcx, Smi::FromInt(second), constraints, exit);
   __ cmpq(r9, r8);
   __ j(not_equal, exit);
 
   __ incq(rax);
-  __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), mode, exit);
+  __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), constraints, exit);
   __ cmpq(rcx, r8);
   __ j(not_equal, exit);
 
   __ movl(rcx, Immediate(first));
   __ Integer32ToSmi(rcx, rcx);
 
-  mode.RemoveAll();
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_NO_OVERFLOW);
+  constraints = i::SmiOperationConstraint::kPreserveSourceRegister |
+                i::SmiOperationConstraint::kBailoutOnNoOverflow;
   Label done;
   __ incq(rax);
-  __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), mode, &done);
+  __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), constraints, &done);
   __ jmp(exit);
   __ bind(&done);
   __ cmpq(rcx, r8);
@@ -799,14 +798,14 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
     __ j(not_equal, exit);
   }
 
-  i::SmiOperationExecutionMode mode;
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  i::SmiOperationConstraints constraints =
+      i::SmiOperationConstraint::kPreserveSourceRegister |
+      i::SmiOperationConstraint::kBailoutOnOverflow;
   __ movq(rcx, r11);
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiAddConstant(r9, rcx, Smi::FromInt(y_min), mode, &overflow_ok);
+    __ SmiAddConstant(r9, rcx, Smi::FromInt(y_min), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -817,7 +816,7 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiAddConstant(rcx, rcx, Smi::FromInt(y_min), mode, &overflow_ok);
+    __ SmiAddConstant(rcx, rcx, Smi::FromInt(y_min), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -853,7 +852,7 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiAddConstant(r9, rcx, Smi::FromInt(y_max), mode, &overflow_ok);
+    __ SmiAddConstant(r9, rcx, Smi::FromInt(y_max), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -861,12 +860,11 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
     __ j(not_equal, exit);
   }
 
-  mode.RemoveAll();
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  constraints = i::SmiOperationConstraint::kBailoutOnOverflow;
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiAddConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok);
+    __ SmiAddConstant(rcx, rcx, Smi::FromInt(y_max), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -952,28 +950,27 @@ static void SmiSubTest(MacroAssembler* masm,
   __ cmpq(rcx, r8);
   __ j(not_equal, exit);
 
-  i::SmiOperationExecutionMode mode;
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  i::SmiOperationConstraints constraints =
+      i::SmiOperationConstraint::kPreserveSourceRegister |
+      i::SmiOperationConstraint::kBailoutOnOverflow;
   __ Move(rcx, Smi::FromInt(first));
   __ incq(rax);  // Test 4.
-  __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, exit);
+  __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), constraints, exit);
   __ cmpq(rcx, r8);
   __ j(not_equal, exit);
 
   __ Move(rcx, Smi::FromInt(first));
   __ incq(rax);  // Test 5.
-  __ SmiSubConstant(r9, rcx, Smi::FromInt(second), mode, exit);
+  __ SmiSubConstant(r9, rcx, Smi::FromInt(second), constraints, exit);
   __ cmpq(r9, r8);
   __ j(not_equal, exit);
 
-  mode.RemoveAll();
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_NO_OVERFLOW);
+  constraints = i::SmiOperationConstraint::kPreserveSourceRegister |
+                i::SmiOperationConstraint::kBailoutOnNoOverflow;
   __ Move(rcx, Smi::FromInt(first));
   Label done;
   __ incq(rax);  // Test 6.
-  __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, &done);
+  __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), constraints, &done);
   __ jmp(exit);
   __ bind(&done);
   __ cmpq(rcx, r8);
@@ -1015,15 +1012,15 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
     __ j(not_equal, exit);
   }
 
-  i::SmiOperationExecutionMode mode;
-  mode.Add(i::PRESERVE_SOURCE_REGISTER);
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  i::SmiOperationConstraints constraints =
+      i::SmiOperationConstraint::kPreserveSourceRegister |
+      i::SmiOperationConstraint::kBailoutOnOverflow;
 
   __ movq(rcx, r11);
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiSubConstant(r9, rcx, Smi::FromInt(y_min), mode, &overflow_ok);
+    __ SmiSubConstant(r9, rcx, Smi::FromInt(y_min), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -1034,7 +1031,7 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), mode, &overflow_ok);
+    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -1070,7 +1067,7 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok);
+    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);
@@ -1078,13 +1075,12 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
     __ j(not_equal, exit);
   }
 
-  mode.RemoveAll();
-  mode.Add(i::BAILOUT_ON_OVERFLOW);
+  constraints = i::SmiOperationConstraint::kBailoutOnOverflow;
   __ movq(rcx, r11);
   {
     Label overflow_ok;
     __ incq(rax);
-    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok);
+    __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), constraints, &overflow_ok);
     __ jmp(exit);
     __ bind(&overflow_ok);
     __ incq(rax);