Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index 605018232789b6098779a560438e436877873ce7..d98d48cc780779c52437a9c15af51f1469130a63 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -143,7 +143,8 @@ class OperandHelper {}; |
template <> \ |
class OperandHelper<OperandType::k##Name> \ |
: public UnsignedOperandHelper<Type> {}; |
-UNSIGNED_SCALAR_OPERAND_TYPE_LIST(DEFINE_UNSIGNED_OPERAND_HELPER) |
+UNSIGNED_FIXED_SCALAR_OPERAND_TYPE_LIST(DEFINE_UNSIGNED_OPERAND_HELPER) |
+UNSIGNED_SCALABLE_SCALAR_OPERAND_TYPE_LIST(DEFINE_UNSIGNED_OPERAND_HELPER) |
#undef DEFINE_UNSIGNED_OPERAND_HELPER |
template <> |
@@ -211,14 +212,15 @@ class OperandHelper<OperandType::kRegOutTriple> { |
} // namespace |
-template <OperandType... operand_types> |
+template <Bytecode bytecode, AccumulatorUse accumulator_use, |
+ OperandType... operand_types> |
class BytecodeNodeBuilder { |
public: |
template <typename... Operands> |
INLINE(static BytecodeNode Make(BytecodeArrayBuilder* builder, |
BytecodeSourceInfo source_info, |
- Bytecode bytecode, Operands... operands)) { |
- builder->PrepareToOutputBytecode(bytecode); |
+ Operands... operands)) { |
+ builder->PrepareToOutputBytecode<bytecode, accumulator_use>(); |
// The "OperandHelper<operand_types>::Convert(builder, operands)..." will |
// expand both the OperandType... and Operands... parameter packs e.g. for: |
// BytecodeNodeBuilder<OperandType::kReg, OperandType::kImm>::Make< |
@@ -226,32 +228,34 @@ class BytecodeNodeBuilder { |
// the code will expand into: |
// OperandHelper<OperandType::kReg>::Convert(builder, reg), |
// OperandHelper<OperandType::kImm>::Convert(builder, immediate), |
- return BytecodeNode( |
- bytecode, OperandHelper<operand_types>::Convert(builder, operands)..., |
- source_info); |
+ return BytecodeNode::Create<bytecode, accumulator_use, operand_types...>( |
+ source_info, |
+ OperandHelper<operand_types>::Convert(builder, operands)...); |
} |
}; |
-#define DEFINE_BYTECODE_OUTPUT(name, accumulator_use, ...) \ |
- template <typename... Operands> \ |
- void BytecodeArrayBuilder::Output##name(Operands... operands) { \ |
- static_assert(sizeof...(Operands) <= Bytecodes::kMaxOperands, \ |
- "too many operands for bytecode"); \ |
- BytecodeNode node(BytecodeNodeBuilder<__VA_ARGS__>::Make<Operands...>( \ |
- this, CurrentSourcePosition(Bytecode::k##name), Bytecode::k##name, \ |
- operands...)); \ |
- pipeline()->Write(&node); \ |
- } \ |
- \ |
- template <typename... Operands> \ |
- void BytecodeArrayBuilder::Output##name(BytecodeLabel* label, \ |
- Operands... operands) { \ |
- DCHECK(Bytecodes::IsJump(Bytecode::k##name)); \ |
- BytecodeNode node(BytecodeNodeBuilder<__VA_ARGS__>::Make<Operands...>( \ |
- this, CurrentSourcePosition(Bytecode::k##name), Bytecode::k##name, \ |
- operands...)); \ |
- pipeline()->WriteJump(&node, label); \ |
- LeaveBasicBlock(); \ |
+#define DEFINE_BYTECODE_OUTPUT(name, ...) \ |
+ template <typename... Operands> \ |
+ void BytecodeArrayBuilder::Output##name(Operands... operands) { \ |
+ static_assert(sizeof...(Operands) <= Bytecodes::kMaxOperands, \ |
+ "too many operands for bytecode"); \ |
+ BytecodeNode node( \ |
+ BytecodeNodeBuilder<Bytecode::k##name, __VA_ARGS__>::Make< \ |
+ Operands...>(this, CurrentSourcePosition(Bytecode::k##name), \ |
+ operands...)); \ |
+ pipeline()->Write(&node); \ |
+ } \ |
+ \ |
+ template <typename... Operands> \ |
+ void BytecodeArrayBuilder::Output##name(BytecodeLabel* label, \ |
+ Operands... operands) { \ |
+ DCHECK(Bytecodes::IsJump(Bytecode::k##name)); \ |
+ BytecodeNode node( \ |
+ BytecodeNodeBuilder<Bytecode::k##name, __VA_ARGS__>::Make< \ |
+ Operands...>(this, CurrentSourcePosition(Bytecode::k##name), \ |
+ operands...)); \ |
+ pipeline()->WriteJump(&node, label); \ |
+ LeaveBasicBlock(); \ |
} |
BYTECODE_LIST(DEFINE_BYTECODE_OUTPUT) |
#undef DEFINE_BYTECODE_OUTPUT |
@@ -1000,8 +1004,10 @@ bool BytecodeArrayBuilder::RegisterListIsValid(RegisterList reg_list) const { |
} |
} |
-void BytecodeArrayBuilder::PrepareToOutputBytecode(Bytecode bytecode) { |
- if (register_optimizer_) register_optimizer_->PrepareForBytecode(bytecode); |
+template <Bytecode bytecode, AccumulatorUse accumulator_use> |
+void BytecodeArrayBuilder::PrepareToOutputBytecode() { |
+ if (register_optimizer_) |
+ register_optimizer_->PrepareForBytecode<bytecode, accumulator_use>(); |
} |
uint32_t BytecodeArrayBuilder::GetInputRegisterOperand(Register reg) { |