Chromium Code Reviews

Side by Side 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: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-array-writer.h" 8 #include "src/interpreter/bytecode-array-writer.h"
9 #include "src/interpreter/bytecode-label.h" 9 #include "src/interpreter/bytecode-label.h"
10 #include "src/interpreter/bytecode-peephole-optimizer.h" 10 #include "src/interpreter/bytecode-peephole-optimizer.h"
(...skipping 63 matching lines...)
74 DCHECK(!bytecode_generated_); 74 DCHECK(!bytecode_generated_);
75 bytecode_generated_ = true; 75 bytecode_generated_ = true;
76 76
77 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable(); 77 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable();
78 return pipeline_->ToBytecodeArray(fixed_register_count(), parameter_count(), 78 return pipeline_->ToBytecodeArray(fixed_register_count(), parameter_count(),
79 handler_table); 79 handler_table);
80 } 80 }
81 81
82 void BytecodeArrayBuilder::AttachSourceInfo(BytecodeNode* node) { 82 void BytecodeArrayBuilder::AttachSourceInfo(BytecodeNode* node) {
83 if (latest_source_info_.is_valid()) { 83 if (latest_source_info_.is_valid()) {
84 node->source_info().Update(latest_source_info_); 84 if (latest_source_info_.is_statement() || !FLAG_ignition_filter_positions ||
85 latest_source_info_.set_invalid(); 85 !Bytecodes::IsWithoutExternalSideEffects(node->bytecode())) {
rmcilroy 2016/06/07 10:21:41 Please pull out a CanFilterPosition function for c
oth 2016/06/08 09:19:41 Added NeedExpressionPosition(Bytecode).
86 node->source_info() = latest_source_info_;
87 latest_source_info_.set_invalid();
rmcilroy 2016/06/07 10:21:41 I think you should set_invalid unconditionally, ot
oth 2016/06/08 09:19:41 The goal is to defer writing the expression positi
rmcilroy 2016/06/08 13:45:11 I see, makes sense. Could you add a comment here a
oth 2016/06/08 15:04:21 Done.
88 }
86 } 89 }
87 } 90 }
88 91
89 void BytecodeArrayBuilder::Output(Bytecode bytecode) { 92 void BytecodeArrayBuilder::Output(Bytecode bytecode) {
90 BytecodeNode node(bytecode); 93 BytecodeNode node(bytecode);
91 AttachSourceInfo(&node); 94 AttachSourceInfo(&node);
92 pipeline()->Write(&node); 95 pipeline()->Write(&node);
93 } 96 }
94 97
95 void BytecodeArrayBuilder::OutputScaled(Bytecode bytecode, 98 void BytecodeArrayBuilder::OutputScaled(Bytecode bytecode,
(...skipping 619 matching lines...)
715 latest_source_info_.Update({return_position_, true}); 718 latest_source_info_.Update({return_position_, true});
716 } 719 }
717 720
718 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { 721 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) {
719 if (stmt->position() == RelocInfo::kNoPosition) return; 722 if (stmt->position() == RelocInfo::kNoPosition) return;
720 latest_source_info_.Update({stmt->position(), true}); 723 latest_source_info_.Update({stmt->position(), true});
721 } 724 }
722 725
723 void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) { 726 void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) {
724 if (expr->position() == RelocInfo::kNoPosition) return; 727 if (expr->position() == RelocInfo::kNoPosition) return;
728 if (latest_source_info_.is_expression()) {
729 latest_source_info_.set_invalid();
rmcilroy 2016/06/07 10:21:41 Why do you need to set this as invalid, won't Upda
oth 2016/06/08 09:19:41 Update() does not do the right thing. I don't want
rmcilroy 2016/06/08 13:45:11 I'm fine with getting rid of Update (I agree the l
oth 2016/06/08 15:04:20 Amen.
730 }
725 latest_source_info_.Update({expr->position(), false}); 731 latest_source_info_.Update({expr->position(), false});
726 } 732 }
727 733
728 void BytecodeArrayBuilder::SetExpressionAsStatementPosition(Expression* expr) { 734 void BytecodeArrayBuilder::SetExpressionAsStatementPosition(Expression* expr) {
729 if (expr->position() == RelocInfo::kNoPosition) return; 735 if (expr->position() == RelocInfo::kNoPosition) return;
730 latest_source_info_.Update({expr->position(), true}); 736 latest_source_info_.Update({expr->position(), true});
731 } 737 }
732 738
733 bool BytecodeArrayBuilder::TemporaryRegisterIsLive(Register reg) const { 739 bool BytecodeArrayBuilder::TemporaryRegisterIsLive(Register reg) const {
734 return temporary_register_allocator()->RegisterIsLive(reg); 740 return temporary_register_allocator()->RegisterIsLive(reg);
(...skipping 283 matching lines...)
1018 } 1024 }
1019 1025
1020 uint32_t BytecodeArrayBuilder::UnsignedOperand(size_t value) { 1026 uint32_t BytecodeArrayBuilder::UnsignedOperand(size_t value) {
1021 DCHECK_LE(value, kMaxUInt32); 1027 DCHECK_LE(value, kMaxUInt32);
1022 return static_cast<uint32_t>(value); 1028 return static_cast<uint32_t>(value);
1023 } 1029 }
1024 1030
1025 } // namespace interpreter 1031 } // namespace interpreter
1026 } // namespace internal 1032 } // namespace internal
1027 } // namespace v8 1033 } // namespace v8
OLDNEW

Powered by Google App Engine