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

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

Issue 1985753002: [interpreter] Introduce fused bytecodes for common sequences. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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-pipeline.cc
diff --git a/src/interpreter/bytecode-pipeline.cc b/src/interpreter/bytecode-pipeline.cc
index 7bfb8151809b24055997e9a943f09c895450c0bd..3e63be289f0b01c20cc79a643434ca92e9a2f281 100644
--- a/src/interpreter/bytecode-pipeline.cc
+++ b/src/interpreter/bytecode-pipeline.cc
@@ -90,12 +90,8 @@ void BytecodeNode::set_bytecode(Bytecode bytecode, uint32_t operand0,
operand_scale_ = operand_scale;
}
-size_t BytecodeNode::Size() const {
- size_t size = Bytecodes::Size(bytecode_, operand_scale_);
- if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale_)) {
- size += 1;
- }
- return size;
+void BytecodeNode::Clone(const BytecodeNode* const other) {
+ memcpy(this, other, sizeof(*other));
}
void BytecodeNode::Print(std::ostream& os) const {
@@ -116,7 +112,7 @@ void BytecodeNode::Print(std::ostream& os) const {
os.copyfmt(saved_state);
if (source_info_.is_valid()) {
- os << source_info_;
+ os << ' ' << source_info_;
}
os << '\n';
#else
@@ -124,8 +120,31 @@ void BytecodeNode::Print(std::ostream& os) const {
#endif // DEBUG
}
-void BytecodeNode::Clone(const BytecodeNode* const other) {
- memcpy(this, other, sizeof(*other));
+size_t BytecodeNode::Size() const {
+ size_t size = Bytecodes::Size(bytecode_, operand_scale_);
+ if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale_)) {
+ size += 1;
+ }
+ return size;
+}
+
+void BytecodeNode::Transform(Bytecode new_bytecode, uint32_t extra_operand,
+ OperandScale extra_operand_scale) {
+ DCHECK_EQ(Bytecodes::NumberOfOperands(new_bytecode),
+ Bytecodes::NumberOfOperands(bytecode()) + 1);
+ DCHECK(Bytecodes::NumberOfOperands(bytecode()) < 1 ||
+ Bytecodes::GetOperandType(new_bytecode, 0) ==
+ Bytecodes::GetOperandType(bytecode(), 0));
+ DCHECK(Bytecodes::NumberOfOperands(bytecode()) < 2 ||
+ Bytecodes::GetOperandType(new_bytecode, 1) ==
+ Bytecodes::GetOperandType(bytecode(), 1));
+ DCHECK(Bytecodes::NumberOfOperands(bytecode()) < 3 ||
+ Bytecodes::GetOperandType(new_bytecode, 2) ==
+ Bytecodes::GetOperandType(bytecode(), 2));
+ DCHECK(Bytecodes::NumberOfOperands(bytecode()) < 4);
+ operand_scale_ = std::max(extra_operand_scale, operand_scale());
+ operands_[operand_count()] = extra_operand;
+ bytecode_ = new_bytecode;
}
bool BytecodeNode::operator==(const BytecodeNode& other) const {

Powered by Google App Engine
This is Rietveld 408576698