Commit b215c9e5 authored by oth's avatar oth Committed by Commit bot

Address compilation warnings for android build.

LOG=N
BUG=

Review-Url: https://codereview.chromium.org/2135573002
Cr-Commit-Position: refs/heads/master@{#37676}
parent 1e978ec0
...@@ -2316,7 +2316,6 @@ class RepresentationSelector { ...@@ -2316,7 +2316,6 @@ class RepresentationSelector {
OperationTyper op_typer_; // helper for the feedback typer OperationTyper op_typer_; // helper for the feedback typer
NodeInfo* GetInfo(Node* node) { NodeInfo* GetInfo(Node* node) {
DCHECK(node->id() >= 0);
DCHECK(node->id() < count_); DCHECK(node->id() < count_);
return &info_[node->id()]; return &info_[node->id()];
} }
......
...@@ -634,14 +634,13 @@ void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index, ...@@ -634,14 +634,13 @@ void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index,
size_t size, size_t size,
ZoneVector<BytecodeLabel>& targets) { ZoneVector<BytecodeLabel>& targets) {
// TODO(neis): Optimize this by using a proper jump table. // TODO(neis): Optimize this by using a proper jump table.
DCHECK_LE(start_index + size, targets.size());
for (size_t i = start_index; i < start_index + size; i++) { for (size_t i = start_index; i < start_index + size; i++) {
DCHECK(0 <= i && i < targets.size());
builder() builder()
->LoadLiteral(Smi::FromInt(static_cast<int>(i))) ->LoadLiteral(Smi::FromInt(static_cast<int>(i)))
.CompareOperation(Token::Value::EQ_STRICT, index) .CompareOperation(Token::Value::EQ_STRICT, index)
.JumpIfTrue(&(targets[i])); .JumpIfTrue(&(targets[i]));
} }
BuildAbort(BailoutReason::kInvalidJumpTableIndex); BuildAbort(BailoutReason::kInvalidJumpTableIndex);
} }
...@@ -655,8 +654,8 @@ void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, ...@@ -655,8 +654,8 @@ void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
// for these resume points, to be used inside the loop. // for these resume points, to be used inside the loop.
ZoneVector<BytecodeLabel> resume_points_in_loop(zone()); ZoneVector<BytecodeLabel> resume_points_in_loop(zone());
size_t first_yield = stmt->first_yield_id(); size_t first_yield = stmt->first_yield_id();
DCHECK_LE(first_yield + stmt->yield_count(), generator_resume_points_.size());
for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) { for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) {
DCHECK(0 <= id && id < generator_resume_points_.size());
auto& label = generator_resume_points_[id]; auto& label = generator_resume_points_[id];
resume_points_in_loop.push_back(label); resume_points_in_loop.push_back(label);
generator_resume_points_[id] = BytecodeLabel(); generator_resume_points_[id] = BytecodeLabel();
......
...@@ -162,7 +162,7 @@ class LiteralBuffer { ...@@ -162,7 +162,7 @@ class LiteralBuffer {
INLINE(void AddChar(char code_unit)) { INLINE(void AddChar(char code_unit)) {
if (position_ >= backing_store_.length()) ExpandBuffer(); if (position_ >= backing_store_.length()) ExpandBuffer();
DCHECK(is_one_byte_); DCHECK(is_one_byte_);
DCHECK(0 <= code_unit && code_unit <= kMaxAscii); DCHECK(IsValidAscii(code_unit));
backing_store_[position_] = static_cast<byte>(code_unit); backing_store_[position_] = static_cast<byte>(code_unit);
position_ += kOneByteSize; position_ += kOneByteSize;
return; return;
...@@ -251,6 +251,15 @@ class LiteralBuffer { ...@@ -251,6 +251,15 @@ class LiteralBuffer {
static const int kGrowthFactory = 4; static const int kGrowthFactory = 4;
static const int kMinConversionSlack = 256; static const int kMinConversionSlack = 256;
static const int kMaxGrowth = 1 * MB; static const int kMaxGrowth = 1 * MB;
inline bool IsValidAscii(char code_unit) {
// Control characters and printable characters span the range of
// valid ASCII characters (0-127). Chars are unsigned on some
// platforms which causes compiler warnings if the validity check
// tests the lower bound >= 0 as it's always true.
return iscntrl(code_unit) || isprint(code_unit);
}
inline int NewCapacity(int min_capacity) { inline int NewCapacity(int min_capacity) {
int capacity = Max(min_capacity, backing_store_.length()); int capacity = Max(min_capacity, backing_store_.length());
int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth); int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth);
......
...@@ -92,13 +92,14 @@ bool IntoTwoByte(int index, bool is_uri, int uri_length, ...@@ -92,13 +92,14 @@ bool IntoTwoByte(int index, bool is_uri, int uri_length,
for (int k = index; k < uri_length; k++) { for (int k = index; k < uri_length; k++) {
uc16 code = uri_content->Get(k); uc16 code = uri_content->Get(k);
if (code == '%') { if (code == '%') {
uc16 decoded; int two_digits;
if (k + 2 >= uri_length || if (k + 2 >= uri_length ||
(decoded = TwoDigitHex(uri_content->Get(k + 1), (two_digits = TwoDigitHex(uri_content->Get(k + 1),
uri_content->Get(k + 2))) < 0) { uri_content->Get(k + 2))) < 0) {
return false; return false;
} }
k += 2; k += 2;
uc16 decoded = static_cast<uc16>(two_digits);
if (decoded > unibrow::Utf8::kMaxOneByteChar) { if (decoded > unibrow::Utf8::kMaxOneByteChar) {
uint8_t octets[unibrow::Utf8::kMaxEncodedSize]; uint8_t octets[unibrow::Utf8::kMaxEncodedSize];
octets[0] = decoded; octets[0] = decoded;
...@@ -108,15 +109,13 @@ bool IntoTwoByte(int index, bool is_uri, int uri_length, ...@@ -108,15 +109,13 @@ bool IntoTwoByte(int index, bool is_uri, int uri_length,
if (number_of_continuation_bytes > 3 || k + 3 >= uri_length) { if (number_of_continuation_bytes > 3 || k + 3 >= uri_length) {
return false; return false;
} }
uc16 continuation_byte;
if (uri_content->Get(++k) != '%' || if (uri_content->Get(++k) != '%' ||
(continuation_byte = TwoDigitHex(uri_content->Get(k + 1), (two_digits = TwoDigitHex(uri_content->Get(k + 1),
uri_content->Get(k + 2))) < 0) { uri_content->Get(k + 2))) < 0) {
return false; return false;
} }
k += 2; k += 2;
uc16 continuation_byte = static_cast<uc16>(two_digits);
octets[number_of_continuation_bytes] = continuation_byte; octets[number_of_continuation_bytes] = continuation_byte;
} }
...@@ -143,13 +142,14 @@ bool IntoOneAndTwoByte(Handle<String> uri, bool is_uri, ...@@ -143,13 +142,14 @@ bool IntoOneAndTwoByte(Handle<String> uri, bool is_uri,
for (int k = 0; k < uri_length; k++) { for (int k = 0; k < uri_length; k++) {
uc16 code = uri_content.Get(k); uc16 code = uri_content.Get(k);
if (code == '%') { if (code == '%') {
uc16 decoded; int two_digits;
if (k + 2 >= uri_length || if (k + 2 >= uri_length ||
(decoded = TwoDigitHex(uri_content.Get(k + 1), (two_digits = TwoDigitHex(uri_content.Get(k + 1),
uri_content.Get(k + 2))) < 0) { uri_content.Get(k + 2))) < 0) {
return false; return false;
} }
uc16 decoded = static_cast<uc16>(two_digits);
if (decoded > unibrow::Utf8::kMaxOneByteChar) { if (decoded > unibrow::Utf8::kMaxOneByteChar) {
return IntoTwoByte(k, is_uri, uri_length, &uri_content, return IntoTwoByte(k, is_uri, uri_length, &uri_content,
two_byte_buffer); two_byte_buffer);
......
...@@ -58,11 +58,9 @@ struct TestCaseData { ...@@ -58,11 +58,9 @@ struct TestCaseData {
declaration_parameters_(declaration_parameters), declaration_parameters_(declaration_parameters),
arguments_(arguments) {} arguments_(arguments) {}
const char* const script() const { return script_; } const char* script() const { return script_; }
const char* const declaration_parameters() const { const char* declaration_parameters() const { return declaration_parameters_; }
return declaration_parameters_; const char* arguments() const { return arguments_; }
}
const char* const arguments() const { return arguments_; }
private: private:
TestCaseData(); TestCaseData();
......
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