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

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

Issue 1682853004: [interpreter, debugger] implement bytecode break location iterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
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(),
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698