[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: Leszek 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}
This commit is contained in:
parent
8a744da3b4
commit
56adca8ed6
@ -979,7 +979,14 @@ MAGLEV_UNIMPLEMENTED_BYTECODE(ToString)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateRegExpLiteral)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateArrayLiteral)
|
||||
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(CreateEmptyObjectLiteral)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(CloneObject)
|
||||
|
@ -73,6 +73,7 @@ class MaglevGraphVerifier {
|
||||
case Opcode::kJumpLoop:
|
||||
case Opcode::kJumpToInlined:
|
||||
case Opcode::kJumpFromInlined:
|
||||
case Opcode::kCreateEmptyArrayLiteral:
|
||||
// No input.
|
||||
DCHECK_EQ(node->input_count(), 0);
|
||||
break;
|
||||
|
@ -491,6 +491,19 @@ void RootConstant::PrintParams(std::ostream& os,
|
||||
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,
|
||||
const ProcessingState& state) {
|
||||
UseRegister(actual_map_input());
|
||||
|
@ -65,28 +65,29 @@ class CompactInterpreterFrameState;
|
||||
V(GenericGreaterThan) \
|
||||
V(GenericGreaterThanOrEqual)
|
||||
|
||||
#define VALUE_NODE_LIST(V) \
|
||||
V(Call) \
|
||||
V(Constant) \
|
||||
V(InitialValue) \
|
||||
V(LoadTaggedField) \
|
||||
V(LoadDoubleField) \
|
||||
V(LoadGlobal) \
|
||||
V(LoadNamedGeneric) \
|
||||
V(SetNamedGeneric) \
|
||||
V(Phi) \
|
||||
V(RegisterInput) \
|
||||
V(RootConstant) \
|
||||
V(SmiConstant) \
|
||||
V(CheckedSmiTag) \
|
||||
V(CheckedSmiUntag) \
|
||||
V(Int32AddWithOverflow) \
|
||||
V(Int32Constant) \
|
||||
V(Float64Constant) \
|
||||
V(ChangeInt32ToFloat64) \
|
||||
V(Float64Box) \
|
||||
V(CheckedFloat64Unbox) \
|
||||
V(Float64Add) \
|
||||
#define VALUE_NODE_LIST(V) \
|
||||
V(Call) \
|
||||
V(Constant) \
|
||||
V(CreateEmptyArrayLiteral) \
|
||||
V(InitialValue) \
|
||||
V(LoadTaggedField) \
|
||||
V(LoadDoubleField) \
|
||||
V(LoadGlobal) \
|
||||
V(LoadNamedGeneric) \
|
||||
V(SetNamedGeneric) \
|
||||
V(Phi) \
|
||||
V(RegisterInput) \
|
||||
V(RootConstant) \
|
||||
V(SmiConstant) \
|
||||
V(CheckedSmiTag) \
|
||||
V(CheckedSmiUntag) \
|
||||
V(Int32AddWithOverflow) \
|
||||
V(Int32Constant) \
|
||||
V(Float64Constant) \
|
||||
V(ChangeInt32ToFloat64) \
|
||||
V(Float64Box) \
|
||||
V(CheckedFloat64Unbox) \
|
||||
V(Float64Add) \
|
||||
GENERIC_OPERATIONS_NODE_LIST(V)
|
||||
|
||||
#define NODE_LIST(V) \
|
||||
@ -1282,6 +1283,28 @@ class RootConstant : public FixedInputValueNodeT<0, RootConstant> {
|
||||
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> {
|
||||
using Base = FixedInputNodeT<1, CheckMaps>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user