Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index bdc5370f5a30ac5779f65f6999c3470256a712cf..cd33151887bb00b0916196942dff5aeedc9d3114 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -633,14 +633,14 @@ void BytecodeGenerator::BuildIndexedJump(Register index, size_t start_index, |
| size_t size, |
| ZoneVector<BytecodeLabel>& targets) { |
| // TODO(neis): Optimize this by using a proper jump table. |
| + DCHECK_LE(start_index + size, targets.size()); |
| + DCHECK_LE(start_index, start_index + size); |
|
rmcilroy
2016/07/08 11:15:06
Are we worried about overflow here? I'd just remov
oth
2016/07/10 15:34:16
Done. It matched the semantic of the original chec
|
| for (size_t i = start_index; i < start_index + size; i++) { |
| - DCHECK(0 <= i && i < targets.size()); |
| builder() |
| ->LoadLiteral(Smi::FromInt(static_cast<int>(i))) |
| .CompareOperation(Token::Value::EQ_STRICT, index) |
| .JumpIfTrue(&(targets[i])); |
| } |
| - |
| BuildAbort(BailoutReason::kInvalidJumpTableIndex); |
| } |
| @@ -654,8 +654,9 @@ void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, |
| // for these resume points, to be used inside the loop. |
| ZoneVector<BytecodeLabel> resume_points_in_loop(zone()); |
| size_t first_yield = stmt->first_yield_id(); |
| + DCHECK_LE(first_yield + stmt->yield_count(), generator_resume_points_.size()); |
| + DCHECK_LE(first_yield, first_yield + stmt->yield_count()); |
|
rmcilroy
2016/07/08 11:15:06
ditto
oth
2016/07/10 15:34:16
Done.
|
| 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]; |
| resume_points_in_loop.push_back(label); |
| generator_resume_points_[id] = BytecodeLabel(); |