Commit a2ea3574 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

Fix -Wshadow warnings by making OptimizationMarker an enum class

Bug: v8:12244,v8:12245
Change-Id: I7de616f87dcec7ebaa51af10390c2685650633d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3266004Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77781}
parent dd3234bc
......@@ -892,7 +892,7 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ cmp_raw_immediate(actual_marker, expected_marker);
__ cmp_raw_immediate(actual_marker, static_cast<int>(expected_marker));
__ b(ne, &no_match);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
......
......@@ -1083,7 +1083,8 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ CompareAndBranch(actual_marker, Operand(expected_marker), ne, &no_match);
__ CompareAndBranch(actual_marker, Operand(static_cast<int>(expected_marker)),
ne, &no_match);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
}
......
......@@ -34,7 +34,9 @@ void LazyBuiltinsAssembler::TailCallRuntimeIfMarkerEquals(
TNode<Uint32T> marker, OptimizationMarker expected_marker,
Runtime::FunctionId function_id, TNode<JSFunction> function) {
Label no_match(this);
GotoIfNot(Word32Equal(marker, Uint32Constant(expected_marker)), &no_match);
GotoIfNot(Word32Equal(marker,
Uint32Constant(static_cast<uint32_t>(expected_marker))),
&no_match);
GenerateTailCallToReturnedCode(function_id, function);
BIND(&no_match);
}
......
......@@ -837,7 +837,7 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ cmp(actual_marker, expected_marker);
__ cmp(actual_marker, static_cast<int>(expected_marker));
__ j(not_equal, &no_match, Label::kNear);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
......
......@@ -871,7 +871,8 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
OptimizationMarker expected_marker,
Runtime::FunctionId function_id) {
Label no_match;
__ Branch(&no_match, ne, actual_marker, Operand(expected_marker));
__ Branch(&no_match, ne, actual_marker,
Operand(static_cast<int>(expected_marker)));
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
}
......
......@@ -865,7 +865,8 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ Branch(&no_match, ne, actual_marker, Operand(expected_marker));
__ Branch(&no_match, ne, actual_marker,
Operand(static_cast<int>(expected_marker)));
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
}
......
......@@ -876,7 +876,8 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
OptimizationMarker expected_marker,
Runtime::FunctionId function_id) {
Label no_match;
__ Branch(&no_match, ne, actual_marker, Operand(expected_marker));
__ Branch(&no_match, ne, actual_marker,
Operand(static_cast<int>(expected_marker)));
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
}
......
......@@ -856,7 +856,7 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
OptimizationMarker expected_marker,
Runtime::FunctionId function_id) {
Label no_match;
__ cmpi(actual_marker, Operand(expected_marker));
__ cmpi(actual_marker, Operand(static_cast<int>(expected_marker)));
__ bne(&no_match);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
......
......@@ -921,8 +921,8 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ Branch(&no_match, ne, actual_marker, Operand(expected_marker),
Label::Distance::kNear);
__ Branch(&no_match, ne, actual_marker,
Operand(static_cast<int>(expected_marker)), Label::Distance::kNear);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
}
......
......@@ -951,7 +951,7 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
OptimizationMarker expected_marker,
Runtime::FunctionId function_id) {
Label no_match;
__ CmpS64(actual_marker, Operand(expected_marker));
__ CmpS64(actual_marker, Operand(static_cast<int>(expected_marker)));
__ bne(&no_match);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
......
......@@ -948,7 +948,7 @@ static void TailCallRuntimeIfMarkerEquals(MacroAssembler* masm,
Runtime::FunctionId function_id) {
ASM_CODE_COMMENT(masm);
Label no_match;
__ Cmp(actual_marker, expected_marker);
__ Cmp(actual_marker, static_cast<int>(expected_marker));
__ j(not_equal, &no_match);
GenerateTailCallToReturnedCode(masm, function_id);
__ bind(&no_match);
......
......@@ -1620,7 +1620,7 @@ inline std::ostream& operator<<(std::ostream& os,
using FileAndLine = std::pair<const char*, int>;
enum OptimizationMarker : int32_t {
enum class OptimizationMarker : int32_t {
// These values are set so that it is easy to check if there is a marker where
// some processing needs to be done.
kNone = 0b000,
......@@ -1633,8 +1633,11 @@ enum OptimizationMarker : int32_t {
// For kNone or kInOptimizationQueue we don't need any special processing.
// To check both cases using a single mask, we expect the kNone to be 0 and
// kInOptimizationQueue to be 1 so that we can mask off the lsb for checking.
STATIC_ASSERT(kNone == 0b000 && kInOptimizationQueue == 0b001);
STATIC_ASSERT(kLastOptimizationMarker <= 0b111);
STATIC_ASSERT(static_cast<int>(OptimizationMarker::kNone) == 0b000 &&
static_cast<int>(OptimizationMarker::kInOptimizationQueue) ==
0b001);
STATIC_ASSERT(static_cast<int>(OptimizationMarker::kLastOptimizationMarker) <=
0b111);
static constexpr uint32_t kNoneOrInOptimizationQueueMask = 0b110;
inline bool IsInOptimizationQueueMarker(OptimizationMarker marker) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment