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