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

Unified Diff: src/interpreter/bytecode-register-optimizer.cc

Issue 2100793003: [interpreter] Streamline bytecode array writing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. 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
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecode-traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-register-optimizer.cc
diff --git a/src/interpreter/bytecode-register-optimizer.cc b/src/interpreter/bytecode-register-optimizer.cc
index ab25f959e48564d823c36161256cb71e70c62b34..93b7c090b98e7ed954baad291ad4fc5b5ddea70f 100644
--- a/src/interpreter/bytecode-register-optimizer.cc
+++ b/src/interpreter/bytecode-register-optimizer.cc
@@ -504,35 +504,32 @@ void BytecodeRegisterOptimizer::PrepareRegisterOperands(
// For each output register about to be clobbered, materialize an
// equivalent if it exists. Put each register in it's own equivalence set.
//
- int register_operand_bitmap =
- Bytecodes::GetRegisterOperandBitmap(node->bytecode());
+ const uint32_t* operands = node->operands();
+ int operand_count = node->operand_count();
const OperandType* operand_types =
Bytecodes::GetOperandTypes(node->bytecode());
- uint32_t* operands = node->operands();
- for (int i = 0; register_operand_bitmap != 0;
- ++i, register_operand_bitmap >>= 1) {
- if ((register_operand_bitmap & 1) == 0) {
- continue;
- }
- OperandType operand_type = operand_types[i];
- int count = 0;
+ for (int i = 0; i < operand_count; ++i) {
+ int count;
+ // operand_types is terminated by OperandType::kNone so this does not
+ // go out of bounds.
if (operand_types[i + 1] == OperandType::kRegCount) {
count = static_cast<int>(operands[i + 1]);
- if (count == 0) {
- continue;
- }
} else {
- count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type);
+ count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_types[i]);
+ }
+
+ if (count == 0) {
+ continue;
}
Register reg = Register::FromOperand(static_cast<int32_t>(operands[i]));
- if (Bytecodes::IsRegisterInputOperandType(operand_type)) {
+ if (Bytecodes::IsRegisterInputOperandType(operand_types[i])) {
if (count == 1) {
PrepareRegisterInputOperand(node, reg, i);
} else if (count > 1) {
PrepareRegisterRangeInputOperand(reg, count);
}
- } else if (Bytecodes::IsRegisterOutputOperandType(operand_type)) {
+ } else if (Bytecodes::IsRegisterOutputOperandType(operand_types[i])) {
PrepareRegisterRangeOutputOperand(reg, count);
}
}
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecode-traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698