Commit 8ddc260d authored by ulan's avatar ulan Committed by Commit bot

[parser, serializer] Fix more -Wsign-compare warnings.

BUG=v8:5614

Review-Url: https://codereview.chromium.org/2481013010
Cr-Commit-Position: refs/heads/master@{#40927}
parent 7b1a0484
...@@ -349,9 +349,9 @@ void Utf8ExternalStreamingStream::SearchPosition(size_t position) { ...@@ -349,9 +349,9 @@ void Utf8ExternalStreamingStream::SearchPosition(size_t position) {
// No chunks. Fetch at least one, so we can assume !chunks_.empty() below. // No chunks. Fetch at least one, so we can assume !chunks_.empty() below.
if (chunks_.empty()) { if (chunks_.empty()) {
DCHECK_EQ(current_.chunk_no, 0); DCHECK_EQ(current_.chunk_no, 0u);
DCHECK_EQ(current_.pos.bytes, 0); DCHECK_EQ(current_.pos.bytes, 0u);
DCHECK_EQ(current_.pos.chars, 0); DCHECK_EQ(current_.pos.chars, 0u);
FetchChunk(); FetchChunk();
} }
...@@ -438,7 +438,8 @@ size_t Utf8ExternalStreamingStream::FillBuffer(size_t position) { ...@@ -438,7 +438,8 @@ size_t Utf8ExternalStreamingStream::FillBuffer(size_t position) {
FillBufferFromCurrentChunk(); FillBufferFromCurrentChunk();
} }
DCHECK_EQ(current_.pos.chars - position, buffer_end_ - buffer_cursor_); DCHECK_EQ(current_.pos.chars - position,
static_cast<size_t>(buffer_end_ - buffer_cursor_));
return buffer_end_ - buffer_cursor_; return buffer_end_ - buffer_cursor_;
} }
...@@ -497,7 +498,7 @@ size_t FindChunk(Chunks& chunks, ScriptCompiler::ExternalSourceStream* source_, ...@@ -497,7 +498,7 @@ size_t FindChunk(Chunks& chunks, ScriptCompiler::ExternalSourceStream* source_,
// let's look at chunks back-to-front. // let's look at chunks back-to-front.
size_t chunk_no = chunks.size() - 1; size_t chunk_no = chunks.size() - 1;
while (chunks[chunk_no].byte_pos > position) { while (chunks[chunk_no].byte_pos > position) {
DCHECK_NE(chunk_no, 0); DCHECK_NE(chunk_no, 0u);
chunk_no--; chunk_no--;
} }
DCHECK_LE(chunks[chunk_no].byte_pos, position); DCHECK_LE(chunks[chunk_no].byte_pos, position);
...@@ -593,7 +594,7 @@ bool TwoByteExternalStreamingStream::ReadBlock() { ...@@ -593,7 +594,7 @@ bool TwoByteExternalStreamingStream::ReadBlock() {
// one_char_buffer_ to hold the full character. // one_char_buffer_ to hold the full character.
bool lonely_byte = (chunks_[chunk_no].byte_pos == (2 * position + 1)); bool lonely_byte = (chunks_[chunk_no].byte_pos == (2 * position + 1));
if (lonely_byte) { if (lonely_byte) {
DCHECK_NE(chunk_no, 0); DCHECK_NE(chunk_no, 0u);
Chunk& previous_chunk = chunks_[chunk_no - 1]; Chunk& previous_chunk = chunks_[chunk_no - 1];
#ifdef V8_TARGET_BIG_ENDIAN #ifdef V8_TARGET_BIG_ENDIAN
uc16 character = current.data[0] | uc16 character = current.data[0] |
...@@ -715,7 +716,7 @@ bool TwoByteExternalBufferedStream::ReadBlock() { ...@@ -715,7 +716,7 @@ bool TwoByteExternalBufferedStream::ReadBlock() {
size_t TwoByteExternalBufferedStream::FillBuffer(size_t position, size_t TwoByteExternalBufferedStream::FillBuffer(size_t position,
size_t chunk_no) { size_t chunk_no) {
DCHECK_EQ(chunks_[chunk_no].byte_pos % 2, 1); DCHECK_EQ(chunks_[chunk_no].byte_pos % 2, 1u);
bool odd_start = true; bool odd_start = true;
// Align buffer_pos_ to the size of the buffer. // Align buffer_pos_ to the size of the buffer.
{ {
...@@ -738,7 +739,7 @@ size_t TwoByteExternalBufferedStream::FillBuffer(size_t position, ...@@ -738,7 +739,7 @@ size_t TwoByteExternalBufferedStream::FillBuffer(size_t position,
size_t totalLength = 0; size_t totalLength = 0;
bool lonely_byte = (current->byte_pos == (2 * position + 1)); bool lonely_byte = (current->byte_pos == (2 * position + 1));
if (lonely_byte) { if (lonely_byte) {
DCHECK_NE(chunk_no, 0); DCHECK_NE(chunk_no, 0u);
Chunk& previous_chunk = chunks_[chunk_no - 1]; Chunk& previous_chunk = chunks_[chunk_no - 1];
*reinterpret_cast<uint8_t*>(buffer_) = *reinterpret_cast<uint8_t*>(buffer_) =
previous_chunk.data[previous_chunk.byte_length - 1]; previous_chunk.data[previous_chunk.byte_length - 1];
......
...@@ -59,7 +59,7 @@ void Scanner::BookmarkScope::Apply() { ...@@ -59,7 +59,7 @@ void Scanner::BookmarkScope::Apply() {
} else { } else {
scanner_->SeekNext(bookmark_); scanner_->SeekNext(bookmark_);
scanner_->Next(); scanner_->Next();
DCHECK_EQ(scanner_->location().beg_pos, bookmark_); DCHECK_EQ(scanner_->location().beg_pos, static_cast<int>(bookmark_));
} }
bookmark_ = kBookmarkWasApplied; bookmark_ = kBookmarkWasApplied;
} }
...@@ -1638,7 +1638,7 @@ void Scanner::SeekNext(size_t position) { ...@@ -1638,7 +1638,7 @@ void Scanner::SeekNext(size_t position) {
// 3, re-scan, by scanning the look-ahead char + 1 token (next_). // 3, re-scan, by scanning the look-ahead char + 1 token (next_).
c0_ = source_->Advance(); c0_ = source_->Advance();
Next(); Next();
DCHECK_EQ(next_.location.beg_pos, position); DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position));
} }
} // namespace internal } // namespace internal
......
...@@ -346,7 +346,7 @@ uchar Utf8::ValueOfIncremental(byte next, Utf8IncrementalBuffer* buffer) { ...@@ -346,7 +346,7 @@ uchar Utf8::ValueOfIncremental(byte next, Utf8IncrementalBuffer* buffer) {
} else { } else {
// Otherwise, process the previous byte and save the next byte for next // Otherwise, process the previous byte and save the next byte for next
// time. // time.
DCHECK_EQ(0, *buffer); DCHECK_EQ(0u, *buffer);
*buffer = next; *buffer = next;
return t; return t;
} }
......
...@@ -1730,7 +1730,7 @@ static Maybe<bool> SetPropertiesFromKeyValuePairs(Isolate* isolate, ...@@ -1730,7 +1730,7 @@ static Maybe<bool> SetPropertiesFromKeyValuePairs(Isolate* isolate,
MaybeHandle<Object> MaybeHandle<Object>
ValueDeserializer::ReadObjectUsingEntireBufferForLegacyFormat() { ValueDeserializer::ReadObjectUsingEntireBufferForLegacyFormat() {
DCHECK_EQ(version_, 0); DCHECK_EQ(version_, 0u);
HandleScope scope(isolate_); HandleScope scope(isolate_);
std::vector<Handle<Object>> stack; std::vector<Handle<Object>> stack;
while (position_ < end_) { while (position_ < end_) {
......
...@@ -6120,7 +6120,7 @@ TEST(ModuleParsingInternals) { ...@@ -6120,7 +6120,7 @@ TEST(ModuleParsingInternals) {
i::ModuleDescriptor* descriptor = module_scope->module(); i::ModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor); CHECK_NOT_NULL(descriptor);
CHECK_EQ(5, descriptor->module_requests().size()); CHECK_EQ(5u, descriptor->module_requests().size());
for (const auto& elem : descriptor->module_requests()) { for (const auto& elem : descriptor->module_requests()) {
if (elem.first->IsOneByteEqualTo("m.js")) if (elem.first->IsOneByteEqualTo("m.js"))
CHECK_EQ(elem.second, 0); CHECK_EQ(elem.second, 0);
...@@ -6142,7 +6142,7 @@ TEST(ModuleParsingInternals) { ...@@ -6142,7 +6142,7 @@ TEST(ModuleParsingInternals) {
CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa",
0); // !!! 0); // !!!
CHECK_EQ(8, descriptor->regular_exports().size()); CHECK_EQ(8u, descriptor->regular_exports().size());
entry = descriptor->regular_exports() entry = descriptor->regular_exports()
.find(declarations->AtForTest(3)->proxy()->raw_name()) .find(declarations->AtForTest(3)->proxy()->raw_name())
->second; ->second;
...@@ -6169,7 +6169,7 @@ TEST(ModuleParsingInternals) { ...@@ -6169,7 +6169,7 @@ TEST(ModuleParsingInternals) {
CheckEntry(entry, "foob", "foob", nullptr, -1); CheckEntry(entry, "foob", "foob", nullptr, -1);
// TODO(neis): The next lines are terrible. Find a better way. // TODO(neis): The next lines are terrible. Find a better way.
auto name_x = declarations->AtForTest(0)->proxy()->raw_name(); auto name_x = declarations->AtForTest(0)->proxy()->raw_name();
CHECK_EQ(2, descriptor->regular_exports().count(name_x)); CHECK_EQ(2u, descriptor->regular_exports().count(name_x));
auto it = descriptor->regular_exports().equal_range(name_x).first; auto it = descriptor->regular_exports().equal_range(name_x).first;
entry = it->second; entry = it->second;
if (entry->export_name->IsOneByteEqualTo("y")) { if (entry->export_name->IsOneByteEqualTo("y")) {
...@@ -6187,7 +6187,7 @@ TEST(ModuleParsingInternals) { ...@@ -6187,7 +6187,7 @@ TEST(ModuleParsingInternals) {
CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr, CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr,
4); 4);
CHECK_EQ(4, descriptor->regular_imports().size()); CHECK_EQ(4u, descriptor->regular_imports().size());
entry = descriptor->regular_imports() entry = descriptor->regular_imports()
.find(declarations->AtForTest(1)->proxy()->raw_name()) .find(declarations->AtForTest(1)->proxy()->raw_name())
->second; ->second;
......
...@@ -1962,19 +1962,19 @@ TEST(SnapshotCreatorMultipleContexts) { ...@@ -1962,19 +1962,19 @@ TEST(SnapshotCreatorMultipleContexts) {
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CompileRun("var f = function() { return 1; }"); CompileRun("var f = function() { return 1; }");
CHECK_EQ(0, creator.AddContext(context)); CHECK_EQ(0u, creator.AddContext(context));
} }
{ {
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CompileRun("var f = function() { return 2; }"); CompileRun("var f = function() { return 2; }");
CHECK_EQ(1, creator.AddContext(context)); CHECK_EQ(1u, creator.AddContext(context));
} }
{ {
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
CHECK_EQ(2, creator.AddContext(context)); CHECK_EQ(2u, creator.AddContext(context));
} }
blob = blob =
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
...@@ -2044,7 +2044,7 @@ TEST(SnapshotCreatorExternalReferences) { ...@@ -2044,7 +2044,7 @@ TEST(SnapshotCreatorExternalReferences) {
callback->GetFunction(context).ToLocalChecked(); callback->GetFunction(context).ToLocalChecked();
CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust());
ExpectInt32("f()", 42); ExpectInt32("f()", 42);
CHECK_EQ(0, creator.AddContext(context)); CHECK_EQ(0u, creator.AddContext(context));
} }
blob = blob =
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
...@@ -2104,7 +2104,7 @@ TEST(SnapshotCreatorUnknownExternalReferences) { ...@@ -2104,7 +2104,7 @@ TEST(SnapshotCreatorUnknownExternalReferences) {
CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust());
ExpectInt32("f()", 42); ExpectInt32("f()", 42);
CHECK_EQ(0, creator.AddContext(context)); CHECK_EQ(0u, creator.AddContext(context));
} }
v8::StartupData blob = v8::StartupData blob =
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
...@@ -2177,9 +2177,9 @@ TEST(SnapshotCreatorTemplates) { ...@@ -2177,9 +2177,9 @@ TEST(SnapshotCreatorTemplates) {
c->SetAlignedPointerInInternalField(1, c1); c->SetAlignedPointerInInternalField(1, c1);
CHECK(context->Global()->Set(context, v8_str("a"), a).FromJust()); CHECK(context->Global()->Set(context, v8_str("a"), a).FromJust());
CHECK_EQ(0, creator.AddContext(context)); CHECK_EQ(0u, creator.AddContext(context));
CHECK_EQ(0, creator.AddTemplate(callback)); CHECK_EQ(0u, creator.AddTemplate(callback));
CHECK_EQ(1, creator.AddTemplate(global_template)); CHECK_EQ(1u, creator.AddTemplate(global_template));
} }
blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear, blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear,
SerializeInternalFields); SerializeInternalFields);
...@@ -2248,10 +2248,10 @@ TEST(SnapshotCreatorTemplates) { ...@@ -2248,10 +2248,10 @@ TEST(SnapshotCreatorTemplates) {
InternalFieldData* c1 = reinterpret_cast<InternalFieldData*>( InternalFieldData* c1 = reinterpret_cast<InternalFieldData*>(
c->GetAlignedPointerFromInternalField(1)); c->GetAlignedPointerFromInternalField(1));
CHECK_EQ(11, a1->data); CHECK_EQ(11u, a1->data);
CHECK_EQ(20, b0->data); CHECK_EQ(20u, b0->data);
CHECK_EQ(30, c0->data); CHECK_EQ(30u, c0->data);
CHECK_EQ(31, c1->data); CHECK_EQ(31u, c1->data);
// Accessing out of bound returns empty MaybeHandle. // Accessing out of bound returns empty MaybeHandle.
CHECK(v8::ObjectTemplate::FromSnapshot(isolate, 2).IsEmpty()); CHECK(v8::ObjectTemplate::FromSnapshot(isolate, 2).IsEmpty());
......
This diff is collapsed.
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