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

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: Rebase. 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
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-pipeline.cc
diff --git a/src/interpreter/bytecode-pipeline.cc b/src/interpreter/bytecode-pipeline.cc
index c940856121ec16c77cf0adeaf28275d3b761c391..07ce6ed5d2eb09f57a2a85c95ff2fcd7f3aa1010 100644
--- a/src/interpreter/bytecode-pipeline.cc
+++ b/src/interpreter/bytecode-pipeline.cc
@@ -89,12 +89,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 {
@@ -123,8 +119,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 {
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698