Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1070)

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1744123003: [debugger] fix break locations for assignments and return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 5bdf4ab24ba097ed5b017a661e2869a5d055c1df..c3899d0eee91dd5f82de782bf15f22ac236632d8 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -82,6 +82,7 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone,
parameter_count_(parameter_count),
local_register_count_(locals_count),
context_register_count_(context_count),
+ return_position_(RelocInfo::kNoPosition),
temporary_allocator_(zone, fixed_register_count()),
register_translator_(this) {
DCHECK_GE(parameter_count_, 0);
@@ -961,6 +962,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ReThrow() {
BytecodeArrayBuilder& BytecodeArrayBuilder::Return() {
+ SetReturnPosition();
Output(Bytecode::kReturn);
exit_seen_in_block_ = true;
return *this;
@@ -1045,7 +1047,6 @@ void BytecodeArrayBuilder::LeaveBasicBlock() {
void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) {
vogelheim 2016/02/29 14:52:32 Remove literal parameter?
Yang 2016/03/01 08:09:18 Done.
if (!exit_seen_in_block_) {
LoadUndefined();
- SetReturnPosition(literal);
Return();
}
DCHECK(exit_seen_in_block_);
@@ -1176,12 +1177,17 @@ size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
return constant_array_builder()->Insert(object);
}
-void BytecodeArrayBuilder::SetReturnPosition(FunctionLiteral* fun) {
- // Don't emit dead code.
- if (exit_seen_in_block_) return;
+void BytecodeArrayBuilder::InitializeReturnPosition(FunctionLiteral* literal) {
+ DCHECK_EQ(RelocInfo::kNoPosition, return_position_);
+ return_position_ =
+ std::max(literal->start_position(), literal->end_position() - 1);
+}
- int pos = std::max(fun->start_position(), fun->end_position() - 1);
- source_position_table_builder_.AddStatementPosition(bytecodes_.size(), pos);
+void BytecodeArrayBuilder::SetReturnPosition() {
+ if (return_position_ == RelocInfo::kNoPosition) return;
vogelheim 2016/02/29 14:52:32 Is this ever supposed to happen?
+ if (exit_seen_in_block_) return;
+ source_position_table_builder_.AddStatementPosition(bytecodes_.size(),
+ return_position_);
vogelheim 2016/02/29 14:52:32 I'm confused at this logic. (Not specifically this
}
void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) {

Powered by Google App Engine
This is Rietveld 408576698