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

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

Issue 2038323002: [interpreter] Filter expression positions at source. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0060-source-position-testing
Patch Set: Fix expression positions on StackCheck that this CL broke. Created 4 years, 6 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 fa57c16c7cca85c9faa418815cddf63dd0620b3e..e02ebab35d07708626195aeb54b618be8f616c7a 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -79,10 +79,22 @@ Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
handler_table);
}
+// static
+bool BytecodeArrayBuilder::NeedExpressionPosition(Bytecode bytecode) {
+ // Always need an expression position if filtering is turned
+ // off. Otherwise an expression is only needed if the bytecode has
+ // external side effects.
+ return !FLAG_ignition_filter_positions ||
+ !Bytecodes::IsWithoutExternalSideEffects(bytecode);
+}
+
void BytecodeArrayBuilder::AttachSourceInfo(BytecodeNode* node) {
if (latest_source_info_.is_valid()) {
- node->source_info().Update(latest_source_info_);
- latest_source_info_.set_invalid();
+ if (latest_source_info_.is_statement() ||
+ NeedExpressionPosition(node->bytecode())) {
+ node->source_info() = latest_source_info_;
+ latest_source_info_.set_invalid();
+ }
}
}
@@ -500,7 +512,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) {
if (position != RelocInfo::kNoPosition) {
// We need to attach a non-breakable source position to a stack check,
// so we simply add it as expression position.
- latest_source_info_.Update({position, false});
+ latest_source_info_ = {position, false};
}
Output(Bytecode::kStackCheck);
return *this;
@@ -722,6 +734,9 @@ void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) {
void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) {
if (expr->position() == RelocInfo::kNoPosition) return;
+ if (latest_source_info_.is_expression()) {
+ latest_source_info_.set_invalid();
+ }
latest_source_info_.Update({expr->position(), false});
}

Powered by Google App Engine
This is Rietveld 408576698