Commit 1dd0988a authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[interpreter] Rename AccumulatorUse so it can be expanded for short star

In https://chromium-review.googlesource.com/c/v8/v8/+/2641180 , we are
discussing renaming AccumulatorUse. To avoid polluting that change with
a large mechanical find&replace, I've created a separate change for the
renaming.

Change-Id: Ibc7e438f9e719571c9237e7e08ba86562a3c679f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2684923Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#72679}
parent 34ea1904
......@@ -327,7 +327,7 @@ class OperandHelper<OperandType::kRegOutTriple> {
} // namespace
template <Bytecode bytecode, AccumulatorUse accumulator_use,
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use,
OperandType... operand_types>
class BytecodeNodeBuilder {
public:
......@@ -336,7 +336,7 @@ class BytecodeNodeBuilder {
Operands... operands) {
static_assert(sizeof...(Operands) <= Bytecodes::kMaxOperands,
"too many operands for bytecode");
builder->PrepareToOutputBytecode<bytecode, accumulator_use>();
builder->PrepareToOutputBytecode<bytecode, implicit_register_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<
......@@ -344,7 +344,8 @@ class BytecodeNodeBuilder {
// the code will expand into:
// OperandHelper<OperandType::kReg>::Convert(builder, reg),
// OperandHelper<OperandType::kImm>::Convert(builder, immediate),
return BytecodeNode::Create<bytecode, accumulator_use, operand_types...>(
return BytecodeNode::Create<bytecode, implicit_register_use,
operand_types...>(
builder->CurrentSourcePosition(bytecode),
OperandHelper<operand_types>::Convert(builder, operands)...);
}
......@@ -1598,10 +1599,10 @@ bool BytecodeArrayBuilder::RegisterListIsValid(RegisterList reg_list) const {
}
}
template <Bytecode bytecode, AccumulatorUse accumulator_use>
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use>
void BytecodeArrayBuilder::PrepareToOutputBytecode() {
if (register_optimizer_)
register_optimizer_->PrepareForBytecode<bytecode, accumulator_use>();
register_optimizer_->PrepareForBytecode<bytecode, implicit_register_use>();
}
uint32_t BytecodeArrayBuilder::GetInputRegisterOperand(Register reg) {
......
......@@ -567,7 +567,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
private:
friend class BytecodeRegisterAllocator;
template <Bytecode bytecode, AccumulatorUse accumulator_use,
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use,
OperandType... operand_types>
friend class BytecodeNodeBuilder;
......@@ -613,7 +613,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
// during bytecode generation.
BytecodeArrayBuilder& Illegal();
template <Bytecode bytecode, AccumulatorUse accumulator_use>
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use>
void PrepareToOutputBytecode();
BytecodeArrayWriter* bytecode_array_writer() {
......
......@@ -253,7 +253,8 @@ void BytecodeArrayWriter::MaybeElideLastBytecode(Bytecode next_bytecode,
// and the next bytecode clobbers this load without reading the accumulator,
// then the previous bytecode can be elided as it has no effect.
if (Bytecodes::IsAccumulatorLoadWithoutEffects(last_bytecode_) &&
Bytecodes::GetAccumulatorUse(next_bytecode) == AccumulatorUse::kWrite &&
Bytecodes::GetImplicitRegisterUse(next_bytecode) ==
ImplicitRegisterUse::kWriteAccumulator &&
(!last_bytecode_had_source_info_ || !has_source_info)) {
DCHECK_GT(bytecodes()->size(), last_bytecode_offset_);
bytecodes()->resize(last_bytecode_offset_);
......
......@@ -127,7 +127,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
bool operator!=(const BytecodeNode& other) const { return !(*this == other); }
private:
template <Bytecode bytecode, AccumulatorUse accumulator_use,
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use,
OperandType... operand_types>
friend class BytecodeNodeBuilder;
......@@ -148,12 +148,12 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
operands_[4] = operand4;
}
template <Bytecode bytecode, AccumulatorUse accum_use>
template <Bytecode bytecode, ImplicitRegisterUse accum_use>
V8_INLINE static BytecodeNode Create(BytecodeSourceInfo source_info) {
return BytecodeNode(bytecode, 0, OperandScale::kSingle, source_info);
}
template <Bytecode bytecode, AccumulatorUse accum_use,
template <Bytecode bytecode, ImplicitRegisterUse accum_use,
OperandType operand0_type>
V8_INLINE static BytecodeNode Create(BytecodeSourceInfo source_info,
uint32_t operand0) {
......@@ -163,7 +163,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
return BytecodeNode(bytecode, 1, scale, source_info, operand0);
}
template <Bytecode bytecode, AccumulatorUse accum_use,
template <Bytecode bytecode, ImplicitRegisterUse accum_use,
OperandType operand0_type, OperandType operand1_type>
V8_INLINE static BytecodeNode Create(BytecodeSourceInfo source_info,
uint32_t operand0, uint32_t operand1) {
......@@ -175,7 +175,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
return BytecodeNode(bytecode, 2, scale, source_info, operand0, operand1);
}
template <Bytecode bytecode, AccumulatorUse accum_use,
template <Bytecode bytecode, ImplicitRegisterUse accum_use,
OperandType operand0_type, OperandType operand1_type,
OperandType operand2_type>
V8_INLINE static BytecodeNode Create(BytecodeSourceInfo source_info,
......@@ -192,7 +192,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
operand2);
}
template <Bytecode bytecode, AccumulatorUse accum_use,
template <Bytecode bytecode, ImplicitRegisterUse accum_use,
OperandType operand0_type, OperandType operand1_type,
OperandType operand2_type, OperandType operand3_type>
V8_INLINE static BytecodeNode Create(BytecodeSourceInfo source_info,
......@@ -211,7 +211,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final {
operand2, operand3);
}
template <Bytecode bytecode, AccumulatorUse accum_use,
template <Bytecode bytecode, ImplicitRegisterUse accum_use,
OperandType operand0_type, OperandType operand1_type,
OperandType operand2_type, OperandType operand3_type,
OperandType operand4_type>
......
......@@ -12,15 +12,16 @@ namespace interpreter {
namespace {
const char* AccumulatorUseToString(AccumulatorUse accumulator_use) {
switch (accumulator_use) {
case AccumulatorUse::kNone:
const char* ImplicitRegisterUseToString(
ImplicitRegisterUse implicit_register_use) {
switch (implicit_register_use) {
case ImplicitRegisterUse::kNone:
return "None";
case AccumulatorUse::kRead:
case ImplicitRegisterUse::kReadAccumulator:
return "Read";
case AccumulatorUse::kWrite:
case ImplicitRegisterUse::kWriteAccumulator:
return "Write";
case AccumulatorUse::kReadWrite:
case ImplicitRegisterUse::kReadWriteAccumulator:
return "ReadWrite";
}
UNREACHABLE();
......@@ -64,8 +65,8 @@ const char* OperandSizeToString(OperandSize operand_size) {
} // namespace
std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use) {
return os << AccumulatorUseToString(use);
std::ostream& operator<<(std::ostream& os, const ImplicitRegisterUse& use) {
return os << ImplicitRegisterUseToString(use);
}
std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) {
......
......@@ -109,27 +109,27 @@ enum class OperandType : uint8_t {
#undef COUNT_OPERAND_TYPES
};
enum class AccumulatorUse : uint8_t {
enum class ImplicitRegisterUse : uint8_t {
kNone = 0,
kRead = 1 << 0,
kWrite = 1 << 1,
kReadWrite = kRead | kWrite
kReadAccumulator = 1 << 0,
kWriteAccumulator = 1 << 1,
kReadWriteAccumulator = kReadAccumulator | kWriteAccumulator
};
constexpr inline AccumulatorUse operator&(AccumulatorUse lhs,
AccumulatorUse rhs) {
return static_cast<AccumulatorUse>(static_cast<int>(lhs) &
static_cast<int>(rhs));
constexpr inline ImplicitRegisterUse operator&(ImplicitRegisterUse lhs,
ImplicitRegisterUse rhs) {
return static_cast<ImplicitRegisterUse>(static_cast<int>(lhs) &
static_cast<int>(rhs));
}
constexpr inline AccumulatorUse operator|(AccumulatorUse lhs,
AccumulatorUse rhs) {
return static_cast<AccumulatorUse>(static_cast<int>(lhs) |
static_cast<int>(rhs));
constexpr inline ImplicitRegisterUse operator|(ImplicitRegisterUse lhs,
ImplicitRegisterUse rhs) {
return static_cast<ImplicitRegisterUse>(static_cast<int>(lhs) |
static_cast<int>(rhs));
}
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const AccumulatorUse& use);
const ImplicitRegisterUse& use);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const OperandScale& operand_scale);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
......@@ -170,14 +170,20 @@ class BytecodeOperands : public AllStatic {
return static_cast<int>(operand_scale) >> 1;
}
// Returns true if |accumulator_use| reads the accumulator.
static constexpr bool ReadsAccumulator(AccumulatorUse accumulator_use) {
return (accumulator_use & AccumulatorUse::kRead) == AccumulatorUse::kRead;
// Returns true if |implicit_register_use| reads the
// accumulator.
static constexpr bool ReadsAccumulator(
ImplicitRegisterUse implicit_register_use) {
return (implicit_register_use & ImplicitRegisterUse::kReadAccumulator) ==
ImplicitRegisterUse::kReadAccumulator;
}
// Returns true if |accumulator_use| writes the accumulator.
static constexpr bool WritesAccumulator(AccumulatorUse accumulator_use) {
return (accumulator_use & AccumulatorUse::kWrite) == AccumulatorUse::kWrite;
// Returns true if |implicit_register_use| writes the
// accumulator.
static constexpr bool WritesAccumulator(
ImplicitRegisterUse implicit_register_use) {
return (implicit_register_use & ImplicitRegisterUse::kWriteAccumulator) ==
ImplicitRegisterUse::kWriteAccumulator;
}
// Returns true if |operand_type| is a scalable signed byte.
......
......@@ -65,7 +65,7 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final
bool EnsureAllRegistersAreFlushed() const;
// Prepares for |bytecode|.
template <Bytecode bytecode, AccumulatorUse accumulator_use>
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use>
V8_INLINE void PrepareForBytecode() {
if (Bytecodes::IsJump(bytecode) || Bytecodes::IsSwitch(bytecode) ||
bytecode == Bytecode::kDebugger ||
......@@ -85,13 +85,13 @@ class V8_EXPORT_PRIVATE BytecodeRegisterOptimizer final
// Materialize the accumulator if it is read by the bytecode. The
// accumulator is special and no other register can be materialized
// in it's place.
if (BytecodeOperands::ReadsAccumulator(accumulator_use)) {
if (BytecodeOperands::ReadsAccumulator(implicit_register_use)) {
Materialize(accumulator_info_);
}
// Materialize an equivalent to the accumulator if it will be
// clobbered when the bytecode is dispatched.
if (BytecodeOperands::WritesAccumulator(accumulator_use)) {
if (BytecodeOperands::WritesAccumulator(implicit_register_use)) {
PrepareOutputRegister(accumulator_);
}
}
......
......@@ -76,7 +76,7 @@ struct SumHelper<value, values...> {
static const int kValue = value + SumHelper<values...>::kValue;
};
template <AccumulatorUse accumulator_use, OperandType... operands>
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
struct BytecodeTraits {
static const OperandType kOperandTypes[];
static const OperandTypeInfo kOperandTypeInfos[];
......@@ -89,33 +89,33 @@ struct BytecodeTraits {
1, OperandScaler<operands, OperandScale::kDouble>::kSize...>::kValue;
static const int kQuadrupleScaleSize = SumHelper<
1, OperandScaler<operands, OperandScale::kQuadruple>::kSize...>::kValue;
static const AccumulatorUse kAccumulatorUse = accumulator_use;
static const ImplicitRegisterUse kImplicitRegisterUse = implicit_register_use;
static const int kOperandCount = sizeof...(operands);
};
template <AccumulatorUse accumulator_use, OperandType... operands>
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandType
BytecodeTraits<accumulator_use, operands...>::kOperandTypes[] = {
BytecodeTraits<implicit_register_use, operands...>::kOperandTypes[] = {
operands...};
template <AccumulatorUse accumulator_use, OperandType... operands>
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandTypeInfo
BytecodeTraits<accumulator_use, operands...>::kOperandTypeInfos[] = {
BytecodeTraits<implicit_register_use, operands...>::kOperandTypeInfos[] = {
OperandTraits<operands>::kOperandTypeInfo...};
template <AccumulatorUse accumulator_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandSize
BytecodeTraits<accumulator_use, operands...>::kSingleScaleOperandSizes[] = {
OperandScaler<operands, OperandScale::kSingle>::kOperandSize...};
template <AccumulatorUse accumulator_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandSize
BytecodeTraits<accumulator_use, operands...>::kDoubleScaleOperandSizes[] = {
OperandScaler<operands, OperandScale::kDouble>::kOperandSize...};
template <AccumulatorUse accumulator_use, OperandType... operands>
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandSize BytecodeTraits<
implicit_register_use, operands...>::kSingleScaleOperandSizes[] = {
OperandScaler<operands, OperandScale::kSingle>::kOperandSize...};
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandSize BytecodeTraits<
implicit_register_use, operands...>::kDoubleScaleOperandSizes[] = {
OperandScaler<operands, OperandScale::kDouble>::kOperandSize...};
template <ImplicitRegisterUse implicit_register_use, OperandType... operands>
STATIC_CONST_MEMBER_DEFINITION const OperandSize BytecodeTraits<
accumulator_use, operands...>::kQuadrupleScaleOperandSizes[] = {
implicit_register_use, operands...>::kQuadrupleScaleOperandSizes[] = {
OperandScaler<operands, OperandScale::kQuadruple>::kOperandSize...};
template <AccumulatorUse accumulator_use>
struct BytecodeTraits<accumulator_use> {
template <ImplicitRegisterUse implicit_register_use>
struct BytecodeTraits<implicit_register_use> {
static const OperandType kOperandTypes[];
static const OperandTypeInfo kOperandTypeInfos[];
static const OperandSize kSingleScaleOperandSizes[];
......@@ -124,28 +124,29 @@ struct BytecodeTraits<accumulator_use> {
static const int kSingleScaleSize = 1;
static const int kDoubleScaleSize = 1;
static const int kQuadrupleScaleSize = 1;
static const AccumulatorUse kAccumulatorUse = accumulator_use;
static const ImplicitRegisterUse kImplicitRegisterUse = implicit_register_use;
static const int kOperandCount = 0;
};
template <AccumulatorUse accumulator_use>
template <ImplicitRegisterUse implicit_register_use>
STATIC_CONST_MEMBER_DEFINITION const OperandType
BytecodeTraits<accumulator_use>::kOperandTypes[] = {OperandType::kNone};
template <AccumulatorUse accumulator_use>
BytecodeTraits<implicit_register_use>::kOperandTypes[] = {
OperandType::kNone};
template <ImplicitRegisterUse implicit_register_use>
STATIC_CONST_MEMBER_DEFINITION const OperandTypeInfo
BytecodeTraits<accumulator_use>::kOperandTypeInfos[] = {
BytecodeTraits<implicit_register_use>::kOperandTypeInfos[] = {
OperandTypeInfo::kNone};
template <AccumulatorUse accumulator_use>
template <ImplicitRegisterUse implicit_register_use>
STATIC_CONST_MEMBER_DEFINITION const OperandSize
BytecodeTraits<accumulator_use>::kSingleScaleOperandSizes[] = {
BytecodeTraits<implicit_register_use>::kSingleScaleOperandSizes[] = {
OperandSize::kNone};
template <AccumulatorUse accumulator_use>
template <ImplicitRegisterUse implicit_register_use>
STATIC_CONST_MEMBER_DEFINITION const OperandSize
BytecodeTraits<accumulator_use>::kDoubleScaleOperandSizes[] = {
BytecodeTraits<implicit_register_use>::kDoubleScaleOperandSizes[] = {
OperandSize::kNone};
template <AccumulatorUse accumulator_use>
template <ImplicitRegisterUse implicit_register_use>
STATIC_CONST_MEMBER_DEFINITION const OperandSize
BytecodeTraits<accumulator_use>::kQuadrupleScaleOperandSizes[] = {
BytecodeTraits<implicit_register_use>::kQuadrupleScaleOperandSizes[] = {
OperandSize::kNone};
} // namespace interpreter
......
......@@ -32,8 +32,8 @@ const int Bytecodes::kOperandCount[] = {
#undef ENTRY
};
const AccumulatorUse Bytecodes::kAccumulatorUse[] = {
#define ENTRY(Name, ...) BytecodeTraits<__VA_ARGS__>::kAccumulatorUse,
const ImplicitRegisterUse Bytecodes::kImplicitRegisterUse[] = {
#define ENTRY(Name, ...) BytecodeTraits<__VA_ARGS__>::kImplicitRegisterUse,
BYTECODE_LIST(ENTRY)
#undef ENTRY
};
......
......@@ -22,354 +22,409 @@ namespace internal {
namespace interpreter {
// The list of bytecodes which are interpreted by the interpreter.
// Format is V(<bytecode>, <accumulator_use>, <operands>).
// Format is V(<bytecode>, <implicit_register_use>, <operands>).
#define BYTECODE_LIST(V) \
/* Extended width operands */ \
V(Wide, AccumulatorUse::kNone) \
V(ExtraWide, AccumulatorUse::kNone) \
V(Wide, ImplicitRegisterUse::kNone) \
V(ExtraWide, ImplicitRegisterUse::kNone) \
\
/* Debug Breakpoints - one for each possible size of unscaled bytecodes */ \
/* and one for each operand widening prefix bytecode */ \
V(DebugBreakWide, AccumulatorUse::kReadWrite) \
V(DebugBreakExtraWide, AccumulatorUse::kReadWrite) \
V(DebugBreak0, AccumulatorUse::kReadWrite) \
V(DebugBreak1, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(DebugBreak2, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(DebugBreakWide, ImplicitRegisterUse::kReadWriteAccumulator) \
V(DebugBreakExtraWide, ImplicitRegisterUse::kReadWriteAccumulator) \
V(DebugBreak0, ImplicitRegisterUse::kReadWriteAccumulator) \
V(DebugBreak1, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg) \
V(DebugBreak3, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(DebugBreak2, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kReg) \
V(DebugBreak4, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kReg, OperandType::kReg, OperandType::kReg) \
V(DebugBreak5, AccumulatorUse::kReadWrite, OperandType::kRuntimeId, \
OperandType::kReg, OperandType::kReg) \
V(DebugBreak6, AccumulatorUse::kReadWrite, OperandType::kRuntimeId, \
V(DebugBreak3, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kReg) \
V(DebugBreak4, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kReg, \
OperandType::kReg) \
V(DebugBreak5, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kRuntimeId, OperandType::kReg, OperandType::kReg) \
V(DebugBreak6, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kRuntimeId, OperandType::kReg, OperandType::kReg, \
OperandType::kReg) \
\
/* Loading the accumulator */ \
V(LdaZero, AccumulatorUse::kWrite) \
V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \
V(LdaUndefined, AccumulatorUse::kWrite) \
V(LdaNull, AccumulatorUse::kWrite) \
V(LdaTheHole, AccumulatorUse::kWrite) \
V(LdaTrue, AccumulatorUse::kWrite) \
V(LdaFalse, AccumulatorUse::kWrite) \
V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaZero, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaSmi, ImplicitRegisterUse::kWriteAccumulator, OperandType::kImm) \
V(LdaUndefined, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaNull, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaTheHole, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaTrue, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaFalse, ImplicitRegisterUse::kWriteAccumulator) \
V(LdaConstant, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx) \
\
/* Globals */ \
V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \
V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \
V(LdaGlobal, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx, \
OperandType::kIdx) \
V(LdaGlobalInsideTypeof, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx) \
V(StaGlobal, ImplicitRegisterUse::kReadAccumulator, OperandType::kIdx, \
OperandType::kIdx) \
V(StaGlobal, AccumulatorUse::kRead, OperandType::kIdx, OperandType::kIdx) \
\
/* Context operations */ \
V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \
V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \
V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \
V(PushContext, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut) \
V(PopContext, ImplicitRegisterUse::kNone, OperandType::kReg) \
V(LdaContextSlot, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kIdx, OperandType::kUImm) \
V(LdaImmutableContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kUImm) \
V(LdaCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaImmutableCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \
V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \
V(LdaImmutableContextSlot, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kUImm) \
V(LdaCurrentContextSlot, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx) \
V(LdaImmutableCurrentContextSlot, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx) \
V(StaContextSlot, ImplicitRegisterUse::kReadAccumulator, OperandType::kReg, \
OperandType::kIdx, OperandType::kUImm) \
V(StaCurrentContextSlot, AccumulatorUse::kRead, OperandType::kIdx) \
V(StaCurrentContextSlot, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
\
/* Load-Store lookup slots */ \
V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaLookupContextSlot, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx, OperandType::kUImm) \
V(LdaLookupGlobalSlot, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx, OperandType::kUImm) \
V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \
V(LdaLookupContextSlotInsideTypeof, AccumulatorUse::kWrite, \
V(LdaLookupSlot, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx) \
V(LdaLookupContextSlot, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \
V(LdaLookupGlobalSlotInsideTypeof, AccumulatorUse::kWrite, \
V(LdaLookupGlobalSlot, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \
V(StaLookupSlot, AccumulatorUse::kReadWrite, OperandType::kIdx, \
OperandType::kFlag8) \
V(LdaLookupSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx) \
V(LdaLookupContextSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \
V(LdaLookupGlobalSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \
V(StaLookupSlot, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kIdx, OperandType::kFlag8) \
\
/* Register-accumulator transfers */ \
V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \
V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \
V(Ldar, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg) \
V(Star, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut) \
\
/* Register-register transfers */ \
V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \
V(Mov, ImplicitRegisterUse::kNone, OperandType::kReg, OperandType::kRegOut) \
\
/* Property loads (LoadIC) operations */ \
V(LdaNamedProperty, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
V(LdaNamedPropertyNoFeedback, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx) \
V(LdaNamedPropertyFromSuper, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
V(LdaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(LdaNamedProperty, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \
V(LdaNamedPropertyNoFeedback, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(LdaNamedPropertyFromSuper, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \
V(LdaKeyedProperty, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
\
/* Operations on module variables */ \
V(LdaModuleVariable, AccumulatorUse::kWrite, OperandType::kImm, \
OperandType::kUImm) \
V(StaModuleVariable, AccumulatorUse::kRead, OperandType::kImm, \
OperandType::kUImm) \
V(LdaModuleVariable, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kImm, OperandType::kUImm) \
V(StaModuleVariable, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kImm, OperandType::kUImm) \
\
/* Propery stores (StoreIC) operations */ \
V(StaNamedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
V(StaNamedPropertyNoFeedback, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kFlag8) \
V(StaNamedOwnProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
V(StaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kReg, OperandType::kIdx) \
V(StaInArrayLiteral, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kReg, OperandType::kIdx) \
V(StaDataPropertyInLiteral, AccumulatorUse::kRead, OperandType::kReg, \
OperandType::kReg, OperandType::kFlag8, OperandType::kIdx) \
V(CollectTypeProfile, AccumulatorUse::kRead, OperandType::kImm) \
V(StaNamedProperty, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \
V(StaNamedPropertyNoFeedback, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kFlag8) \
V(StaNamedOwnProperty, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \
V(StaKeyedProperty, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
V(StaInArrayLiteral, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
V(StaDataPropertyInLiteral, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kFlag8, \
OperandType::kIdx) \
V(CollectTypeProfile, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kImm) \
\
/* Binary Operators */ \
V(Add, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Div, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Exp, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(Add, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(Sub, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(Mul, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(Div, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(Mod, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(Exp, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(BitwiseOr, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(BitwiseXor, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(BitwiseAnd, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(ShiftLeft, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRight, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRightLogical, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
\
/* Binary operators with immediate operands */ \
V(AddSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(SubSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(MulSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(DivSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(ModSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(ExpSmi, AccumulatorUse::kReadWrite, OperandType::kImm, OperandType::kIdx) \
V(BitwiseOrSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(AddSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(BitwiseXorSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(SubSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(BitwiseAndSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(MulSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(ShiftLeftSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(DivSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(ShiftRightSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(ModSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(ShiftRightLogicalSmi, AccumulatorUse::kReadWrite, OperandType::kImm, \
V(ExpSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm, \
OperandType::kIdx) \
V(BitwiseOrSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
V(BitwiseXorSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
V(BitwiseAndSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
V(ShiftLeftSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
V(ShiftRightSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
V(ShiftRightLogicalSmi, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kImm, OperandType::kIdx) \
\
/* Unary Operators */ \
V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(Negate, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(BitwiseNot, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \
V(LogicalNot, AccumulatorUse::kReadWrite) \
V(TypeOf, AccumulatorUse::kReadWrite) \
V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Inc, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(Dec, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(Negate, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(BitwiseNot, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(ToBooleanLogicalNot, ImplicitRegisterUse::kReadWriteAccumulator) \
V(LogicalNot, ImplicitRegisterUse::kReadWriteAccumulator) \
V(TypeOf, ImplicitRegisterUse::kReadWriteAccumulator) \
V(DeletePropertyStrict, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg) \
V(DeletePropertySloppy, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg) \
\
/* GetSuperConstructor operator */ \
V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \
V(GetSuperConstructor, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kRegOut) \
\
/* Call operations */ \
V(CallAnyReceiver, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallAnyReceiver, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kRegList, OperandType::kRegCount, \
OperandType::kIdx) \
V(CallProperty, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(CallProperty0, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallProperty0, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kReg, OperandType::kIdx) \
V(CallProperty1, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallProperty1, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
V(CallProperty2, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallProperty2, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kReg, OperandType::kReg, OperandType::kReg, \
OperandType::kIdx) \
V(CallUndefinedReceiver, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(CallUndefinedReceiver0, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallUndefinedReceiver, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kRegList, OperandType::kRegCount, \
OperandType::kIdx) \
V(CallUndefinedReceiver1, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallUndefinedReceiver0, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(CallUndefinedReceiver2, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallUndefinedReceiver1, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
V(CallNoFeedback, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallUndefinedReceiver2, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kReg, OperandType::kReg, \
OperandType::kIdx) \
V(CallNoFeedback, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount) \
V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \
V(CallWithSpread, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \
OperandType::kRegList, OperandType::kRegCount) \
V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \
V(CallRuntime, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kRuntimeId, OperandType::kRegList, OperandType::kRegCount) \
V(CallRuntimeForPair, ImplicitRegisterUse::kNone, OperandType::kRuntimeId, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \
V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kNativeContextIndex, \
OperandType::kRegList, OperandType::kRegCount) \
V(CallJSRuntime, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kNativeContextIndex, OperandType::kRegList, \
OperandType::kRegCount) \
\
/* Intrinsics */ \
V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kIntrinsicId, \
OperandType::kRegList, OperandType::kRegCount) \
V(InvokeIntrinsic, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIntrinsicId, OperandType::kRegList, OperandType::kRegCount) \
\
/* Construct operators */ \
V(Construct, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(ConstructWithSpread, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(Construct, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
V(ConstructWithSpread, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kRegList, OperandType::kRegCount, \
OperandType::kIdx) \
\
/* Test Operators */ \
V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestGreaterThan, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestLessThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(TestGreaterThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(TestEqual, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(TestReferenceEqual, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(TestInstanceOf, AccumulatorUse::kReadWrite, OperandType::kReg, \
V(TestEqualStrict, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestLessThan, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestGreaterThan, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestLessThanOrEqual, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestGreaterThanOrEqual, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestReferenceEqual, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg) \
V(TestInstanceOf, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(TestIn, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
OperandType::kIdx) \
V(TestIn, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(TestUndetectable, AccumulatorUse::kReadWrite) \
V(TestNull, AccumulatorUse::kReadWrite) \
V(TestUndefined, AccumulatorUse::kReadWrite) \
V(TestTypeOf, AccumulatorUse::kReadWrite, OperandType::kFlag8) \
V(TestUndetectable, ImplicitRegisterUse::kReadWriteAccumulator) \
V(TestNull, ImplicitRegisterUse::kReadWriteAccumulator) \
V(TestUndefined, ImplicitRegisterUse::kReadWriteAccumulator) \
V(TestTypeOf, ImplicitRegisterUse::kReadWriteAccumulator, \
OperandType::kFlag8) \
\
/* Cast operators */ \
V(ToName, AccumulatorUse::kRead, OperandType::kRegOut) \
V(ToNumber, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(ToNumeric, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(ToObject, AccumulatorUse::kRead, OperandType::kRegOut) \
V(ToString, AccumulatorUse::kReadWrite) \
V(ToName, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut) \
V(ToNumber, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(ToNumeric, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
V(ToObject, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut) \
V(ToString, ImplicitRegisterUse::kReadWriteAccumulator) \
\
/* Literals */ \
V(CreateRegExpLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx, OperandType::kFlag8) \
V(CreateArrayLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx, OperandType::kFlag8) \
V(CreateArrayFromIterable, AccumulatorUse::kReadWrite) \
V(CreateEmptyArrayLiteral, AccumulatorUse::kWrite, OperandType::kIdx) \
V(CreateObjectLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx, OperandType::kFlag8) \
V(CreateEmptyObjectLiteral, AccumulatorUse::kWrite) \
V(CloneObject, AccumulatorUse::kWrite, OperandType::kReg, \
V(CreateRegExpLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \
V(CreateArrayLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \
V(CreateArrayFromIterable, ImplicitRegisterUse::kReadWriteAccumulator) \
V(CreateEmptyArrayLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx) \
V(CreateObjectLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \
V(CreateEmptyObjectLiteral, ImplicitRegisterUse::kWriteAccumulator) \
V(CloneObject, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kFlag8, OperandType::kIdx) \
\
/* Tagged templates */ \
V(GetTemplateObject, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kIdx) \
V(GetTemplateObject, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx) \
\
/* Closure allocation */ \
V(CreateClosure, AccumulatorUse::kWrite, OperandType::kIdx, \
V(CreateClosure, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx, \
OperandType::kIdx, OperandType::kFlag8) \
\
/* Context allocation */ \
V(CreateBlockContext, AccumulatorUse::kWrite, OperandType::kIdx) \
V(CreateCatchContext, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx) \
V(CreateFunctionContext, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kUImm) \
V(CreateEvalContext, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kUImm) \
V(CreateWithContext, AccumulatorUse::kWrite, OperandType::kReg, \
V(CreateBlockContext, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx) \
V(CreateCatchContext, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
V(CreateFunctionContext, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kUImm) \
V(CreateEvalContext, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kUImm) \
V(CreateWithContext, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kIdx) \
\
/* Arguments allocation */ \
V(CreateMappedArguments, AccumulatorUse::kWrite) \
V(CreateUnmappedArguments, AccumulatorUse::kWrite) \
V(CreateRestParameter, AccumulatorUse::kWrite) \
V(CreateMappedArguments, ImplicitRegisterUse::kWriteAccumulator) \
V(CreateUnmappedArguments, ImplicitRegisterUse::kWriteAccumulator) \
V(CreateRestParameter, ImplicitRegisterUse::kWriteAccumulator) \
\
/* Control Flow -- carefully ordered for efficient checks */ \
/* - [Unconditional jumps] */ \
V(JumpLoop, AccumulatorUse::kNone, OperandType::kUImm, OperandType::kImm) \
V(JumpLoop, ImplicitRegisterUse::kNone, OperandType::kUImm, \
OperandType::kImm) \
/* - [Forward jumps] */ \
V(Jump, AccumulatorUse::kNone, OperandType::kUImm) \
V(Jump, ImplicitRegisterUse::kNone, OperandType::kUImm) \
/* - [Start constant jumps] */ \
V(JumpConstant, AccumulatorUse::kNone, OperandType::kIdx) \
V(JumpConstant, ImplicitRegisterUse::kNone, OperandType::kIdx) \
/* - [Conditional jumps] */ \
/* - [Conditional constant jumps] */ \
V(JumpIfNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfNotNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfUndefinedConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfNotUndefinedConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfUndefinedOrNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfJSReceiverConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfNullConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfNotNullConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfUndefinedConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfNotUndefinedConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfUndefinedOrNullConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfTrueConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfFalseConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfJSReceiverConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
/* - [Start ToBoolean jumps] */ \
V(JumpIfToBooleanTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfToBooleanFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \
V(JumpIfToBooleanTrueConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(JumpIfToBooleanFalseConstant, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
/* - [End constant jumps] */ \
/* - [Conditional immediate jumps] */ \
V(JumpIfToBooleanTrue, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfToBooleanFalse, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfToBooleanTrue, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
V(JumpIfToBooleanFalse, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
/* - [End ToBoolean jumps] */ \
V(JumpIfTrue, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfFalse, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfNull, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfNotNull, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfUndefined, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfNotUndefined, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfUndefinedOrNull, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfJSReceiver, AccumulatorUse::kRead, OperandType::kUImm) \
V(JumpIfTrue, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm) \
V(JumpIfFalse, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm) \
V(JumpIfNull, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm) \
V(JumpIfNotNull, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm) \
V(JumpIfUndefined, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
V(JumpIfNotUndefined, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
V(JumpIfUndefinedOrNull, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
V(JumpIfJSReceiver, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kUImm) \
\
/* Smi-table lookup for switch statements */ \
V(SwitchOnSmiNoFeedback, AccumulatorUse::kRead, OperandType::kIdx, \
OperandType::kUImm, OperandType::kImm) \
V(SwitchOnSmiNoFeedback, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx, OperandType::kUImm, OperandType::kImm) \
\
/* Complex flow control For..in */ \
V(ForInEnumerate, AccumulatorUse::kWrite, OperandType::kReg) \
V(ForInPrepare, AccumulatorUse::kRead, OperandType::kRegOutTriple, \
OperandType::kIdx) \
V(ForInContinue, AccumulatorUse::kWrite, OperandType::kReg, \
V(ForInEnumerate, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg) \
V(ForInPrepare, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kRegOutTriple, OperandType::kIdx) \
V(ForInContinue, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kReg) \
V(ForInNext, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \
OperandType::kRegPair, OperandType::kIdx) \
V(ForInStep, AccumulatorUse::kWrite, OperandType::kReg) \
V(ForInNext, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kReg, OperandType::kRegPair, OperandType::kIdx) \
V(ForInStep, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg) \
\
/* Update the pending message */ \
V(SetPendingMessage, AccumulatorUse::kReadWrite) \
V(SetPendingMessage, ImplicitRegisterUse::kReadWriteAccumulator) \
\
/* Non-local flow control */ \
V(Throw, AccumulatorUse::kRead) \
V(ReThrow, AccumulatorUse::kRead) \
V(Return, AccumulatorUse::kRead) \
V(ThrowReferenceErrorIfHole, AccumulatorUse::kRead, OperandType::kIdx) \
V(ThrowSuperNotCalledIfHole, AccumulatorUse::kRead) \
V(ThrowSuperAlreadyCalledIfNotHole, AccumulatorUse::kRead) \
V(ThrowIfNotSuperConstructor, AccumulatorUse::kNone, OperandType::kReg) \
V(Throw, ImplicitRegisterUse::kReadAccumulator) \
V(ReThrow, ImplicitRegisterUse::kReadAccumulator) \
V(Return, ImplicitRegisterUse::kReadAccumulator) \
V(ThrowReferenceErrorIfHole, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kIdx) \
V(ThrowSuperNotCalledIfHole, ImplicitRegisterUse::kReadAccumulator) \
V(ThrowSuperAlreadyCalledIfNotHole, ImplicitRegisterUse::kReadAccumulator) \
V(ThrowIfNotSuperConstructor, ImplicitRegisterUse::kNone, OperandType::kReg) \
\
/* Generators */ \
V(SwitchOnGeneratorState, AccumulatorUse::kNone, OperandType::kReg, \
V(SwitchOnGeneratorState, ImplicitRegisterUse::kNone, OperandType::kReg, \
OperandType::kIdx, OperandType::kUImm) \
V(SuspendGenerator, AccumulatorUse::kRead, OperandType::kReg, \
OperandType::kRegList, OperandType::kRegCount, OperandType::kUImm) \
V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kRegOutList, OperandType::kRegCount) \
V(SuspendGenerator, ImplicitRegisterUse::kReadAccumulator, \
OperandType::kReg, OperandType::kRegList, OperandType::kRegCount, \
OperandType::kUImm) \
V(ResumeGenerator, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kReg, OperandType::kRegOutList, OperandType::kRegCount) \
\
/* Iterator protocol operations */ \
V(GetIterator, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx, \
OperandType::kIdx) \
V(GetIterator, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
\
/* Debugger */ \
V(Debugger, AccumulatorUse::kNone) \
V(Debugger, ImplicitRegisterUse::kNone) \
\
/* Block Coverage */ \
V(IncBlockCounter, AccumulatorUse::kNone, OperandType::kIdx) \
V(IncBlockCounter, ImplicitRegisterUse::kNone, OperandType::kIdx) \
\
/* Execution Abort (internal error) */ \
V(Abort, AccumulatorUse::kNone, OperandType::kIdx) \
V(Abort, ImplicitRegisterUse::kNone, OperandType::kIdx) \
\
/* Illegal bytecode */ \
V(Illegal, AccumulatorUse::kNone)
V(Illegal, ImplicitRegisterUse::kNone)
// List of debug break bytecodes.
#define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \
......@@ -535,19 +590,20 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
}
// Returns how accumulator is used by |bytecode|.
static AccumulatorUse GetAccumulatorUse(Bytecode bytecode) {
static ImplicitRegisterUse GetImplicitRegisterUse(Bytecode bytecode) {
DCHECK_LE(bytecode, Bytecode::kLast);
return kAccumulatorUse[static_cast<size_t>(bytecode)];
return kImplicitRegisterUse[static_cast<size_t>(bytecode)];
}
// Returns true if |bytecode| reads the accumulator.
static bool ReadsAccumulator(Bytecode bytecode) {
return BytecodeOperands::ReadsAccumulator(GetAccumulatorUse(bytecode));
return BytecodeOperands::ReadsAccumulator(GetImplicitRegisterUse(bytecode));
}
// Returns true if |bytecode| writes the accumulator.
static bool WritesAccumulator(Bytecode bytecode) {
return BytecodeOperands::WritesAccumulator(GetAccumulatorUse(bytecode));
return BytecodeOperands::WritesAccumulator(
GetImplicitRegisterUse(bytecode));
}
// Return true if |bytecode| is an accumulator load without effects,
......@@ -943,7 +999,7 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
static const OperandTypeInfo* const kOperandTypeInfos[];
static const int kOperandCount[];
static const int kNumberOfRegisterOperands[];
static const AccumulatorUse kAccumulatorUse[];
static const ImplicitRegisterUse kImplicitRegisterUse[];
static const bool kIsScalable[];
static const uint8_t kBytecodeSizes[3][kBytecodeCount];
static const OperandSize* const kOperandSizes[3][kBytecodeCount];
......
......@@ -42,7 +42,7 @@ InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
TVARIABLE_CONSTRUCTOR(
accumulator_,
Parameter<Object>(InterpreterDispatchDescriptor::kAccumulator)),
accumulator_use_(AccumulatorUse::kNone),
implicit_register_use_(ImplicitRegisterUse::kNone),
made_call_(false),
reloaded_frame_ptr_(false),
bytecode_array_valid_(true) {
......@@ -64,7 +64,8 @@ InterpreterAssembler::~InterpreterAssembler() {
// If the following check fails the handler does not use the
// accumulator in the way described in the bytecode definitions in
// bytecodes.h.
DCHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_));
DCHECK_EQ(implicit_register_use_,
Bytecodes::GetImplicitRegisterUse(bytecode_));
UnregisterCallGenerationCallbacks();
}
......@@ -154,13 +155,15 @@ TNode<Object> InterpreterAssembler::GetAccumulatorUnchecked() {
TNode<Object> InterpreterAssembler::GetAccumulator() {
DCHECK(Bytecodes::ReadsAccumulator(bytecode_));
accumulator_use_ = accumulator_use_ | AccumulatorUse::kRead;
implicit_register_use_ =
implicit_register_use_ | ImplicitRegisterUse::kReadAccumulator;
return TaggedPoisonOnSpeculation(GetAccumulatorUnchecked());
}
void InterpreterAssembler::SetAccumulator(TNode<Object> value) {
DCHECK(Bytecodes::WritesAccumulator(bytecode_));
accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite;
implicit_register_use_ =
implicit_register_use_ | ImplicitRegisterUse::kWriteAccumulator;
accumulator_ = value;
}
......@@ -754,7 +757,8 @@ void InterpreterAssembler::CallJSAndDispatch(
args_count, args.base_reg_location(),
function);
// TailCallStubThenDispatch updates accumulator with result.
accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite;
implicit_register_use_ =
implicit_register_use_ | ImplicitRegisterUse::kWriteAccumulator;
}
template <class... TArgs>
......@@ -780,7 +784,8 @@ void InterpreterAssembler::CallJSAndDispatch(TNode<Object> function,
context, function, arg_count, args...);
}
// TailCallStubThenDispatch updates accumulator with result.
accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite;
implicit_register_use_ =
implicit_register_use_ | ImplicitRegisterUse::kWriteAccumulator;
}
// Instantiate CallJSAndDispatch() for argument counts used by interpreter
......@@ -817,7 +822,8 @@ void InterpreterAssembler::CallJSWithSpreadAndDispatch(
args_count, args.base_reg_location(),
function);
// TailCallStubThenDispatch updates accumulator with result.
accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite;
implicit_register_use_ =
implicit_register_use_ | ImplicitRegisterUse::kWriteAccumulator;
}
TNode<Object> InterpreterAssembler::Construct(
......@@ -1158,10 +1164,10 @@ TNode<WordT> InterpreterAssembler::StarDispatchLookahead(
void InterpreterAssembler::InlineStar() {
Bytecode previous_bytecode = bytecode_;
AccumulatorUse previous_acc_use = accumulator_use_;
ImplicitRegisterUse previous_acc_use = implicit_register_use_;
bytecode_ = Bytecode::kStar;
accumulator_use_ = AccumulatorUse::kNone;
implicit_register_use_ = ImplicitRegisterUse::kNone;
#ifdef V8_TRACE_IGNITION
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
......@@ -1169,11 +1175,12 @@ void InterpreterAssembler::InlineStar() {
StoreRegister(GetAccumulator(),
BytecodeOperandReg(0, LoadSensitivity::kSafe));
DCHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_));
DCHECK_EQ(implicit_register_use_,
Bytecodes::GetImplicitRegisterUse(bytecode_));
Advance();
bytecode_ = previous_bytecode;
accumulator_use_ = previous_acc_use;
implicit_register_use_ = previous_acc_use;
}
void InterpreterAssembler::Dispatch() {
......
......@@ -398,7 +398,7 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
CodeStubAssembler::TVariable<IntPtrT> bytecode_offset_;
CodeStubAssembler::TVariable<ExternalReference> dispatch_table_;
CodeStubAssembler::TVariable<Object> accumulator_;
AccumulatorUse accumulator_use_;
ImplicitRegisterUse implicit_register_use_;
bool made_call_;
bool reloaded_frame_ptr_;
bool bytecode_array_valid_;
......
......@@ -81,7 +81,8 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) {
Register temp = NewTemporary();
optimizer()->DoStar(temp);
CHECK_EQ(write_count(), 0u);
optimizer()->PrepareForBytecode<Bytecode::kJump, AccumulatorUse::kNone>();
optimizer()
->PrepareForBytecode<Bytecode::kJump, ImplicitRegisterUse::kNone>();
CHECK_EQ(write_count(), 1u);
CHECK_EQ(output()->at(0).bytecode, Bytecode::kStar);
CHECK_EQ(output()->at(0).output.index(), temp.index());
......@@ -98,19 +99,25 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryNotEmitted) {
optimizer()->DoStar(temp);
ReleaseTemporaries(temp);
CHECK_EQ(write_count(), 0u);
optimizer()->PrepareForBytecode<Bytecode::kReturn, AccumulatorUse::kRead>();
optimizer()
->PrepareForBytecode<Bytecode::kReturn,
ImplicitRegisterUse::kReadAccumulator>();
CHECK_EQ(output()->at(0).bytecode, Bytecode::kLdar);
CHECK_EQ(output()->at(0).input.index(), parameter.index());
}
TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
Initialize(3, 1);
optimizer()->PrepareForBytecode<Bytecode::kLdaSmi, AccumulatorUse::kWrite>();
optimizer()
->PrepareForBytecode<Bytecode::kLdaSmi,
ImplicitRegisterUse::kWriteAccumulator>();
Register temp0 = NewTemporary();
Register temp1 = NewTemporary();
optimizer()->DoStar(temp1);
CHECK_EQ(write_count(), 0u);
optimizer()->PrepareForBytecode<Bytecode::kLdaSmi, AccumulatorUse::kWrite>();
optimizer()
->PrepareForBytecode<Bytecode::kLdaSmi,
ImplicitRegisterUse::kWriteAccumulator>();
CHECK_EQ(write_count(), 1u);
CHECK_EQ(output()->at(0).bytecode, Bytecode::kStar);
CHECK_EQ(output()->at(0).output.index(), temp1.index());
......@@ -120,7 +127,9 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
CHECK_EQ(write_count(), 1u);
optimizer()->DoLdar(temp0);
CHECK_EQ(write_count(), 1u);
optimizer()->PrepareForBytecode<Bytecode::kReturn, AccumulatorUse::kRead>();
optimizer()
->PrepareForBytecode<Bytecode::kReturn,
ImplicitRegisterUse::kReadAccumulator>();
CHECK_EQ(write_count(), 2u);
CHECK_EQ(output()->at(1).bytecode, Bytecode::kLdar);
CHECK_EQ(output()->at(1).input.index(), temp1.index());
......@@ -128,7 +137,9 @@ TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) {
TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) {
Initialize(3, 1);
optimizer()->PrepareForBytecode<Bytecode::kLdaSmi, AccumulatorUse::kWrite>();
optimizer()
->PrepareForBytecode<Bytecode::kLdaSmi,
ImplicitRegisterUse::kWriteAccumulator>();
Register temp0 = NewTemporary();
Register temp1 = NewTemporary();
optimizer()->DoStar(temp0);
......@@ -154,7 +165,9 @@ TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) {
CHECK_EQ(output()->at(0).input.index(), parameter.index());
CHECK_EQ(output()->at(0).output.index(), local.index());
optimizer()->PrepareForBytecode<Bytecode::kReturn, AccumulatorUse::kRead>();
optimizer()
->PrepareForBytecode<Bytecode::kReturn,
ImplicitRegisterUse::kReadAccumulator>();
CHECK_EQ(write_count(), 2u);
CHECK_EQ(output()->at(1).bytecode, Bytecode::kLdar);
CHECK_EQ(output()->at(1).input.index(), local.index());
......@@ -183,13 +196,16 @@ TEST_F(BytecodeRegisterOptimizerTest, RangeOfTemporariesMaterializedForInput) {
Register parameter = Register::FromParameterIndex(1, 3);
Register temp0 = NewTemporary();
Register temp1 = NewTemporary();
optimizer()->PrepareForBytecode<Bytecode::kLdaSmi, AccumulatorUse::kWrite>();
optimizer()
->PrepareForBytecode<Bytecode::kLdaSmi,
ImplicitRegisterUse::kWriteAccumulator>();
optimizer()->DoStar(temp0);
optimizer()->DoMov(parameter, temp1);
CHECK_EQ(write_count(), 0u);
optimizer()
->PrepareForBytecode<Bytecode::kCallJSRuntime, AccumulatorUse::kWrite>();
->PrepareForBytecode<Bytecode::kCallJSRuntime,
ImplicitRegisterUse::kWriteAccumulator>();
RegisterList reg_list = optimizer()->GetInputRegisterList(
BytecodeUtils::NewRegisterList(temp0.index(), 2));
CHECK_EQ(temp0.index(), reg_list.first_register().index());
......
......@@ -333,30 +333,33 @@ TEST(OperandScale, PrefixesRequired) {
Bytecode::kExtraWide);
}
TEST(AccumulatorUse, LogicalOperators) {
CHECK_EQ(AccumulatorUse::kNone | AccumulatorUse::kRead,
AccumulatorUse::kRead);
CHECK_EQ(AccumulatorUse::kRead | AccumulatorUse::kWrite,
AccumulatorUse::kReadWrite);
CHECK_EQ(AccumulatorUse::kRead & AccumulatorUse::kReadWrite,
AccumulatorUse::kRead);
CHECK_EQ(AccumulatorUse::kRead & AccumulatorUse::kWrite,
AccumulatorUse::kNone);
TEST(ImplicitRegisterUse, LogicalOperators) {
CHECK_EQ(ImplicitRegisterUse::kNone | ImplicitRegisterUse::kReadAccumulator,
ImplicitRegisterUse::kReadAccumulator);
CHECK_EQ(ImplicitRegisterUse::kReadAccumulator |
ImplicitRegisterUse::kWriteAccumulator,
ImplicitRegisterUse::kReadWriteAccumulator);
CHECK_EQ(ImplicitRegisterUse::kReadAccumulator &
ImplicitRegisterUse::kReadWriteAccumulator,
ImplicitRegisterUse::kReadAccumulator);
CHECK_EQ(ImplicitRegisterUse::kReadAccumulator &
ImplicitRegisterUse::kWriteAccumulator,
ImplicitRegisterUse::kNone);
}
TEST(AccumulatorUse, SampleBytecodes) {
TEST(ImplicitRegisterUse, SampleBytecodes) {
CHECK(Bytecodes::ReadsAccumulator(Bytecode::kStar));
CHECK(!Bytecodes::WritesAccumulator(Bytecode::kStar));
CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kStar),
AccumulatorUse::kRead);
CHECK_EQ(Bytecodes::GetImplicitRegisterUse(Bytecode::kStar),
ImplicitRegisterUse::kReadAccumulator);
CHECK(!Bytecodes::ReadsAccumulator(Bytecode::kLdar));
CHECK(Bytecodes::WritesAccumulator(Bytecode::kLdar));
CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kLdar),
AccumulatorUse::kWrite);
CHECK_EQ(Bytecodes::GetImplicitRegisterUse(Bytecode::kLdar),
ImplicitRegisterUse::kWriteAccumulator);
CHECK(Bytecodes::ReadsAccumulator(Bytecode::kAdd));
CHECK(Bytecodes::WritesAccumulator(Bytecode::kAdd));
CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kAdd),
AccumulatorUse::kReadWrite);
CHECK_EQ(Bytecodes::GetImplicitRegisterUse(Bytecode::kAdd),
ImplicitRegisterUse::kReadWriteAccumulator);
}
} // namespace interpreter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment