Commit 56adca8e authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[maglev] Generic CreateEmptyArrayLiteral node

We should just call the builtin while we don't have inlined
allocations.

Bug: v8:7700
Change-Id: I6da605cc756b0f44fb1366e90e6c0dac60ae9beb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3613326
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80261}
parent 8a744da3
...@@ -979,7 +979,14 @@ MAGLEV_UNIMPLEMENTED_BYTECODE(ToString) ...@@ -979,7 +979,14 @@ MAGLEV_UNIMPLEMENTED_BYTECODE(ToString)
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateRegExpLiteral) MAGLEV_UNIMPLEMENTED_BYTECODE(CreateRegExpLiteral)
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateArrayLiteral) MAGLEV_UNIMPLEMENTED_BYTECODE(CreateArrayLiteral)
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateArrayFromIterable) MAGLEV_UNIMPLEMENTED_BYTECODE(CreateArrayFromIterable)
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateEmptyArrayLiteral)
void MaglevGraphBuilder::VisitCreateEmptyArrayLiteral() {
// TODO(v8:7700): Consider inlining the allocation.
FeedbackSlot slot_index = GetSlotOperand(0);
SetAccumulator(AddNewNode<CreateEmptyArrayLiteral>(
{}, compiler::FeedbackSource{feedback(), slot_index}));
}
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateObjectLiteral) MAGLEV_UNIMPLEMENTED_BYTECODE(CreateObjectLiteral)
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateEmptyObjectLiteral) MAGLEV_UNIMPLEMENTED_BYTECODE(CreateEmptyObjectLiteral)
MAGLEV_UNIMPLEMENTED_BYTECODE(CloneObject) MAGLEV_UNIMPLEMENTED_BYTECODE(CloneObject)
......
...@@ -73,6 +73,7 @@ class MaglevGraphVerifier { ...@@ -73,6 +73,7 @@ class MaglevGraphVerifier {
case Opcode::kJumpLoop: case Opcode::kJumpLoop:
case Opcode::kJumpToInlined: case Opcode::kJumpToInlined:
case Opcode::kJumpFromInlined: case Opcode::kJumpFromInlined:
case Opcode::kCreateEmptyArrayLiteral:
// No input. // No input.
DCHECK_EQ(node->input_count(), 0); DCHECK_EQ(node->input_count(), 0);
break; break;
......
...@@ -491,6 +491,19 @@ void RootConstant::PrintParams(std::ostream& os, ...@@ -491,6 +491,19 @@ void RootConstant::PrintParams(std::ostream& os,
os << "(" << RootsTable::name(index()) << ")"; os << "(" << RootsTable::name(index()) << ")";
} }
void CreateEmptyArrayLiteral::AllocateVreg(
MaglevVregAllocationState* vreg_state, const ProcessingState& state) {
DefineAsFixed(vreg_state, this, kReturnRegister0);
}
void CreateEmptyArrayLiteral::GenerateCode(MaglevCodeGenState* code_gen_state,
const ProcessingState& state) {
using D = CreateEmptyArrayLiteralDescriptor;
__ Move(kContextRegister, code_gen_state->native_context().object());
__ Move(D::GetRegisterParameter(D::kSlot), Immediate(feedback().index()));
__ Move(D::GetRegisterParameter(D::kFeedbackVector), feedback().vector);
__ CallBuiltin(Builtin::kCreateEmptyArrayLiteral);
}
void CheckMaps::AllocateVreg(MaglevVregAllocationState* vreg_state, void CheckMaps::AllocateVreg(MaglevVregAllocationState* vreg_state,
const ProcessingState& state) { const ProcessingState& state) {
UseRegister(actual_map_input()); UseRegister(actual_map_input());
......
...@@ -65,28 +65,29 @@ class CompactInterpreterFrameState; ...@@ -65,28 +65,29 @@ class CompactInterpreterFrameState;
V(GenericGreaterThan) \ V(GenericGreaterThan) \
V(GenericGreaterThanOrEqual) V(GenericGreaterThanOrEqual)
#define VALUE_NODE_LIST(V) \ #define VALUE_NODE_LIST(V) \
V(Call) \ V(Call) \
V(Constant) \ V(Constant) \
V(InitialValue) \ V(CreateEmptyArrayLiteral) \
V(LoadTaggedField) \ V(InitialValue) \
V(LoadDoubleField) \ V(LoadTaggedField) \
V(LoadGlobal) \ V(LoadDoubleField) \
V(LoadNamedGeneric) \ V(LoadGlobal) \
V(SetNamedGeneric) \ V(LoadNamedGeneric) \
V(Phi) \ V(SetNamedGeneric) \
V(RegisterInput) \ V(Phi) \
V(RootConstant) \ V(RegisterInput) \
V(SmiConstant) \ V(RootConstant) \
V(CheckedSmiTag) \ V(SmiConstant) \
V(CheckedSmiUntag) \ V(CheckedSmiTag) \
V(Int32AddWithOverflow) \ V(CheckedSmiUntag) \
V(Int32Constant) \ V(Int32AddWithOverflow) \
V(Float64Constant) \ V(Int32Constant) \
V(ChangeInt32ToFloat64) \ V(Float64Constant) \
V(Float64Box) \ V(ChangeInt32ToFloat64) \
V(CheckedFloat64Unbox) \ V(Float64Box) \
V(Float64Add) \ V(CheckedFloat64Unbox) \
V(Float64Add) \
GENERIC_OPERATIONS_NODE_LIST(V) GENERIC_OPERATIONS_NODE_LIST(V)
#define NODE_LIST(V) \ #define NODE_LIST(V) \
...@@ -1282,6 +1283,28 @@ class RootConstant : public FixedInputValueNodeT<0, RootConstant> { ...@@ -1282,6 +1283,28 @@ class RootConstant : public FixedInputValueNodeT<0, RootConstant> {
const RootIndex index_; const RootIndex index_;
}; };
class CreateEmptyArrayLiteral
: public FixedInputValueNodeT<0, CreateEmptyArrayLiteral> {
using Base = FixedInputValueNodeT<0, CreateEmptyArrayLiteral>;
public:
explicit CreateEmptyArrayLiteral(uint32_t bitfield,
const compiler::FeedbackSource& feedback)
: Base(bitfield), feedback_(feedback) {}
compiler::FeedbackSource feedback() const { return feedback_; }
// The implementation currently calls runtime.
static constexpr OpProperties kProperties = OpProperties::Call();
void AllocateVreg(MaglevVregAllocationState*, const ProcessingState&);
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
private:
const compiler::FeedbackSource feedback_;
};
class CheckMaps : public FixedInputNodeT<1, CheckMaps> { class CheckMaps : public FixedInputNodeT<1, CheckMaps> {
using Base = FixedInputNodeT<1, CheckMaps>; using Base = FixedInputNodeT<1, CheckMaps>;
......
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