Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index 9450cb7ef2e7e000dc996d231c66a67bb80fe692..f277d7ce187e0a5ba975b351e7190c731fea79ca 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -124,8 +124,8 @@ |
int frame_size = register_count * kPointerSize; |
Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray(); |
Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable(); |
- Handle<ByteArray> source_position_table = |
- source_position_table_builder()->ToSourcePositionTable(); |
+ Handle<FixedArray> source_position_table = |
+ source_position_table_builder()->ToFixedArray(); |
Handle<BytecodeArray> output = isolate_->factory()->NewBytecodeArray( |
bytecode_size, &bytecodes_.front(), frame_size, parameter_count(), |
constant_pool); |
@@ -139,7 +139,10 @@ |
template <size_t N> |
void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t(&operands)[N]) { |
// Don't output dead code. |
- if (exit_seen_in_block_) return; |
+ if (exit_seen_in_block_) { |
+ source_position_table_builder_.RevertPosition(bytecodes()->size()); |
+ return; |
+ } |
int operand_count = static_cast<int>(N); |
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count); |
@@ -207,7 +210,10 @@ |
void BytecodeArrayBuilder::Output(Bytecode bytecode) { |
// Don't output dead code. |
- if (exit_seen_in_block_) return; |
+ if (exit_seen_in_block_) { |
+ source_position_table_builder_.RevertPosition(bytecodes()->size()); |
+ return; |
+ } |
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); |
last_bytecode_start_ = bytecodes()->size(); |
@@ -874,7 +880,10 @@ |
BytecodeArrayBuilder& BytecodeArrayBuilder::OutputJump(Bytecode jump_bytecode, |
BytecodeLabel* label) { |
// Don't emit dead code. |
- if (exit_seen_in_block_) return *this; |
+ if (exit_seen_in_block_) { |
+ source_position_table_builder_.RevertPosition(bytecodes()->size()); |
+ return *this; |
+ } |
// Check if the value in accumulator is boolean, if not choose an |
// appropriate JumpIfToBoolean bytecode. |
@@ -1072,7 +1081,6 @@ |
SetReturnPosition(literal); |
Return(); |
} |
- DCHECK(exit_seen_in_block_); |
} |
BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, |
@@ -1201,23 +1209,18 @@ |
} |
void BytecodeArrayBuilder::SetReturnPosition(FunctionLiteral* fun) { |
- // Don't emit dead code. |
- if (exit_seen_in_block_) return; |
- |
int pos = std::max(fun->start_position(), fun->end_position() - 1); |
source_position_table_builder_.AddStatementPosition(bytecodes_.size(), pos); |
} |
void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { |
if (stmt->position() == RelocInfo::kNoPosition) return; |
- if (exit_seen_in_block_) return; |
source_position_table_builder_.AddStatementPosition(bytecodes_.size(), |
stmt->position()); |
} |
void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) { |
if (expr->position() == RelocInfo::kNoPosition) return; |
- if (exit_seen_in_block_) return; |
source_position_table_builder_.AddExpressionPosition(bytecodes_.size(), |
expr->position()); |
} |