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

Unified Diff: src/interpreter/bytecode-pipeline.h

Issue 2393683004: [Interpreter] Optimize the Register Optimizer. (Closed)
Patch Set: Rebase Created 4 years, 2 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-peephole-optimizer.cc ('k') | src/interpreter/bytecode-pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-pipeline.h
diff --git a/src/interpreter/bytecode-pipeline.h b/src/interpreter/bytecode-pipeline.h
index 85e41c60fab355728e1f1e8edf4e1ba381a12a87..d508defea06ba6256cb98d9ffb416cd685b337d3 100644
--- a/src/interpreter/bytecode-pipeline.h
+++ b/src/interpreter/bytecode-pipeline.h
@@ -95,14 +95,6 @@ class BytecodeSourceInfo final {
source_position_ = source_position;
}
- // Clones a source position. The current instance is expected to be
- // invalid.
- void Clone(const BytecodeSourceInfo& other) {
- DCHECK(!is_valid());
- position_type_ = other.position_type_;
- source_position_ = other.source_position_;
- }
-
int source_position() const {
DCHECK(is_valid());
return source_position_;
@@ -142,79 +134,77 @@ class BytecodeSourceInfo final {
// These must be allocated by a BytecodeNodeAllocator instance.
class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
public:
- INLINE(BytecodeNode(const Bytecode bytecode,
- BytecodeSourceInfo* source_info = nullptr))
+ INLINE(BytecodeNode(Bytecode bytecode,
+ BytecodeSourceInfo source_info = BytecodeSourceInfo()))
: bytecode_(bytecode),
operand_count_(0),
- operand_scale_(OperandScale::kSingle) {
+ operand_scale_(OperandScale::kSingle),
+ source_info_(source_info) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
- AttachSourceInfo(source_info);
}
- INLINE(BytecodeNode(const Bytecode bytecode, uint32_t operand0,
- BytecodeSourceInfo* source_info = nullptr))
+ INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0,
+ BytecodeSourceInfo source_info = BytecodeSourceInfo()))
: bytecode_(bytecode),
operand_count_(1),
- operand_scale_(OperandScale::kSingle) {
+ operand_scale_(OperandScale::kSingle),
+ source_info_(source_info) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
SetOperand(0, operand0);
- AttachSourceInfo(source_info);
}
- INLINE(BytecodeNode(const Bytecode bytecode, uint32_t operand0,
- uint32_t operand1,
- BytecodeSourceInfo* source_info = nullptr))
+ INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
+ BytecodeSourceInfo source_info = BytecodeSourceInfo()))
: bytecode_(bytecode),
operand_count_(2),
- operand_scale_(OperandScale::kSingle) {
+ operand_scale_(OperandScale::kSingle),
+ source_info_(source_info) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
SetOperand(0, operand0);
SetOperand(1, operand1);
- AttachSourceInfo(source_info);
}
- INLINE(BytecodeNode(const Bytecode bytecode, uint32_t operand0,
- uint32_t operand1, uint32_t operand2,
- BytecodeSourceInfo* source_info = nullptr))
+ INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
+ uint32_t operand2,
+ BytecodeSourceInfo source_info = BytecodeSourceInfo()))
: bytecode_(bytecode),
operand_count_(3),
- operand_scale_(OperandScale::kSingle) {
+ operand_scale_(OperandScale::kSingle),
+ source_info_(source_info) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
SetOperand(0, operand0);
SetOperand(1, operand1);
SetOperand(2, operand2);
- AttachSourceInfo(source_info);
}
- INLINE(BytecodeNode(const Bytecode bytecode, uint32_t operand0,
- uint32_t operand1, uint32_t operand2, uint32_t operand3,
- BytecodeSourceInfo* source_info = nullptr))
+ INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
+ uint32_t operand2, uint32_t operand3,
+ BytecodeSourceInfo source_info = BytecodeSourceInfo()))
: bytecode_(bytecode),
operand_count_(4),
- operand_scale_(OperandScale::kSingle) {
+ operand_scale_(OperandScale::kSingle),
+ source_info_(source_info) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
SetOperand(0, operand0);
SetOperand(1, operand1);
SetOperand(2, operand2);
SetOperand(3, operand3);
- AttachSourceInfo(source_info);
}
- BytecodeNode(const BytecodeNode& other);
- BytecodeNode& operator=(const BytecodeNode& other);
-
// Replace the bytecode of this node with |bytecode| and keep the operands.
void replace_bytecode(Bytecode bytecode) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode_),
Bytecodes::NumberOfOperands(bytecode));
bytecode_ = bytecode;
}
+
void set_bytecode(Bytecode bytecode) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0);
bytecode_ = bytecode;
operand_count_ = 0;
operand_scale_ = OperandScale::kSingle;
}
+
void set_bytecode(Bytecode bytecode, uint32_t operand0) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 1);
bytecode_ = bytecode;
@@ -222,6 +212,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
operand_scale_ = OperandScale::kSingle;
SetOperand(0, operand0);
}
+
void set_bytecode(Bytecode bytecode, uint32_t operand0, uint32_t operand1) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 2);
bytecode_ = bytecode;
@@ -230,6 +221,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
SetOperand(0, operand0);
SetOperand(1, operand1);
}
+
void set_bytecode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
uint32_t operand2) {
DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 3);
@@ -241,9 +233,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
SetOperand(2, operand2);
}
- // Clone |other|.
- void Clone(const BytecodeNode* const other);
-
// Print to stream |os|.
void Print(std::ostream& os) const;
@@ -268,18 +257,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
SetOperand(operand_count() - 1, extra_operand);
}
- // Updates the operand at |operand_index| to |operand|.
- void UpdateOperand(int operand_index, uint32_t operand) {
- DCHECK_LE(operand_index, Bytecodes::NumberOfOperands(bytecode()));
- operands_[operand_index] = operand;
- if ((Bytecodes::OperandIsScalableSignedByte(bytecode(), operand_index) &&
- Bytecodes::ScaleForSignedOperand(operand) != operand_scale_) ||
- (Bytecodes::OperandIsScalableUnsignedByte(bytecode(), operand_index) &&
- Bytecodes::ScaleForUnsignedOperand(operand) != operand_scale_)) {
- UpdateScale();
- }
- }
-
Bytecode bytecode() const { return bytecode_; }
uint32_t operand(int i) const {
@@ -292,27 +269,14 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
OperandScale operand_scale() const { return operand_scale_; }
const BytecodeSourceInfo& source_info() const { return source_info_; }
- BytecodeSourceInfo* source_info_ptr() { return &source_info_; }
+ void set_source_info(BytecodeSourceInfo source_info) {
+ source_info_ = source_info;
+ }
bool operator==(const BytecodeNode& other) const;
bool operator!=(const BytecodeNode& other) const { return !(*this == other); }
private:
- INLINE(void AttachSourceInfo(BytecodeSourceInfo* source_info)) {
- if (source_info && source_info->is_valid()) {
- // Statement positions need to be emitted immediately. Expression
- // positions can be pushed back until a bytecode is found that can
- // throw (if expression position filtering is turned on). We only
- // invalidate the existing source position information if it is used.
- if (source_info->is_statement() ||
- !FLAG_ignition_filter_expression_positions ||
- !Bytecodes::IsWithoutExternalSideEffects(bytecode())) {
- source_info_.Clone(*source_info);
- source_info->set_invalid();
- }
- }
- }
-
INLINE(void UpdateScaleForOperand(int operand_index, uint32_t operand)) {
if (Bytecodes::OperandIsScalableSignedByte(bytecode(), operand_index)) {
operand_scale_ =
@@ -329,13 +293,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) {
UpdateScaleForOperand(operand_index, operand);
}
- void UpdateScale() {
- operand_scale_ = OperandScale::kSingle;
- for (int i = 0; i < operand_count(); i++) {
- UpdateScaleForOperand(i, operands_[i]);
- }
- }
-
Bytecode bytecode_;
uint32_t operands_[Bytecodes::kMaxOperands];
int operand_count_;
« no previous file with comments | « src/interpreter/bytecode-peephole-optimizer.cc ('k') | src/interpreter/bytecode-pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698