Commit 98e06c34 authored by ulan's avatar ulan Committed by Commit bot

[ignition] Fix -Wsign-compare warnings.

BUG=v8:5614

Review-Url: https://codereview.chromium.org/2492553003
Cr-Commit-Position: refs/heads/master@{#40886}
parent 806b3504
...@@ -137,7 +137,8 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final ...@@ -137,7 +137,8 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final
uint32_t NextEquivalenceId() { uint32_t NextEquivalenceId() {
equivalence_id_++; equivalence_id_++;
CHECK_NE(equivalence_id_, kInvalidEquivalenceId); // TODO(rmcilroy): use the same type for these and remove static_cast.
CHECK_NE(static_cast<size_t>(equivalence_id_), kInvalidEquivalenceId);
return equivalence_id_; return equivalence_id_;
} }
......
...@@ -35,8 +35,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) { ...@@ -35,8 +35,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
RegisterList triple(0, 3); RegisterList triple(0, 3);
Register param = Register::FromParameterIndex(2, builder.parameter_count()); Register param = Register::FromParameterIndex(2, builder.parameter_count());
Handle<String> name = factory->NewStringFromStaticChars("abc"); Handle<String> name = factory->NewStringFromStaticChars("abc");
int name_index = 2; uint32_t name_index = 2;
int feedback_slot = 97; uint32_t feedback_slot = 97;
builder.LoadLiteral(heap_num_0) builder.LoadLiteral(heap_num_0)
.StoreAccumulatorInRegister(reg_0) .StoreAccumulatorInRegister(reg_0)
......
...@@ -70,7 +70,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForFlush) { ...@@ -70,7 +70,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForFlush) {
optimizer()->Flush(); optimizer()->Flush();
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar);
CHECK_EQ(output()->at(0).operand(0), temp.ToOperand()); CHECK_EQ(output()->at(0).operand(0), static_cast<uint32_t>(temp.ToOperand()));
} }
TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) { TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) {
...@@ -81,7 +81,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) { ...@@ -81,7 +81,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) {
optimizer()->PrepareForBytecode(Bytecode::kJump); optimizer()->PrepareForBytecode(Bytecode::kJump);
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar);
CHECK_EQ(output()->at(0).operand(0), temp.ToOperand()); CHECK_EQ(output()->at(0).operand(0), static_cast<uint32_t>(temp.ToOperand()));
} }
// Basic Register Optimizations // Basic Register Optimizations
...@@ -98,7 +98,8 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryNotEmitted) { ...@@ -98,7 +98,8 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryNotEmitted) {
CHECK_EQ(write_count(), 0); CHECK_EQ(write_count(), 0);
optimizer()->PrepareForBytecode(Bytecode::kReturn); optimizer()->PrepareForBytecode(Bytecode::kReturn);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kLdar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kLdar);
CHECK_EQ(output()->at(0).operand(0), parameter.ToOperand()); CHECK_EQ(output()->at(0).operand(0),
static_cast<uint32_t>(parameter.ToOperand()));
} }
TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) { TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
...@@ -111,7 +112,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) { ...@@ -111,7 +112,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
optimizer()->PrepareForBytecode(Bytecode::kLdaSmi); optimizer()->PrepareForBytecode(Bytecode::kLdaSmi);
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar);
CHECK_EQ(output()->at(0).operand(0), temp1.ToOperand()); CHECK_EQ(output()->at(0).operand(0),
static_cast<uint32_t>(temp1.ToOperand()));
optimizer()->DoMov(temp1, temp0, BytecodeSourceInfo()); optimizer()->DoMov(temp1, temp0, BytecodeSourceInfo());
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
ReleaseTemporaries(temp1); ReleaseTemporaries(temp1);
...@@ -121,7 +123,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) { ...@@ -121,7 +123,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
optimizer()->PrepareForBytecode(Bytecode::kReturn); optimizer()->PrepareForBytecode(Bytecode::kReturn);
CHECK_EQ(write_count(), 2); CHECK_EQ(write_count(), 2);
CHECK_EQ(output()->at(1).bytecode(), Bytecode::kLdar); CHECK_EQ(output()->at(1).bytecode(), Bytecode::kLdar);
CHECK_EQ(output()->at(1).operand(0), temp1.ToOperand()); CHECK_EQ(output()->at(1).operand(0),
static_cast<uint32_t>(temp1.ToOperand()));
} }
TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) { TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) {
...@@ -137,7 +140,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) { ...@@ -137,7 +140,8 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) {
optimizer()->Flush(); optimizer()->Flush();
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar);
CHECK_EQ(output()->at(0).operand(0), temp0.ToOperand()); CHECK_EQ(output()->at(0).operand(0),
static_cast<uint32_t>(temp0.ToOperand()));
} }
TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) { TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) {
...@@ -149,13 +153,16 @@ TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) { ...@@ -149,13 +153,16 @@ TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) {
optimizer()->DoStar(local, BytecodeSourceInfo()); optimizer()->DoStar(local, BytecodeSourceInfo());
CHECK_EQ(write_count(), 1); CHECK_EQ(write_count(), 1);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kMov); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kMov);
CHECK_EQ(output()->at(0).operand(0), parameter.ToOperand()); CHECK_EQ(output()->at(0).operand(0),
CHECK_EQ(output()->at(0).operand(1), local.ToOperand()); static_cast<uint32_t>(parameter.ToOperand()));
CHECK_EQ(output()->at(0).operand(1),
static_cast<uint32_t>(local.ToOperand()));
optimizer()->PrepareForBytecode(Bytecode::kReturn); optimizer()->PrepareForBytecode(Bytecode::kReturn);
CHECK_EQ(write_count(), 2); CHECK_EQ(write_count(), 2);
CHECK_EQ(output()->at(1).bytecode(), Bytecode::kLdar); CHECK_EQ(output()->at(1).bytecode(), Bytecode::kLdar);
CHECK_EQ(output()->at(1).operand(0), local.ToOperand()); CHECK_EQ(output()->at(1).operand(0),
static_cast<uint32_t>(local.ToOperand()));
} }
TEST_F(BytecodeRegisterOptimizerTest, SingleTemporaryNotMaterializedForInput) { TEST_F(BytecodeRegisterOptimizerTest, SingleTemporaryNotMaterializedForInput) {
...@@ -193,10 +200,13 @@ TEST_F(BytecodeRegisterOptimizerTest, RangeOfTemporariesMaterializedForInput) { ...@@ -193,10 +200,13 @@ TEST_F(BytecodeRegisterOptimizerTest, RangeOfTemporariesMaterializedForInput) {
CHECK_EQ(2, reg_list.register_count()); CHECK_EQ(2, reg_list.register_count());
CHECK_EQ(write_count(), 2); CHECK_EQ(write_count(), 2);
CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar);
CHECK_EQ(output()->at(0).operand(0), temp0.ToOperand()); CHECK_EQ(output()->at(0).operand(0),
static_cast<uint32_t>(temp0.ToOperand()));
CHECK_EQ(output()->at(1).bytecode(), Bytecode::kMov); CHECK_EQ(output()->at(1).bytecode(), Bytecode::kMov);
CHECK_EQ(output()->at(1).operand(0), parameter.ToOperand()); CHECK_EQ(output()->at(1).operand(0),
CHECK_EQ(output()->at(1).operand(1), temp1.ToOperand()); static_cast<uint32_t>(parameter.ToOperand()));
CHECK_EQ(output()->at(1).operand(1),
static_cast<uint32_t>(temp1.ToOperand()));
} }
} // namespace interpreter } // namespace interpreter
......
...@@ -36,7 +36,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateAllEntries) { ...@@ -36,7 +36,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateAllEntries) {
} }
CHECK_EQ(builder.size(), k16BitCapacity); CHECK_EQ(builder.size(), k16BitCapacity);
for (size_t i = 0; i < k16BitCapacity; i++) { for (size_t i = 0; i < k16BitCapacity; i++) {
CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), i); CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), static_cast<int>(i));
} }
} }
...@@ -133,11 +133,12 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithIdx8Reservations) { ...@@ -133,11 +133,12 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithIdx8Reservations) {
for (size_t i = 0; i < duplicates_in_idx8_space; i++) { for (size_t i = 0; i < duplicates_in_idx8_space; i++) {
Smi* value = Smi::FromInt(static_cast<int>(2 * k8BitCapacity + i)); Smi* value = Smi::FromInt(static_cast<int>(2 * k8BitCapacity + i));
size_t index = builder.CommitReservedEntry(OperandSize::kByte, value); size_t index = builder.CommitReservedEntry(OperandSize::kByte, value);
CHECK_EQ(static_cast<int>(index), k8BitCapacity - reserved + i); CHECK_EQ(index, k8BitCapacity - reserved + i);
} }
Handle<FixedArray> constant_array = builder.ToFixedArray(isolate()); Handle<FixedArray> constant_array = builder.ToFixedArray(isolate());
CHECK_EQ(constant_array->length(), 2 * k8BitCapacity + reserved); CHECK_EQ(constant_array->length(),
static_cast<int>(2 * k8BitCapacity + reserved));
// Check all committed values match expected // Check all committed values match expected
for (size_t i = 0; i < k8BitCapacity - reserved; i++) { for (size_t i = 0; i < k8BitCapacity - reserved; i++) {
...@@ -188,7 +189,8 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithWideReservations) { ...@@ -188,7 +189,8 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithWideReservations) {
} }
Handle<FixedArray> constant_array = builder.ToFixedArray(isolate()); Handle<FixedArray> constant_array = builder.ToFixedArray(isolate());
CHECK_EQ(constant_array->length(), k8BitCapacity + reserved); CHECK_EQ(constant_array->length(),
static_cast<int>(k8BitCapacity + reserved));
for (size_t i = 0; i < k8BitCapacity + reserved; i++) { for (size_t i = 0; i < k8BitCapacity + reserved; i++) {
Object* value = constant_array->get(static_cast<int>(i)); Object* value = constant_array->get(static_cast<int>(i));
CHECK(value->SameValue(*isolate()->factory()->NewNumberFromSize(i))); CHECK(value->SameValue(*isolate()->factory()->NewNumberFromSize(i)));
...@@ -260,7 +262,8 @@ TEST_F(ConstantArrayBuilderTest, HolesWithUnusedReservations) { ...@@ -260,7 +262,8 @@ TEST_F(ConstantArrayBuilderTest, HolesWithUnusedReservations) {
CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kByte); CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kByte);
} }
for (int i = 0; i < 128; ++i) { for (int i = 0; i < 128; ++i) {
CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(i)), i); CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(i)),
static_cast<size_t>(i));
} }
CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(256)), 256); CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(256)), 256);
...@@ -326,7 +329,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithFixedReservations) { ...@@ -326,7 +329,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithFixedReservations) {
Handle<Object> empty = builder.At(i); Handle<Object> empty = builder.At(i);
CHECK(empty->SameValue(isolate()->heap()->the_hole_value())); CHECK(empty->SameValue(isolate()->heap()->the_hole_value()));
} else { } else {
CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), i); CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), static_cast<int>(i));
} }
} }
...@@ -338,7 +341,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithFixedReservations) { ...@@ -338,7 +341,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithFixedReservations) {
// Check values after reserved entries are inserted. // Check values after reserved entries are inserted.
for (size_t i = 0; i < k16BitCapacity; i++) { for (size_t i = 0; i < k16BitCapacity; i++) {
CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), i); CHECK_EQ(Handle<Smi>::cast(builder.At(i))->value(), static_cast<int>(i));
} }
} }
......
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