Chromium Code Reviews| Index: src/interpreter/bytecode-array-builder.cc |
| diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
| index 91905079d113b0b85a61dda9a9a8bed17a651e4f..db90d56f34b1315e17aff71dab58c10c66aeea6e 100644 |
| --- a/src/interpreter/bytecode-array-builder.cc |
| +++ b/src/interpreter/bytecode-array-builder.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "src/interpreter/bytecode-array-builder.h" |
| +#include "src/compiler.h" |
| namespace v8 { |
| namespace internal { |
| @@ -115,7 +116,7 @@ bool BytecodeArrayBuilder::RegisterIsParameterOrLocal(Register reg) const { |
| Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { |
| DCHECK_EQ(bytecode_generated_, false); |
| - EnsureReturn(); |
| + DCHECK(exit_seen_in_block_); |
| int bytecode_size = static_cast<int>(bytecodes_.size()); |
| int register_count = |
| @@ -1074,10 +1075,10 @@ void BytecodeArrayBuilder::LeaveBasicBlock() { |
| exit_seen_in_block_ = false; |
| } |
| - |
| -void BytecodeArrayBuilder::EnsureReturn() { |
| +void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) { |
| if (!exit_seen_in_block_) { |
| LoadUndefined(); |
| + SetReturnPosition(literal); |
|
vogelheim
2016/02/11 12:33:59
I find the SetReturnPosition handling a bit odd. N
Yang
2016/02/11 14:16:55
This simply reflects what Fullcodegen does. All re
|
| Return(); |
| } |
| } |
| @@ -1213,6 +1214,11 @@ size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { |
| return constant_array_builder()->Insert(object); |
| } |
| +void BytecodeArrayBuilder::SetReturnPosition(FunctionLiteral* fun) { |
| + 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; |
| source_position_table_builder_.AddStatementPosition(bytecodes_.size(), |