Commit bd304e12 authored by Toon Verwaest's avatar Toon Verwaest Committed by V8 LUCI CQ

[maglev] Reuse constants across the graph

This moves constant nodes to separate data structures on the graph so
they can be looked up there. Graph processors walk the constants before
walking other nodes.

Bug: v8:7700
Change-Id: Id4bec2c2a26011dcacf3355fe17d821451f79397
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3706625
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81195}
parent aeddf8c4
...@@ -47,7 +47,24 @@ namespace maglev { ...@@ -47,7 +47,24 @@ namespace maglev {
class NumberingProcessor { class NumberingProcessor {
public: public:
void PreProcessGraph(MaglevCompilationInfo*, Graph* graph) { node_id_ = 1; } void PreProcessGraph(MaglevCompilationInfo*, Graph* graph) {
node_id_ = 1;
for (Constant* constant : graph->constants()) {
constant->set_id(node_id_++);
}
for (const auto& [index, constant] : graph->root()) {
constant->set_id(node_id_++);
}
for (const auto& [index, constant] : graph->smi()) {
constant->set_id(node_id_++);
}
for (const auto& [index, constant] : graph->int32()) {
constant->set_id(node_id_++);
}
for (const auto& [index, constant] : graph->float64()) {
constant->set_id(node_id_++);
}
}
void PostProcessGraph(MaglevCompilationInfo*, Graph* graph) {} void PostProcessGraph(MaglevCompilationInfo*, Graph* graph) {}
void PreProcessBasicBlock(MaglevCompilationInfo*, BasicBlock* block) {} void PreProcessBasicBlock(MaglevCompilationInfo*, BasicBlock* block) {}
......
...@@ -110,8 +110,7 @@ void MaglevGraphBuilder::BuildRegisterFrameInitialization() { ...@@ -110,8 +110,7 @@ void MaglevGraphBuilder::BuildRegisterFrameInitialization() {
int register_index = 0; int register_index = 0;
// TODO(leszeks): Don't emit if not needed. // TODO(leszeks): Don't emit if not needed.
ValueNode* undefined_value = ValueNode* undefined_value = GetRootConstant(RootIndex::kUndefinedValue);
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue);
if (new_target_or_generator_register.is_valid()) { if (new_target_or_generator_register.is_valid()) {
int new_target_index = new_target_or_generator_register.index(); int new_target_index = new_target_or_generator_register.index();
for (; register_index < new_target_index; register_index++) { for (; register_index < new_target_index; register_index++) {
...@@ -295,8 +294,8 @@ void MaglevGraphBuilder::BuildGenericBinaryOperationNode() { ...@@ -295,8 +294,8 @@ void MaglevGraphBuilder::BuildGenericBinaryOperationNode() {
template <Operation kOperation> template <Operation kOperation>
void MaglevGraphBuilder::BuildGenericBinarySmiOperationNode() { void MaglevGraphBuilder::BuildGenericBinarySmiOperationNode() {
ValueNode* left = GetAccumulatorTagged(); ValueNode* left = GetAccumulatorTagged();
Smi constant = Smi::FromInt(iterator_.GetImmediateOperand(0)); int constant = iterator_.GetImmediateOperand(0);
ValueNode* right = AddNewNode<SmiConstant>({}, constant); ValueNode* right = GetSmiConstant(constant);
FeedbackSlot slot_index = GetSlotOperand(1); FeedbackSlot slot_index = GetSlotOperand(1);
SetAccumulator(AddNewNode<GenericNodeForOperation<kOperation>>( SetAccumulator(AddNewNode<GenericNodeForOperation<kOperation>>(
{left, right}, compiler::FeedbackSource{feedback(), slot_index})); {left, right}, compiler::FeedbackSource{feedback(), slot_index}));
...@@ -325,7 +324,7 @@ void MaglevGraphBuilder::BuildInt32BinarySmiOperationNode() { ...@@ -325,7 +324,7 @@ void MaglevGraphBuilder::BuildInt32BinarySmiOperationNode() {
// value, so we can just return. // value, so we can just return.
return; return;
} }
ValueNode* right = AddNewNode<Int32Constant>({}, constant); ValueNode* right = GetInt32Constant(constant);
SetAccumulator(AddNewInt32BinaryOperationNode<kOperation>({left, right})); SetAccumulator(AddNewInt32BinaryOperationNode<kOperation>({left, right}));
} }
...@@ -334,7 +333,7 @@ void MaglevGraphBuilder::BuildFloat64BinarySmiOperationNode() { ...@@ -334,7 +333,7 @@ void MaglevGraphBuilder::BuildFloat64BinarySmiOperationNode() {
// TODO(v8:7700): Do constant folding. // TODO(v8:7700): Do constant folding.
ValueNode* left = GetAccumulatorFloat64(); ValueNode* left = GetAccumulatorFloat64();
double constant = static_cast<double>(iterator_.GetImmediateOperand(0)); double constant = static_cast<double>(iterator_.GetImmediateOperand(0));
ValueNode* right = AddNewNode<Float64Constant>({}, constant); ValueNode* right = GetFloat64Constant(constant);
SetAccumulator(AddNewFloat64BinaryOperationNode<kOperation>({left, right})); SetAccumulator(AddNewFloat64BinaryOperationNode<kOperation>({left, right}));
} }
...@@ -509,27 +508,25 @@ void MaglevGraphBuilder::VisitLdar() { ...@@ -509,27 +508,25 @@ void MaglevGraphBuilder::VisitLdar() {
interpreter::Register::virtual_accumulator()); interpreter::Register::virtual_accumulator());
} }
void MaglevGraphBuilder::VisitLdaZero() { void MaglevGraphBuilder::VisitLdaZero() { SetAccumulator(GetSmiConstant(0)); }
SetAccumulator(AddNewNode<SmiConstant>({}, Smi::zero()));
}
void MaglevGraphBuilder::VisitLdaSmi() { void MaglevGraphBuilder::VisitLdaSmi() {
Smi constant = Smi::FromInt(iterator_.GetImmediateOperand(0)); int constant = iterator_.GetImmediateOperand(0);
SetAccumulator(AddNewNode<SmiConstant>({}, constant)); SetAccumulator(GetSmiConstant(constant));
} }
void MaglevGraphBuilder::VisitLdaUndefined() { void MaglevGraphBuilder::VisitLdaUndefined() {
SetAccumulator(AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue)); SetAccumulator(GetRootConstant(RootIndex::kUndefinedValue));
} }
void MaglevGraphBuilder::VisitLdaNull() { void MaglevGraphBuilder::VisitLdaNull() {
SetAccumulator(AddNewNode<RootConstant>({}, RootIndex::kNullValue)); SetAccumulator(GetRootConstant(RootIndex::kNullValue));
} }
void MaglevGraphBuilder::VisitLdaTheHole() { void MaglevGraphBuilder::VisitLdaTheHole() {
SetAccumulator(AddNewNode<RootConstant>({}, RootIndex::kTheHoleValue)); SetAccumulator(GetRootConstant(RootIndex::kTheHoleValue));
} }
void MaglevGraphBuilder::VisitLdaTrue() { void MaglevGraphBuilder::VisitLdaTrue() {
SetAccumulator(AddNewNode<RootConstant>({}, RootIndex::kTrueValue)); SetAccumulator(GetRootConstant(RootIndex::kTrueValue));
} }
void MaglevGraphBuilder::VisitLdaFalse() { void MaglevGraphBuilder::VisitLdaFalse() {
SetAccumulator(AddNewNode<RootConstant>({}, RootIndex::kFalseValue)); SetAccumulator(GetRootConstant(RootIndex::kFalseValue));
} }
void MaglevGraphBuilder::VisitLdaConstant() { void MaglevGraphBuilder::VisitLdaConstant() {
SetAccumulator(GetConstant(GetRefOperand<HeapObject>(0))); SetAccumulator(GetConstant(GetRefOperand<HeapObject>(0)));
...@@ -641,8 +638,7 @@ bool MaglevGraphBuilder::TryBuildPropertyCellAccess( ...@@ -641,8 +638,7 @@ bool MaglevGraphBuilder::TryBuildPropertyCellAccess(
return true; return true;
} }
ValueNode* property_cell_node = ValueNode* property_cell_node = GetConstant(property_cell.AsHeapObject());
AddNewNode<Constant>({}, property_cell.AsHeapObject());
SetAccumulator(AddNewNode<LoadTaggedField>({property_cell_node}, SetAccumulator(AddNewNode<LoadTaggedField>({property_cell_node},
PropertyCell::kValueOffset)); PropertyCell::kValueOffset));
return true; return true;
...@@ -769,12 +765,10 @@ bool MaglevGraphBuilder::TryBuildMonomorphicLoadFromLoadHandler( ...@@ -769,12 +765,10 @@ bool MaglevGraphBuilder::TryBuildMonomorphicLoadFromLoadHandler(
} }
MaybeObject value = handler.data1(local_isolate_); MaybeObject value = handler.data1(local_isolate_);
if (value.IsSmi()) { if (value.IsSmi()) {
SetAccumulator(AddNewNode<SmiConstant>({}, value.ToSmi())); SetAccumulator(GetSmiConstant(value.ToSmi().value()));
} else { } else {
SetAccumulator(AddNewNode<Constant>( SetAccumulator(GetConstant(MakeRefAssumeMemoryFence(
{}, MakeRefAssumeMemoryFence( broker(), broker()->CanonicalPersistentHandle(value.GetHeapObject()))));
broker(),
broker()->CanonicalPersistentHandle(value.GetHeapObject()))));
} }
return true; return true;
} }
...@@ -1059,8 +1053,7 @@ void MaglevGraphBuilder::InlineCallFromRegisters( ...@@ -1059,8 +1053,7 @@ void MaglevGraphBuilder::InlineCallFromRegisters(
// created. // created.
RootConstant* undefined_constant; RootConstant* undefined_constant;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) { if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
undefined_constant = undefined_constant = GetRootConstant(RootIndex::kUndefinedValue);
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue);
} }
// Create a new compilation unit and graph builder for the inlined // Create a new compilation unit and graph builder for the inlined
...@@ -1168,8 +1161,7 @@ void MaglevGraphBuilder::BuildCallFromRegisterList( ...@@ -1168,8 +1161,7 @@ void MaglevGraphBuilder::BuildCallFromRegisterList(
CreateNewNode<Call>(input_count, receiver_mode, function, context); CreateNewNode<Call>(input_count, receiver_mode, function, context);
int arg_index = 0; int arg_index = 0;
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) { if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
call->set_arg(arg_index++, call->set_arg(arg_index++, GetRootConstant(RootIndex::kUndefinedValue));
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue));
} }
for (int i = 0; i < args.register_count(); ++i) { for (int i = 0; i < args.register_count(); ++i) {
call->set_arg(arg_index++, GetTaggedValue(args[i])); call->set_arg(arg_index++, GetTaggedValue(args[i]));
...@@ -1236,8 +1228,7 @@ void MaglevGraphBuilder::BuildCallFromRegisters( ...@@ -1236,8 +1228,7 @@ void MaglevGraphBuilder::BuildCallFromRegisters(
CreateNewNode<Call>(input_count, receiver_mode, function, context); CreateNewNode<Call>(input_count, receiver_mode, function, context);
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) { if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
reg_count = argc_count; reg_count = argc_count;
call->set_arg(arg_index++, call->set_arg(arg_index++, GetRootConstant(RootIndex::kUndefinedValue));
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue));
} }
for (int i = 0; i < reg_count; i++) { for (int i = 0; i < reg_count; i++) {
call->set_arg(arg_index++, LoadRegisterTagged(i + 1)); call->set_arg(arg_index++, LoadRegisterTagged(i + 1));
...@@ -1291,8 +1282,7 @@ void MaglevGraphBuilder::VisitConstruct() { ...@@ -1291,8 +1282,7 @@ void MaglevGraphBuilder::VisitConstruct() {
CreateNewNode<Construct>(input_count, constructor, new_target, context); CreateNewNode<Construct>(input_count, constructor, new_target, context);
int arg_index = 0; int arg_index = 0;
// Add undefined receiver. // Add undefined receiver.
construct->set_arg(arg_index++, construct->set_arg(arg_index++, GetRootConstant(RootIndex::kUndefinedValue));
AddNewNode<RootConstant>({}, RootIndex::kUndefinedValue));
for (int i = 0; i < args.register_count(); i++) { for (int i = 0; i < args.register_count(); i++) {
construct->set_arg(arg_index++, GetTaggedValue(args[i])); construct->set_arg(arg_index++, GetTaggedValue(args[i]));
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef V8_MAGLEV_MAGLEV_GRAPH_BUILDER_H_ #ifndef V8_MAGLEV_MAGLEV_GRAPH_BUILDER_H_
#define V8_MAGLEV_MAGLEV_GRAPH_BUILDER_H_ #define V8_MAGLEV_MAGLEV_GRAPH_BUILDER_H_
#include <cmath>
#include <map>
#include <type_traits> #include <type_traits>
#include "src/base/logging.h" #include "src/base/logging.h"
...@@ -285,12 +287,66 @@ class MaglevGraphBuilder { ...@@ -285,12 +287,66 @@ class MaglevGraphBuilder {
operand_index, local_isolate())))); operand_index, local_isolate()))));
} }
ValueNode* GetConstant(const compiler::ObjectRef& ref) { SmiConstant* GetSmiConstant(int constant) {
if (ref.IsSmi()) { DCHECK(Smi::IsValid(constant));
return AddNewNode<SmiConstant>({}, Smi::FromInt(ref.AsSmi())); auto it = graph_->smi().find(constant);
if (it == graph_->smi().end()) {
SmiConstant* node = CreateNewNode<SmiConstant>(0, Smi::FromInt(constant));
if (has_graph_labeller()) graph_labeller()->RegisterNode(node);
graph_->smi().emplace(constant, node);
return node;
}
return it->second;
}
RootConstant* GetRootConstant(RootIndex index) {
auto it = graph_->root().find(index);
if (it == graph_->root().end()) {
RootConstant* node = CreateNewNode<RootConstant>(0, index);
if (has_graph_labeller()) graph_labeller()->RegisterNode(node);
graph_->root().emplace(index, node);
return node;
} }
// TODO(leszeks): Detect roots and use RootConstant. return it->second;
return AddNewNode<Constant>({}, ref.AsHeapObject()); }
Int32Constant* GetInt32Constant(int constant) {
auto it = graph_->int32().find(constant);
if (it == graph_->int32().end()) {
Int32Constant* node = CreateNewNode<Int32Constant>(0, constant);
if (has_graph_labeller()) graph_labeller()->RegisterNode(node);
graph_->int32().emplace(constant, node);
return node;
}
return it->second;
}
Float64Constant* GetFloat64Constant(double constant) {
if (constant != constant) {
if (graph_->nan() == nullptr) {
graph_->set_nan(CreateNewNode<Float64Constant>(0, constant));
}
return graph_->nan();
}
auto it = graph_->float64().find(constant);
if (it == graph_->float64().end()) {
Float64Constant* node = CreateNewNode<Float64Constant>(0, constant);
if (has_graph_labeller()) graph_labeller()->RegisterNode(node);
graph_->float64().emplace(constant, node);
return node;
}
return it->second;
}
ValueNode* GetConstant(const compiler::ObjectRef& ref) {
if (ref.IsSmi()) return GetSmiConstant(ref.AsSmi());
// TODO(verwaest): Cache and handle roots.
const compiler::HeapObjectRef& constant = ref.AsHeapObject();
Constant* node = CreateNewNode<Constant>(0, constant);
if (has_graph_labeller()) graph_labeller()->RegisterNode(node);
graph_->AddConstant(node);
return node;
} }
// Move an existing ValueNode between two registers. You can pass // Move an existing ValueNode between two registers. You can pass
...@@ -352,7 +408,7 @@ class MaglevGraphBuilder { ...@@ -352,7 +408,7 @@ class MaglevGraphBuilder {
if (value->Is<CheckedSmiTag>()) { if (value->Is<CheckedSmiTag>()) {
return value->input(0).node(); return value->input(0).node();
} else if (SmiConstant* constant = value->TryCast<SmiConstant>()) { } else if (SmiConstant* constant = value->TryCast<SmiConstant>()) {
return AddNewNode<Int32Constant>({}, constant->value().value()); return GetInt32Constant(constant->value().value());
} }
return AddNewConversionNode<CheckedSmiUntag>(reg, value); return AddNewConversionNode<CheckedSmiUntag>(reg, value);
} }
...@@ -433,7 +489,9 @@ class MaglevGraphBuilder { ...@@ -433,7 +489,9 @@ class MaglevGraphBuilder {
// We should only set register values to nodes that were newly created in // We should only set register values to nodes that were newly created in
// this Visit. Existing nodes should be moved between registers with // this Visit. Existing nodes should be moved between registers with
// MoveNodeBetweenRegisters. // MoveNodeBetweenRegisters.
if (!IsConstantNode(value->opcode())) {
DCHECK_NE(0, new_nodes_.count(value)); DCHECK_NE(0, new_nodes_.count(value));
}
MarkAsLazyDeoptResult(value, target); MarkAsLazyDeoptResult(value, target);
current_interpreter_frame_.set(target, value); current_interpreter_frame_.set(target, value);
} }
......
...@@ -54,10 +54,29 @@ class Graph final : public ZoneObject { ...@@ -54,10 +54,29 @@ class Graph final : public ZoneObject {
untagged_stack_slots_ = stack_slots; untagged_stack_slots_ = stack_slots;
} }
std::map<RootIndex, RootConstant*>& root() { return root_; }
std::map<int, SmiConstant*>& smi() { return smi_; }
std::map<int, Int32Constant*>& int32() { return int_; }
std::map<double, Float64Constant*>& float64() { return float_; }
std::vector<Constant*>& constants() { return constants_; }
Float64Constant* nan() const { return nan_; }
void set_nan(Float64Constant* nan) {
DCHECK_NULL(nan_);
nan_ = nan;
}
void AddConstant(Constant* constant) { constants_.emplace_back(constant); }
private: private:
uint32_t tagged_stack_slots_ = kMaxUInt32; uint32_t tagged_stack_slots_ = kMaxUInt32;
uint32_t untagged_stack_slots_ = kMaxUInt32; uint32_t untagged_stack_slots_ = kMaxUInt32;
ZoneVector<BasicBlock*> blocks_; ZoneVector<BasicBlock*> blocks_;
std::map<RootIndex, RootConstant*> root_;
std::map<int, SmiConstant*> smi_;
std::map<int, Int32Constant*> int_;
std::map<double, Float64Constant*> float_;
std::vector<Constant*> constants_;
Float64Constant* nan_ = nullptr;
}; };
} // namespace maglev } // namespace maglev
......
...@@ -429,20 +429,24 @@ Handle<Object> ValueNode::Reify(Isolate* isolate) { ...@@ -429,20 +429,24 @@ Handle<Object> ValueNode::Reify(Isolate* isolate) {
void ValueNode::SetNoSpillOrHint() { void ValueNode::SetNoSpillOrHint() {
DCHECK_EQ(state_, kLastUse); DCHECK_EQ(state_, kLastUse);
DCHECK(!IsConstantNode(opcode()));
#ifdef DEBUG
state_ = kSpillOrHint;
#endif // DEBUG
spill_or_hint_ = compiler::InstructionOperand();
}
void ValueNode::SetConstantLocation() {
DCHECK(IsConstantNode(opcode()));
#ifdef DEBUG #ifdef DEBUG
state_ = kSpillOrHint; state_ = kSpillOrHint;
#endif // DEBUG #endif // DEBUG
if (IsConstantNode(opcode())) {
spill_or_hint_ = compiler::ConstantOperand( spill_or_hint_ = compiler::ConstantOperand(
compiler::UnallocatedOperand::cast(result().operand()) compiler::UnallocatedOperand::cast(result().operand())
.virtual_register()); .virtual_register());
} else {
spill_or_hint_ = compiler::InstructionOperand();
}
} }
void SmiConstant::AllocateVreg(MaglevVregAllocationState* vreg_state, void SmiConstant::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsConstant(vreg_state, this); DefineAsConstant(vreg_state, this);
} }
void SmiConstant::GenerateCode(MaglevCodeGenState* code_gen_state, void SmiConstant::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -459,8 +463,7 @@ void SmiConstant::PrintParams(std::ostream& os, ...@@ -459,8 +463,7 @@ void SmiConstant::PrintParams(std::ostream& os,
os << "(" << value() << ")"; os << "(" << value() << ")";
} }
void Float64Constant::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Constant::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsConstant(vreg_state, this); DefineAsConstant(vreg_state, this);
} }
void Float64Constant::GenerateCode(MaglevCodeGenState* code_gen_state, void Float64Constant::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -477,8 +480,7 @@ void Float64Constant::PrintParams(std::ostream& os, ...@@ -477,8 +480,7 @@ void Float64Constant::PrintParams(std::ostream& os,
os << "(" << value() << ")"; os << "(" << value() << ")";
} }
void Constant::AllocateVreg(MaglevVregAllocationState* vreg_state, void Constant::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsConstant(vreg_state, this); DefineAsConstant(vreg_state, this);
} }
void Constant::GenerateCode(MaglevCodeGenState* code_gen_state, void Constant::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -493,8 +495,7 @@ void Constant::PrintParams(std::ostream& os, ...@@ -493,8 +495,7 @@ void Constant::PrintParams(std::ostream& os,
os << "(" << object_ << ")"; os << "(" << object_ << ")";
} }
void InitialValue::AllocateVreg(MaglevVregAllocationState* vreg_state, void InitialValue::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
// TODO(leszeks): Make this nicer. // TODO(leszeks): Make this nicer.
result().SetUnallocated(compiler::UnallocatedOperand::FIXED_SLOT, result().SetUnallocated(compiler::UnallocatedOperand::FIXED_SLOT,
(StandardFrameConstants::kExpressionsOffset - (StandardFrameConstants::kExpressionsOffset -
...@@ -512,8 +513,7 @@ void InitialValue::PrintParams(std::ostream& os, ...@@ -512,8 +513,7 @@ void InitialValue::PrintParams(std::ostream& os,
os << "(" << source().ToString() << ")"; os << "(" << source().ToString() << ")";
} }
void LoadGlobal::AllocateVreg(MaglevVregAllocationState* vreg_state, void LoadGlobal::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
} }
...@@ -537,8 +537,7 @@ void LoadGlobal::PrintParams(std::ostream& os, ...@@ -537,8 +537,7 @@ void LoadGlobal::PrintParams(std::ostream& os,
os << "(" << name() << ")"; os << "(" << name() << ")";
} }
void RegisterInput::AllocateVreg(MaglevVregAllocationState* vreg_state, void RegisterInput::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsFixed(vreg_state, this, input()); DefineAsFixed(vreg_state, this, input());
} }
void RegisterInput::GenerateCode(MaglevCodeGenState* code_gen_state, void RegisterInput::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -550,8 +549,7 @@ void RegisterInput::PrintParams(std::ostream& os, ...@@ -550,8 +549,7 @@ void RegisterInput::PrintParams(std::ostream& os,
os << "(" << input() << ")"; os << "(" << input() << ")";
} }
void RootConstant::AllocateVreg(MaglevVregAllocationState* vreg_state, void RootConstant::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsConstant(vreg_state, this); DefineAsConstant(vreg_state, this);
} }
void RootConstant::GenerateCode(MaglevCodeGenState* code_gen_state, void RootConstant::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -569,7 +567,7 @@ void RootConstant::PrintParams(std::ostream& os, ...@@ -569,7 +567,7 @@ void RootConstant::PrintParams(std::ostream& os,
} }
void CreateEmptyArrayLiteral::AllocateVreg( void CreateEmptyArrayLiteral::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
} }
void CreateEmptyArrayLiteral::GenerateCode(MaglevCodeGenState* code_gen_state, void CreateEmptyArrayLiteral::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -581,8 +579,7 @@ void CreateEmptyArrayLiteral::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -581,8 +579,7 @@ void CreateEmptyArrayLiteral::GenerateCode(MaglevCodeGenState* code_gen_state,
__ CallBuiltin(Builtin::kCreateEmptyArrayLiteral); __ CallBuiltin(Builtin::kCreateEmptyArrayLiteral);
} }
void CreateObjectLiteral::AllocateVreg(MaglevVregAllocationState* vreg_state, void CreateObjectLiteral::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(boilerplate_descriptor()); UseRegister(boilerplate_descriptor());
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
} }
...@@ -597,7 +594,7 @@ void CreateObjectLiteral::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -597,7 +594,7 @@ void CreateObjectLiteral::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
void CreateShallowObjectLiteral::AllocateVreg( void CreateShallowObjectLiteral::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
using D = CreateShallowObjectLiteralDescriptor; using D = CreateShallowObjectLiteralDescriptor;
UseFixed(boilerplate_descriptor(), D::GetRegisterParameter(D::kDesc)); UseFixed(boilerplate_descriptor(), D::GetRegisterParameter(D::kDesc));
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
...@@ -614,8 +611,7 @@ void CreateShallowObjectLiteral::GenerateCode( ...@@ -614,8 +611,7 @@ void CreateShallowObjectLiteral::GenerateCode(
__ CallBuiltin(Builtin::kCreateShallowObjectLiteral); __ CallBuiltin(Builtin::kCreateShallowObjectLiteral);
} }
void CheckMaps::AllocateVreg(MaglevVregAllocationState* vreg_state, void CheckMaps::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(actual_map_input()); UseRegister(actual_map_input());
set_temporaries_needed(1); set_temporaries_needed(1);
} }
...@@ -675,8 +671,7 @@ void CheckMaps::PrintParams(std::ostream& os, ...@@ -675,8 +671,7 @@ void CheckMaps::PrintParams(std::ostream& os,
os << "(" << *map().object() << ")"; os << "(" << *map().object() << ")";
} }
void LoadTaggedField::AllocateVreg(MaglevVregAllocationState* vreg_state, void LoadTaggedField::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(object_input()); UseRegister(object_input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
} }
...@@ -691,8 +686,7 @@ void LoadTaggedField::PrintParams(std::ostream& os, ...@@ -691,8 +686,7 @@ void LoadTaggedField::PrintParams(std::ostream& os,
os << "(0x" << std::hex << offset() << std::dec << ")"; os << "(0x" << std::hex << offset() << std::dec << ")";
} }
void LoadDoubleField::AllocateVreg(MaglevVregAllocationState* vreg_state, void LoadDoubleField::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(object_input()); UseRegister(object_input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
set_temporaries_needed(1); set_temporaries_needed(1);
...@@ -712,8 +706,7 @@ void LoadDoubleField::PrintParams(std::ostream& os, ...@@ -712,8 +706,7 @@ void LoadDoubleField::PrintParams(std::ostream& os,
os << "(0x" << std::hex << offset() << std::dec << ")"; os << "(0x" << std::hex << offset() << std::dec << ")";
} }
void StoreField::AllocateVreg(MaglevVregAllocationState* vreg_state, void StoreField::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseFixed(object_input(), WriteBarrierDescriptor::ObjectRegister()); UseFixed(object_input(), WriteBarrierDescriptor::ObjectRegister());
UseRegister(value_input()); UseRegister(value_input());
// We need the slot address to be free, and an additional scratch register // We need the slot address to be free, and an additional scratch register
...@@ -753,8 +746,7 @@ void StoreField::PrintParams(std::ostream& os, ...@@ -753,8 +746,7 @@ void StoreField::PrintParams(std::ostream& os,
os << "(" << std::hex << handler() << std::dec << ")"; os << "(" << std::hex << handler() << std::dec << ")";
} }
void LoadNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state, void LoadNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
using D = LoadWithVectorDescriptor; using D = LoadWithVectorDescriptor;
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver)); UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
...@@ -777,8 +769,7 @@ void LoadNamedGeneric::PrintParams(std::ostream& os, ...@@ -777,8 +769,7 @@ void LoadNamedGeneric::PrintParams(std::ostream& os,
os << "(" << name_ << ")"; os << "(" << name_ << ")";
} }
void SetNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state, void SetNamedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
using D = CallInterfaceDescriptorFor<Builtin::kStoreIC>::type; using D = CallInterfaceDescriptorFor<Builtin::kStoreIC>::type;
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver)); UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
...@@ -803,8 +794,8 @@ void SetNamedGeneric::PrintParams(std::ostream& os, ...@@ -803,8 +794,8 @@ void SetNamedGeneric::PrintParams(std::ostream& os,
os << "(" << name_ << ")"; os << "(" << name_ << ")";
} }
void DefineNamedOwnGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state, void DefineNamedOwnGeneric::AllocateVreg(
const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
using D = CallInterfaceDescriptorFor<Builtin::kDefineNamedOwnIC>::type; using D = CallInterfaceDescriptorFor<Builtin::kDefineNamedOwnIC>::type;
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver)); UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
...@@ -829,8 +820,7 @@ void DefineNamedOwnGeneric::PrintParams( ...@@ -829,8 +820,7 @@ void DefineNamedOwnGeneric::PrintParams(
os << "(" << name_ << ")"; os << "(" << name_ << ")";
} }
void GetKeyedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state, void GetKeyedGeneric::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
using D = CallInterfaceDescriptorFor<Builtin::kKeyedLoadIC>::type; using D = CallInterfaceDescriptorFor<Builtin::kKeyedLoadIC>::type;
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver)); UseFixed(object_input(), D::GetRegisterParameter(D::kReceiver));
...@@ -850,8 +840,7 @@ void GetKeyedGeneric::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -850,8 +840,7 @@ void GetKeyedGeneric::GenerateCode(MaglevCodeGenState* code_gen_state,
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info()); code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
} }
void GapMove::AllocateVreg(MaglevVregAllocationState* vreg_state, void GapMove::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UNREACHABLE(); UNREACHABLE();
} }
void GapMove::GenerateCode(MaglevCodeGenState* code_gen_state, void GapMove::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -890,8 +879,7 @@ void GapMove::PrintParams(std::ostream& os, ...@@ -890,8 +879,7 @@ void GapMove::PrintParams(std::ostream& os,
MaglevGraphLabeller* graph_labeller) const { MaglevGraphLabeller* graph_labeller) const {
os << "(" << source() << " → " << target() << ")"; os << "(" << source() << " → " << target() << ")";
} }
void ConstantGapMove::AllocateVreg(MaglevVregAllocationState* vreg_state, void ConstantGapMove::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UNREACHABLE(); UNREACHABLE();
} }
...@@ -947,7 +935,7 @@ constexpr Builtin BuiltinFor(Operation operation) { ...@@ -947,7 +935,7 @@ constexpr Builtin BuiltinFor(Operation operation) {
template <class Derived, Operation kOperation> template <class Derived, Operation kOperation>
void UnaryWithFeedbackNode<Derived, kOperation>::AllocateVreg( void UnaryWithFeedbackNode<Derived, kOperation>::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
using D = UnaryOp_WithFeedbackDescriptor; using D = UnaryOp_WithFeedbackDescriptor;
UseFixed(operand_input(), D::GetRegisterParameter(D::kValue)); UseFixed(operand_input(), D::GetRegisterParameter(D::kValue));
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
...@@ -967,7 +955,7 @@ void UnaryWithFeedbackNode<Derived, kOperation>::GenerateCode( ...@@ -967,7 +955,7 @@ void UnaryWithFeedbackNode<Derived, kOperation>::GenerateCode(
template <class Derived, Operation kOperation> template <class Derived, Operation kOperation>
void BinaryWithFeedbackNode<Derived, kOperation>::AllocateVreg( void BinaryWithFeedbackNode<Derived, kOperation>::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
using D = BinaryOp_WithFeedbackDescriptor; using D = BinaryOp_WithFeedbackDescriptor;
UseFixed(left_input(), D::GetRegisterParameter(D::kLeft)); UseFixed(left_input(), D::GetRegisterParameter(D::kLeft));
UseFixed(right_input(), D::GetRegisterParameter(D::kRight)); UseFixed(right_input(), D::GetRegisterParameter(D::kRight));
...@@ -988,9 +976,8 @@ void BinaryWithFeedbackNode<Derived, kOperation>::GenerateCode( ...@@ -988,9 +976,8 @@ void BinaryWithFeedbackNode<Derived, kOperation>::GenerateCode(
} }
#define DEF_OPERATION(Name) \ #define DEF_OPERATION(Name) \
void Name::AllocateVreg(MaglevVregAllocationState* vreg_state, \ void Name::AllocateVreg(MaglevVregAllocationState* vreg_state) { \
const ProcessingState& state) { \ Base::AllocateVreg(vreg_state); \
Base::AllocateVreg(vreg_state, state); \
} \ } \
void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \ void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \
const ProcessingState& state) { \ const ProcessingState& state) { \
...@@ -999,8 +986,7 @@ void BinaryWithFeedbackNode<Derived, kOperation>::GenerateCode( ...@@ -999,8 +986,7 @@ void BinaryWithFeedbackNode<Derived, kOperation>::GenerateCode(
GENERIC_OPERATIONS_NODE_LIST(DEF_OPERATION) GENERIC_OPERATIONS_NODE_LIST(DEF_OPERATION)
#undef DEF_OPERATION #undef DEF_OPERATION
void Int32AddWithOverflow::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32AddWithOverflow::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1015,7 +1001,7 @@ void Int32AddWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1015,7 +1001,7 @@ void Int32AddWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
void Int32SubtractWithOverflow::AllocateVreg( void Int32SubtractWithOverflow::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1030,7 +1016,7 @@ void Int32SubtractWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1030,7 +1016,7 @@ void Int32SubtractWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
void Int32MultiplyWithOverflow::AllocateVreg( void Int32MultiplyWithOverflow::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1065,7 +1051,7 @@ void Int32MultiplyWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1065,7 +1051,7 @@ void Int32MultiplyWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
void Int32DivideWithOverflow::AllocateVreg( void Int32DivideWithOverflow::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseFixed(left_input(), rax); UseFixed(left_input(), rax);
UseRegister(right_input()); UseRegister(right_input());
DefineAsFixed(vreg_state, this, rax); DefineAsFixed(vreg_state, this, rax);
...@@ -1086,8 +1072,7 @@ void Int32DivideWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1086,8 +1072,7 @@ void Int32DivideWithOverflow::GenerateCode(MaglevCodeGenState* code_gen_state,
EmitEagerDeoptIf(equal, code_gen_state, this); EmitEagerDeoptIf(equal, code_gen_state, this);
} }
void Int32BitwiseAnd::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32BitwiseAnd::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1100,8 +1085,7 @@ void Int32BitwiseAnd::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1100,8 +1085,7 @@ void Int32BitwiseAnd::GenerateCode(MaglevCodeGenState* code_gen_state,
__ andl(left, right); __ andl(left, right);
} }
void Int32BitwiseOr::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32BitwiseOr::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1114,8 +1098,7 @@ void Int32BitwiseOr::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1114,8 +1098,7 @@ void Int32BitwiseOr::GenerateCode(MaglevCodeGenState* code_gen_state,
__ orl(left, right); __ orl(left, right);
} }
void Int32BitwiseXor::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32BitwiseXor::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1128,8 +1111,7 @@ void Int32BitwiseXor::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1128,8 +1111,7 @@ void Int32BitwiseXor::GenerateCode(MaglevCodeGenState* code_gen_state,
__ xorl(left, right); __ xorl(left, right);
} }
void Int32ShiftLeft::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32ShiftLeft::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
// Use the "shift by cl" variant of shl. // Use the "shift by cl" variant of shl.
// TODO(leszeks): peephole optimise shifts by a constant. // TODO(leszeks): peephole optimise shifts by a constant.
...@@ -1144,8 +1126,7 @@ void Int32ShiftLeft::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1144,8 +1126,7 @@ void Int32ShiftLeft::GenerateCode(MaglevCodeGenState* code_gen_state,
__ shll_cl(left); __ shll_cl(left);
} }
void Int32ShiftRight::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32ShiftRight::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
// Use the "shift by cl" variant of sar. // Use the "shift by cl" variant of sar.
// TODO(leszeks): peephole optimise shifts by a constant. // TODO(leszeks): peephole optimise shifts by a constant.
...@@ -1160,8 +1141,8 @@ void Int32ShiftRight::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1160,8 +1141,8 @@ void Int32ShiftRight::GenerateCode(MaglevCodeGenState* code_gen_state,
__ sarl_cl(left); __ sarl_cl(left);
} }
void Int32ShiftRightLogical::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32ShiftRightLogical::AllocateVreg(
const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
// Use the "shift by cl" variant of shr. // Use the "shift by cl" variant of shr.
// TODO(leszeks): peephole optimise shifts by a constant. // TODO(leszeks): peephole optimise shifts by a constant.
...@@ -1200,7 +1181,7 @@ constexpr Condition ConditionFor(Operation operation) { ...@@ -1200,7 +1181,7 @@ constexpr Condition ConditionFor(Operation operation) {
template <class Derived, Operation kOperation> template <class Derived, Operation kOperation>
void Int32CompareNode<Derived, kOperation>::AllocateVreg( void Int32CompareNode<Derived, kOperation>::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
...@@ -1228,9 +1209,8 @@ void Int32CompareNode<Derived, kOperation>::GenerateCode( ...@@ -1228,9 +1209,8 @@ void Int32CompareNode<Derived, kOperation>::GenerateCode(
} }
#define DEF_OPERATION(Name) \ #define DEF_OPERATION(Name) \
void Name::AllocateVreg(MaglevVregAllocationState* vreg_state, \ void Name::AllocateVreg(MaglevVregAllocationState* vreg_state) { \
const ProcessingState& state) { \ Base::AllocateVreg(vreg_state); \
Base::AllocateVreg(vreg_state, state); \
} \ } \
void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \ void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \
const ProcessingState& state) { \ const ProcessingState& state) { \
...@@ -1244,8 +1224,7 @@ DEF_OPERATION(Int32GreaterThan) ...@@ -1244,8 +1224,7 @@ DEF_OPERATION(Int32GreaterThan)
DEF_OPERATION(Int32GreaterThanOrEqual) DEF_OPERATION(Int32GreaterThanOrEqual)
#undef DEF_OPERATION #undef DEF_OPERATION
void Float64Add::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Add::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1258,8 +1237,7 @@ void Float64Add::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1258,8 +1237,7 @@ void Float64Add::GenerateCode(MaglevCodeGenState* code_gen_state,
__ Addsd(left, right); __ Addsd(left, right);
} }
void Float64Subtract::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Subtract::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1272,8 +1250,7 @@ void Float64Subtract::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1272,8 +1250,7 @@ void Float64Subtract::GenerateCode(MaglevCodeGenState* code_gen_state,
__ Subsd(left, right); __ Subsd(left, right);
} }
void Float64Multiply::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Multiply::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1286,8 +1263,7 @@ void Float64Multiply::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1286,8 +1263,7 @@ void Float64Multiply::GenerateCode(MaglevCodeGenState* code_gen_state,
__ Mulsd(left, right); __ Mulsd(left, right);
} }
void Float64Divide::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Divide::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
...@@ -1302,7 +1278,7 @@ void Float64Divide::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1302,7 +1278,7 @@ void Float64Divide::GenerateCode(MaglevCodeGenState* code_gen_state,
template <class Derived, Operation kOperation> template <class Derived, Operation kOperation>
void Float64CompareNode<Derived, kOperation>::AllocateVreg( void Float64CompareNode<Derived, kOperation>::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
...@@ -1330,9 +1306,8 @@ void Float64CompareNode<Derived, kOperation>::GenerateCode( ...@@ -1330,9 +1306,8 @@ void Float64CompareNode<Derived, kOperation>::GenerateCode(
} }
#define DEF_OPERATION(Name) \ #define DEF_OPERATION(Name) \
void Name::AllocateVreg(MaglevVregAllocationState* vreg_state, \ void Name::AllocateVreg(MaglevVregAllocationState* vreg_state) { \
const ProcessingState& state) { \ Base::AllocateVreg(vreg_state); \
Base::AllocateVreg(vreg_state, state); \
} \ } \
void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \ void Name::GenerateCode(MaglevCodeGenState* code_gen_state, \
const ProcessingState& state) { \ const ProcessingState& state) { \
...@@ -1346,8 +1321,7 @@ DEF_OPERATION(Float64GreaterThan) ...@@ -1346,8 +1321,7 @@ DEF_OPERATION(Float64GreaterThan)
DEF_OPERATION(Float64GreaterThanOrEqual) DEF_OPERATION(Float64GreaterThanOrEqual)
#undef DEF_OPERATION #undef DEF_OPERATION
void CheckedSmiUntag::AllocateVreg(MaglevVregAllocationState* vreg_state, void CheckedSmiUntag::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(input()); UseRegister(input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
} }
...@@ -1363,8 +1337,7 @@ void CheckedSmiUntag::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1363,8 +1337,7 @@ void CheckedSmiUntag::GenerateCode(MaglevCodeGenState* code_gen_state,
__ SmiToInt32(value); __ SmiToInt32(value);
} }
void CheckedSmiTag::AllocateVreg(MaglevVregAllocationState* vreg_state, void CheckedSmiTag::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(input()); UseRegister(input());
DefineSameAsFirst(vreg_state, this); DefineSameAsFirst(vreg_state, this);
} }
...@@ -1376,8 +1349,7 @@ void CheckedSmiTag::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1376,8 +1349,7 @@ void CheckedSmiTag::GenerateCode(MaglevCodeGenState* code_gen_state,
EmitEagerDeoptIf(overflow, code_gen_state, this); EmitEagerDeoptIf(overflow, code_gen_state, this);
} }
void Int32Constant::AllocateVreg(MaglevVregAllocationState* vreg_state, void Int32Constant::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
DefineAsConstant(vreg_state, this); DefineAsConstant(vreg_state, this);
} }
void Int32Constant::GenerateCode(MaglevCodeGenState* code_gen_state, void Int32Constant::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1394,8 +1366,7 @@ void Int32Constant::PrintParams(std::ostream& os, ...@@ -1394,8 +1366,7 @@ void Int32Constant::PrintParams(std::ostream& os,
os << "(" << value() << ")"; os << "(" << value() << ")";
} }
void Float64Box::AllocateVreg(MaglevVregAllocationState* vreg_state, void Float64Box::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
using D = NewHeapNumberDescriptor; using D = NewHeapNumberDescriptor;
UseFixed(input(), D::GetDoubleRegisterParameter(D::kValue)); UseFixed(input(), D::GetDoubleRegisterParameter(D::kValue));
DefineAsFixed(vreg_state, this, kReturnRegister0); DefineAsFixed(vreg_state, this, kReturnRegister0);
...@@ -1406,8 +1377,7 @@ void Float64Box::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1406,8 +1377,7 @@ void Float64Box::GenerateCode(MaglevCodeGenState* code_gen_state,
__ CallBuiltin(Builtin::kNewHeapNumber); __ CallBuiltin(Builtin::kNewHeapNumber);
} }
void CheckedFloat64Unbox::AllocateVreg(MaglevVregAllocationState* vreg_state, void CheckedFloat64Unbox::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(input()); UseRegister(input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
} }
...@@ -1437,8 +1407,7 @@ void CheckedFloat64Unbox::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1437,8 +1407,7 @@ void CheckedFloat64Unbox::GenerateCode(MaglevCodeGenState* code_gen_state,
__ bind(&done); __ bind(&done);
} }
void ChangeInt32ToFloat64::AllocateVreg(MaglevVregAllocationState* vreg_state, void ChangeInt32ToFloat64::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(input()); UseRegister(input());
DefineAsRegister(vreg_state, this); DefineAsRegister(vreg_state, this);
} }
...@@ -1447,8 +1416,7 @@ void ChangeInt32ToFloat64::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1447,8 +1416,7 @@ void ChangeInt32ToFloat64::GenerateCode(MaglevCodeGenState* code_gen_state,
__ Cvtlsi2sd(ToDoubleRegister(result()), ToRegister(input())); __ Cvtlsi2sd(ToDoubleRegister(result()), ToRegister(input()));
} }
void Phi::AllocateVreg(MaglevVregAllocationState* vreg_state, void Phi::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
// Phi inputs are processed in the post-process, once loop phis' inputs' // Phi inputs are processed in the post-process, once loop phis' inputs'
// v-regs are allocated. // v-regs are allocated.
result().SetUnallocated( result().SetUnallocated(
...@@ -1468,8 +1436,7 @@ void Phi::PrintParams(std::ostream& os, ...@@ -1468,8 +1436,7 @@ void Phi::PrintParams(std::ostream& os,
os << "(" << owner().ToString() << ")"; os << "(" << owner().ToString() << ")";
} }
void Call::AllocateVreg(MaglevVregAllocationState* vreg_state, void Call::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseFixed(function(), CallTrampolineDescriptor::GetRegisterParameter( UseFixed(function(), CallTrampolineDescriptor::GetRegisterParameter(
CallTrampolineDescriptor::kFunction)); CallTrampolineDescriptor::kFunction));
UseFixed(context(), kContextRegister); UseFixed(context(), kContextRegister);
...@@ -1513,8 +1480,7 @@ void Call::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1513,8 +1480,7 @@ void Call::GenerateCode(MaglevCodeGenState* code_gen_state,
code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info()); code_gen_state->DefineLazyDeoptPoint(lazy_deopt_info());
} }
void Construct::AllocateVreg(MaglevVregAllocationState* vreg_state, void Construct::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
using D = ConstructStubDescriptor; using D = ConstructStubDescriptor;
UseFixed(function(), D::GetRegisterParameter(D::kTarget)); UseFixed(function(), D::GetRegisterParameter(D::kTarget));
UseFixed(new_target(), D::GetRegisterParameter(D::kNewTarget)); UseFixed(new_target(), D::GetRegisterParameter(D::kNewTarget));
...@@ -1597,8 +1563,7 @@ void UpdateInterruptBudgetAndMaybeCallRuntime( ...@@ -1597,8 +1563,7 @@ void UpdateInterruptBudgetAndMaybeCallRuntime(
// --- // ---
// Control nodes // Control nodes
// --- // ---
void Return::AllocateVreg(MaglevVregAllocationState* vreg_state, void Return::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseFixed(value_input(), kReturnRegister0); UseFixed(value_input(), kReturnRegister0);
} }
void Return::GenerateCode(MaglevCodeGenState* code_gen_state, void Return::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1648,15 +1613,13 @@ void Return::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1648,15 +1613,13 @@ void Return::GenerateCode(MaglevCodeGenState* code_gen_state,
__ Ret(); __ Ret();
} }
void Deopt::AllocateVreg(MaglevVregAllocationState* vreg_state, void Deopt::AllocateVreg(MaglevVregAllocationState* vreg_state) {}
const ProcessingState& state) {}
void Deopt::GenerateCode(MaglevCodeGenState* code_gen_state, void Deopt::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) { const ProcessingState& state) {
EmitEagerDeopt(code_gen_state, this); EmitEagerDeopt(code_gen_state, this);
} }
void Jump::AllocateVreg(MaglevVregAllocationState* vreg_state, void Jump::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
set_temporaries_needed(1); set_temporaries_needed(1);
} }
void Jump::GenerateCode(MaglevCodeGenState* code_gen_state, void Jump::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1670,8 +1633,7 @@ void Jump::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1670,8 +1633,7 @@ void Jump::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
} }
void JumpToInlined::AllocateVreg(MaglevVregAllocationState* vreg_state, void JumpToInlined::AllocateVreg(MaglevVregAllocationState* vreg_state) {}
const ProcessingState& state) {}
void JumpToInlined::GenerateCode(MaglevCodeGenState* code_gen_state, void JumpToInlined::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) { const ProcessingState& state) {
// Avoid emitting a jump to the next block. // Avoid emitting a jump to the next block.
...@@ -1684,8 +1646,7 @@ void JumpToInlined::PrintParams(std::ostream& os, ...@@ -1684,8 +1646,7 @@ void JumpToInlined::PrintParams(std::ostream& os,
os << "(" << Brief(*unit()->shared_function_info().object()) << ")"; os << "(" << Brief(*unit()->shared_function_info().object()) << ")";
} }
void JumpFromInlined::AllocateVreg(MaglevVregAllocationState* vreg_state, void JumpFromInlined::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
set_temporaries_needed(1); set_temporaries_needed(1);
} }
void JumpFromInlined::GenerateCode(MaglevCodeGenState* code_gen_state, void JumpFromInlined::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1699,8 +1660,7 @@ void JumpFromInlined::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1699,8 +1660,7 @@ void JumpFromInlined::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
} }
void JumpLoop::AllocateVreg(MaglevVregAllocationState* vreg_state, void JumpLoop::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
set_temporaries_needed(1); set_temporaries_needed(1);
} }
void JumpLoop::GenerateCode(MaglevCodeGenState* code_gen_state, void JumpLoop::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1713,8 +1673,7 @@ void JumpLoop::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1713,8 +1673,7 @@ void JumpLoop::GenerateCode(MaglevCodeGenState* code_gen_state,
__ jmp(target()->label()); __ jmp(target()->label());
} }
void BranchIfTrue::AllocateVreg(MaglevVregAllocationState* vreg_state, void BranchIfTrue::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(condition_input()); UseRegister(condition_input());
} }
void BranchIfTrue::GenerateCode(MaglevCodeGenState* code_gen_state, void BranchIfTrue::GenerateCode(MaglevCodeGenState* code_gen_state,
...@@ -1738,8 +1697,7 @@ void BranchIfTrue::GenerateCode(MaglevCodeGenState* code_gen_state, ...@@ -1738,8 +1697,7 @@ void BranchIfTrue::GenerateCode(MaglevCodeGenState* code_gen_state,
} }
} }
void BranchIfInt32Compare::AllocateVreg(MaglevVregAllocationState* vreg_state, void BranchIfInt32Compare::AllocateVreg(MaglevVregAllocationState* vreg_state) {
const ProcessingState& state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
} }
...@@ -1771,8 +1729,8 @@ void BranchIfFloat64Compare::PrintParams( ...@@ -1771,8 +1729,8 @@ void BranchIfFloat64Compare::PrintParams(
os << "(" << operation_ << ")"; os << "(" << operation_ << ")";
} }
void BranchIfFloat64Compare::AllocateVreg(MaglevVregAllocationState* vreg_state, void BranchIfFloat64Compare::AllocateVreg(
const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseRegister(left_input()); UseRegister(left_input());
UseRegister(right_input()); UseRegister(right_input());
} }
...@@ -1804,8 +1762,8 @@ void BranchIfInt32Compare::PrintParams( ...@@ -1804,8 +1762,8 @@ void BranchIfInt32Compare::PrintParams(
os << "(" << operation_ << ")"; os << "(" << operation_ << ")";
} }
void BranchIfToBooleanTrue::AllocateVreg(MaglevVregAllocationState* vreg_state, void BranchIfToBooleanTrue::AllocateVreg(
const ProcessingState& state) { MaglevVregAllocationState* vreg_state) {
UseFixed(condition_input(), UseFixed(condition_input(),
ToBooleanForBaselineJumpDescriptor::GetRegisterParameter(0)); ToBooleanForBaselineJumpDescriptor::GetRegisterParameter(0));
} }
......
...@@ -784,6 +784,7 @@ class ValueNode : public Node { ...@@ -784,6 +784,7 @@ class ValueNode : public Node {
bool is_spilled() const { return spill_or_hint_.IsAnyStackSlot(); } bool is_spilled() const { return spill_or_hint_.IsAnyStackSlot(); }
void SetNoSpillOrHint(); void SetNoSpillOrHint();
void SetConstantLocation();
/* For constants only. */ /* For constants only. */
void LoadToRegister(MaglevCodeGenState*, Register); void LoadToRegister(MaglevCodeGenState*, Register);
...@@ -1051,7 +1052,7 @@ class UnaryWithFeedbackNode : public FixedInputValueNodeT<1, Derived> { ...@@ -1051,7 +1052,7 @@ class UnaryWithFeedbackNode : public FixedInputValueNodeT<1, Derived> {
const compiler::FeedbackSource& feedback) const compiler::FeedbackSource& feedback)
: Base(bitfield), feedback_(feedback) {} : Base(bitfield), feedback_(feedback) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1077,7 +1078,7 @@ class BinaryWithFeedbackNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1077,7 +1078,7 @@ class BinaryWithFeedbackNode : public FixedInputValueNodeT<2, Derived> {
const compiler::FeedbackSource& feedback) const compiler::FeedbackSource& feedback)
: Base(bitfield), feedback_(feedback) {} : Base(bitfield), feedback_(feedback) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1091,7 +1092,7 @@ class BinaryWithFeedbackNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1091,7 +1092,7 @@ class BinaryWithFeedbackNode : public FixedInputValueNodeT<2, Derived> {
public: \ public: \
Name(uint32_t bitfield, const compiler::FeedbackSource& feedback) \ Name(uint32_t bitfield, const compiler::FeedbackSource& feedback) \
: Base(bitfield, feedback) {} \ : Base(bitfield, feedback) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1135,7 +1136,7 @@ class Int32BinaryWithOverflowNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1135,7 +1136,7 @@ class Int32BinaryWithOverflowNode : public FixedInputValueNodeT<2, Derived> {
\ \
public: \ public: \
explicit Name(uint32_t bitfield) : Base(bitfield) {} \ explicit Name(uint32_t bitfield) : Base(bitfield) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1176,7 +1177,7 @@ class Int32BinaryNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1176,7 +1177,7 @@ class Int32BinaryNode : public FixedInputValueNodeT<2, Derived> {
\ \
public: \ public: \
explicit Name(uint32_t bitfield) : Base(bitfield) {} \ explicit Name(uint32_t bitfield) : Base(bitfield) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1207,7 +1208,7 @@ class Int32CompareNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1207,7 +1208,7 @@ class Int32CompareNode : public FixedInputValueNodeT<2, Derived> {
protected: protected:
explicit Int32CompareNode(uint32_t bitfield) : Base(bitfield) {} explicit Int32CompareNode(uint32_t bitfield) : Base(bitfield) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1218,7 +1219,7 @@ class Int32CompareNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1218,7 +1219,7 @@ class Int32CompareNode : public FixedInputValueNodeT<2, Derived> {
\ \
public: \ public: \
explicit Name(uint32_t bitfield) : Base(bitfield) {} \ explicit Name(uint32_t bitfield) : Base(bitfield) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1259,7 +1260,7 @@ class Float64BinaryNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1259,7 +1260,7 @@ class Float64BinaryNode : public FixedInputValueNodeT<2, Derived> {
\ \
public: \ public: \
explicit Name(uint32_t bitfield) : Base(bitfield) {} \ explicit Name(uint32_t bitfield) : Base(bitfield) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1293,7 +1294,7 @@ class Float64CompareNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1293,7 +1294,7 @@ class Float64CompareNode : public FixedInputValueNodeT<2, Derived> {
protected: protected:
explicit Float64CompareNode(uint32_t bitfield) : Base(bitfield) {} explicit Float64CompareNode(uint32_t bitfield) : Base(bitfield) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1304,7 +1305,7 @@ class Float64CompareNode : public FixedInputValueNodeT<2, Derived> { ...@@ -1304,7 +1305,7 @@ class Float64CompareNode : public FixedInputValueNodeT<2, Derived> {
\ \
public: \ public: \
explicit Name(uint32_t bitfield) : Base(bitfield) {} \ explicit Name(uint32_t bitfield) : Base(bitfield) {} \
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); \ void AllocateVreg(MaglevVregAllocationState*); \
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \ void GenerateCode(MaglevCodeGenState*, const ProcessingState&); \
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \ void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} \
}; };
...@@ -1332,7 +1333,7 @@ class CheckedSmiTag : public FixedInputValueNodeT<1, CheckedSmiTag> { ...@@ -1332,7 +1333,7 @@ class CheckedSmiTag : public FixedInputValueNodeT<1, CheckedSmiTag> {
Input& input() { return Node::input(0); } Input& input() { return Node::input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1349,7 +1350,7 @@ class CheckedSmiUntag : public FixedInputValueNodeT<1, CheckedSmiUntag> { ...@@ -1349,7 +1350,7 @@ class CheckedSmiUntag : public FixedInputValueNodeT<1, CheckedSmiUntag> {
Input& input() { return Node::input(0); } Input& input() { return Node::input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1367,7 +1368,7 @@ class Int32Constant : public FixedInputValueNodeT<0, Int32Constant> { ...@@ -1367,7 +1368,7 @@ class Int32Constant : public FixedInputValueNodeT<0, Int32Constant> {
int32_t value() const { return value_; } int32_t value() const { return value_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1391,7 +1392,7 @@ class Float64Constant : public FixedInputValueNodeT<0, Float64Constant> { ...@@ -1391,7 +1392,7 @@ class Float64Constant : public FixedInputValueNodeT<0, Float64Constant> {
double value() const { return value_; } double value() const { return value_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1414,7 +1415,7 @@ class Float64Box : public FixedInputValueNodeT<1, Float64Box> { ...@@ -1414,7 +1415,7 @@ class Float64Box : public FixedInputValueNodeT<1, Float64Box> {
Input& input() { return Node::input(0); } Input& input() { return Node::input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1431,7 +1432,7 @@ class ChangeInt32ToFloat64 ...@@ -1431,7 +1432,7 @@ class ChangeInt32ToFloat64
Input& input() { return Node::input(0); } Input& input() { return Node::input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1449,7 +1450,7 @@ class CheckedFloat64Unbox ...@@ -1449,7 +1450,7 @@ class CheckedFloat64Unbox
Input& input() { return Node::input(0); } Input& input() { return Node::input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -1463,7 +1464,7 @@ class InitialValue : public FixedInputValueNodeT<0, InitialValue> { ...@@ -1463,7 +1464,7 @@ class InitialValue : public FixedInputValueNodeT<0, InitialValue> {
interpreter::Register source() const { return source_; } interpreter::Register source() const { return source_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1480,7 +1481,7 @@ class RegisterInput : public FixedInputValueNodeT<0, RegisterInput> { ...@@ -1480,7 +1481,7 @@ class RegisterInput : public FixedInputValueNodeT<0, RegisterInput> {
Register input() const { return input_; } Register input() const { return input_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1499,7 +1500,7 @@ class SmiConstant : public FixedInputValueNodeT<0, SmiConstant> { ...@@ -1499,7 +1500,7 @@ class SmiConstant : public FixedInputValueNodeT<0, SmiConstant> {
Smi value() const { return value_; } Smi value() const { return value_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1519,7 +1520,7 @@ class Constant : public FixedInputValueNodeT<0, Constant> { ...@@ -1519,7 +1520,7 @@ class Constant : public FixedInputValueNodeT<0, Constant> {
explicit Constant(uint32_t bitfield, const compiler::HeapObjectRef& object) explicit Constant(uint32_t bitfield, const compiler::HeapObjectRef& object)
: Base(bitfield), object_(object) {} : Base(bitfield), object_(object) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1541,7 +1542,7 @@ class RootConstant : public FixedInputValueNodeT<0, RootConstant> { ...@@ -1541,7 +1542,7 @@ class RootConstant : public FixedInputValueNodeT<0, RootConstant> {
RootIndex index() const { return index_; } RootIndex index() const { return index_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1566,7 +1567,7 @@ class CreateEmptyArrayLiteral ...@@ -1566,7 +1567,7 @@ class CreateEmptyArrayLiteral
// The implementation currently calls runtime. // The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::Call(); static constexpr OpProperties kProperties = OpProperties::Call();
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1594,7 +1595,7 @@ class CreateObjectLiteral ...@@ -1594,7 +1595,7 @@ class CreateObjectLiteral
// The implementation currently calls runtime. // The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::Call(); static constexpr OpProperties kProperties = OpProperties::Call();
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1625,7 +1626,7 @@ class CreateShallowObjectLiteral ...@@ -1625,7 +1626,7 @@ class CreateShallowObjectLiteral
// The implementation currently calls runtime. // The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::Call(); static constexpr OpProperties kProperties = OpProperties::Call();
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1652,7 +1653,7 @@ class CheckMaps : public FixedInputNodeT<1, CheckMaps> { ...@@ -1652,7 +1653,7 @@ class CheckMaps : public FixedInputNodeT<1, CheckMaps> {
static constexpr int kActualMapIndex = 0; static constexpr int kActualMapIndex = 0;
Input& actual_map_input() { return input(kActualMapIndex); } Input& actual_map_input() { return input(kActualMapIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1674,7 +1675,7 @@ class LoadTaggedField : public FixedInputValueNodeT<1, LoadTaggedField> { ...@@ -1674,7 +1675,7 @@ class LoadTaggedField : public FixedInputValueNodeT<1, LoadTaggedField> {
static constexpr int kObjectIndex = 0; static constexpr int kObjectIndex = 0;
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1697,7 +1698,7 @@ class LoadDoubleField : public FixedInputValueNodeT<1, LoadDoubleField> { ...@@ -1697,7 +1698,7 @@ class LoadDoubleField : public FixedInputValueNodeT<1, LoadDoubleField> {
static constexpr int kObjectIndex = 0; static constexpr int kObjectIndex = 0;
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1721,7 +1722,7 @@ class StoreField : public FixedInputNodeT<2, StoreField> { ...@@ -1721,7 +1722,7 @@ class StoreField : public FixedInputNodeT<2, StoreField> {
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
Input& value_input() { return input(kValueIndex); } Input& value_input() { return input(kValueIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1745,7 +1746,7 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> { ...@@ -1745,7 +1746,7 @@ class LoadGlobal : public FixedInputValueNodeT<1, LoadGlobal> {
Input& context() { return input(0); } Input& context() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1773,7 +1774,7 @@ class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> { ...@@ -1773,7 +1774,7 @@ class LoadNamedGeneric : public FixedInputValueNodeT<2, LoadNamedGeneric> {
Input& context() { return input(kContextIndex); } Input& context() { return input(kContextIndex); }
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1803,7 +1804,7 @@ class SetNamedGeneric : public FixedInputValueNodeT<3, SetNamedGeneric> { ...@@ -1803,7 +1804,7 @@ class SetNamedGeneric : public FixedInputValueNodeT<3, SetNamedGeneric> {
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
Input& value_input() { return input(kValueIndex); } Input& value_input() { return input(kValueIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1835,7 +1836,7 @@ class DefineNamedOwnGeneric ...@@ -1835,7 +1836,7 @@ class DefineNamedOwnGeneric
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
Input& value_input() { return input(kValueIndex); } Input& value_input() { return input(kValueIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1864,7 +1865,7 @@ class GetKeyedGeneric : public FixedInputValueNodeT<3, GetKeyedGeneric> { ...@@ -1864,7 +1865,7 @@ class GetKeyedGeneric : public FixedInputValueNodeT<3, GetKeyedGeneric> {
Input& object_input() { return input(kObjectIndex); } Input& object_input() { return input(kObjectIndex); }
Input& key_input() { return input(kKeyIndex); } Input& key_input() { return input(kKeyIndex); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -1883,7 +1884,7 @@ class GapMove : public FixedInputNodeT<0, GapMove> { ...@@ -1883,7 +1884,7 @@ class GapMove : public FixedInputNodeT<0, GapMove> {
compiler::AllocatedOperand source() const { return source_; } compiler::AllocatedOperand source() const { return source_; }
compiler::AllocatedOperand target() const { return target_; } compiler::AllocatedOperand target() const { return target_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1903,7 +1904,7 @@ class ConstantGapMove : public FixedInputNodeT<0, ConstantGapMove> { ...@@ -1903,7 +1904,7 @@ class ConstantGapMove : public FixedInputNodeT<0, ConstantGapMove> {
compiler::AllocatedOperand target() const { return target_; } compiler::AllocatedOperand target() const { return target_; }
ValueNode* node() const { return node_; } ValueNode* node() const { return node_; }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1932,7 +1933,7 @@ class Phi : public ValueNodeT<Phi> { ...@@ -1932,7 +1933,7 @@ class Phi : public ValueNodeT<Phi> {
using Node::reduce_input_count; using Node::reduce_input_count;
using Node::set_input; using Node::set_input;
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void AllocateVregInPostProcess(MaglevVregAllocationState*); void AllocateVregInPostProcess(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -1977,7 +1978,7 @@ class Call : public ValueNodeT<Call> { ...@@ -1977,7 +1978,7 @@ class Call : public ValueNodeT<Call> {
set_input(i + kFixedInputCount, node); set_input(i + kFixedInputCount, node);
} }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -2019,7 +2020,7 @@ class Construct : public ValueNodeT<Construct> { ...@@ -2019,7 +2020,7 @@ class Construct : public ValueNodeT<Construct> {
set_input(i + kFixedInputCount, node); set_input(i + kFixedInputCount, node);
} }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -2237,7 +2238,7 @@ class Jump : public UnconditionalControlNodeT<Jump> { ...@@ -2237,7 +2238,7 @@ class Jump : public UnconditionalControlNodeT<Jump> {
: Base(bitfield, target_refs), : Base(bitfield, target_refs),
relative_jump_bytecode_offset_(relative_jump_bytecode_offset) {} relative_jump_bytecode_offset_(relative_jump_bytecode_offset) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -2266,7 +2267,7 @@ class JumpLoop : public UnconditionalControlNodeT<JumpLoop> { ...@@ -2266,7 +2267,7 @@ class JumpLoop : public UnconditionalControlNodeT<JumpLoop> {
loop_depth_(loop_depth), loop_depth_(loop_depth),
feedback_slot_(feedback_slot) {} feedback_slot_(feedback_slot) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -2286,7 +2287,7 @@ class JumpToInlined : public UnconditionalControlNodeT<JumpToInlined> { ...@@ -2286,7 +2287,7 @@ class JumpToInlined : public UnconditionalControlNodeT<JumpToInlined> {
MaglevCompilationUnit* unit) MaglevCompilationUnit* unit)
: Base(bitfield, target_refs), unit_(unit) {} : Base(bitfield, target_refs), unit_(unit) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -2306,7 +2307,7 @@ class JumpFromInlined : public UnconditionalControlNodeT<JumpFromInlined> { ...@@ -2306,7 +2307,7 @@ class JumpFromInlined : public UnconditionalControlNodeT<JumpFromInlined> {
: Base(bitfield, target_refs), : Base(bitfield, target_refs),
relative_jump_bytecode_offset_(relative_jump_bytecode_offset) {} relative_jump_bytecode_offset_(relative_jump_bytecode_offset) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -2326,7 +2327,7 @@ class Return : public ControlNode { ...@@ -2326,7 +2327,7 @@ class Return : public ControlNode {
Input& value_input() { return input(0); } Input& value_input() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
...@@ -2343,7 +2344,7 @@ class Deopt : public ControlNode { ...@@ -2343,7 +2344,7 @@ class Deopt : public ControlNode {
static constexpr OpProperties kProperties = OpProperties::EagerDeopt(); static constexpr OpProperties kProperties = OpProperties::EagerDeopt();
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -2358,7 +2359,7 @@ class BranchIfTrue : public ConditionalControlNodeT<1, BranchIfTrue> { ...@@ -2358,7 +2359,7 @@ class BranchIfTrue : public ConditionalControlNodeT<1, BranchIfTrue> {
Input& condition_input() { return input(0); } Input& condition_input() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -2376,7 +2377,7 @@ class BranchIfToBooleanTrue ...@@ -2376,7 +2377,7 @@ class BranchIfToBooleanTrue
Input& condition_input() { return input(0); } Input& condition_input() { return input(0); }
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {} void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
}; };
...@@ -2396,7 +2397,7 @@ class BranchIfInt32Compare ...@@ -2396,7 +2397,7 @@ class BranchIfInt32Compare
BasicBlockRef* if_false_refs) BasicBlockRef* if_false_refs)
: Base(bitfield, if_true_refs, if_false_refs), operation_(operation) {} : Base(bitfield, if_true_refs, if_false_refs), operation_(operation) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
...@@ -2419,7 +2420,7 @@ class BranchIfFloat64Compare ...@@ -2419,7 +2420,7 @@ class BranchIfFloat64Compare
BasicBlockRef* if_false_refs) BasicBlockRef* if_false_refs)
: Base(bitfield, if_true_refs, if_false_refs), operation_(operation) {} : Base(bitfield, if_true_refs, if_false_refs), operation_(operation) {}
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&); void AllocateVreg(MaglevVregAllocationState*);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&); void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const; void PrintParams(std::ostream&, MaglevGraphLabeller*) const;
......
...@@ -233,6 +233,22 @@ void StraightForwardRegisterAllocator::AllocateRegisters(Graph* graph) { ...@@ -233,6 +233,22 @@ void StraightForwardRegisterAllocator::AllocateRegisters(Graph* graph) {
printing_visitor_->PreProcessGraph(compilation_info_, graph); printing_visitor_->PreProcessGraph(compilation_info_, graph);
} }
for (Constant* constant : graph->constants()) {
constant->SetConstantLocation();
}
for (const auto& [index, constant] : graph->root()) {
constant->SetConstantLocation();
}
for (const auto& [value, constant] : graph->smi()) {
constant->SetConstantLocation();
}
for (const auto& [value, constant] : graph->int32()) {
constant->SetConstantLocation();
}
for (const auto& [value, constant] : graph->float64()) {
constant->SetConstantLocation();
}
for (block_it_ = graph->begin(); block_it_ != graph->end(); ++block_it_) { for (block_it_ = graph->begin(); block_it_ != graph->end(); ++block_it_) {
BasicBlock* block = *block_it_; BasicBlock* block = *block_it_;
...@@ -797,7 +813,7 @@ void StraightForwardRegisterAllocator::AssignArbitraryRegisterInput( ...@@ -797,7 +813,7 @@ void StraightForwardRegisterAllocator::AssignArbitraryRegisterInput(
input.SetAllocated(allocation); input.SetAllocated(allocation);
DCHECK_NE(location, allocation); DCHECK_NE(location, allocation);
AddMoveBeforeCurrentNode(node, location, allocation); AddMoveBeforeCurrentNode(node, location, allocation);
}; }
} }
void StraightForwardRegisterAllocator::AssignInputs(NodeBase* node) { void StraightForwardRegisterAllocator::AssignInputs(NodeBase* node) {
......
...@@ -26,7 +26,23 @@ class MaglevVregAllocationState { ...@@ -26,7 +26,23 @@ class MaglevVregAllocationState {
class MaglevVregAllocator { class MaglevVregAllocator {
public: public:
void PreProcessGraph(MaglevCompilationInfo*, Graph* graph) {} void PreProcessGraph(MaglevCompilationInfo*, Graph* graph) {
for (Constant* constant : graph->constants()) {
constant->AllocateVreg(&state_);
}
for (const auto& [index, constant] : graph->root()) {
constant->AllocateVreg(&state_);
}
for (const auto& [index, constant] : graph->smi()) {
constant->AllocateVreg(&state_);
}
for (const auto& [index, constant] : graph->int32()) {
constant->AllocateVreg(&state_);
}
for (const auto& [index, constant] : graph->float64()) {
constant->AllocateVreg(&state_);
}
}
void PostProcessGraph(MaglevCompilationInfo*, Graph* graph) { void PostProcessGraph(MaglevCompilationInfo*, Graph* graph) {
for (BasicBlock* block : *graph) { for (BasicBlock* block : *graph) {
if (!block->has_phi()) continue; if (!block->has_phi()) continue;
...@@ -39,7 +55,7 @@ class MaglevVregAllocator { ...@@ -39,7 +55,7 @@ class MaglevVregAllocator {
#define DEF_PROCESS_NODE(NAME) \ #define DEF_PROCESS_NODE(NAME) \
void Process(NAME* node, const ProcessingState& state) { \ void Process(NAME* node, const ProcessingState& state) { \
node->AllocateVreg(&state_, state); \ node->AllocateVreg(&state_); \
} }
NODE_BASE_LIST(DEF_PROCESS_NODE) NODE_BASE_LIST(DEF_PROCESS_NODE)
#undef DEF_PROCESS_NODE #undef DEF_PROCESS_NODE
......
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