[maglev] Support CreateRegExpLiteral
Bug: v8:7700 Change-Id: Ie39c1d0bec0ea51839e5ca7c7efac46cab878178 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3785304 Auto-Submit: Victor Gomes <victorgomes@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#81955}
This commit is contained in:
parent
ef1dfcadb4
commit
dc0be4e376
@ -1616,7 +1616,17 @@ MAGLEV_UNIMPLEMENTED_BYTECODE(ToNumber)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(ToNumeric)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(ToObject)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(ToString)
|
||||
MAGLEV_UNIMPLEMENTED_BYTECODE(CreateRegExpLiteral)
|
||||
|
||||
void MaglevGraphBuilder::VisitCreateRegExpLiteral() {
|
||||
// CreateRegExpLiteral <pattern_idx> <literal_idx> <flags>
|
||||
compiler::StringRef pattern = GetRefOperand<String>(0);
|
||||
FeedbackSlot slot = GetSlotOperand(1);
|
||||
uint32_t flags = GetFlagOperand(2);
|
||||
compiler::FeedbackSource feedback_source{feedback(), slot};
|
||||
// TODO(victorgomes): Inline allocation if feedback has a RegExpLiteral.
|
||||
SetAccumulator(
|
||||
AddNewNode<CreateRegExpLiteral>({}, pattern, feedback_source, flags));
|
||||
}
|
||||
|
||||
void MaglevGraphBuilder::VisitCreateArrayLiteral() {
|
||||
compiler::HeapObjectRef constant_elements = GetRefOperand<HeapObject>(0);
|
||||
|
@ -68,6 +68,7 @@ class MaglevGraphVerifier {
|
||||
case Opcode::kCreateShallowArrayLiteral:
|
||||
case Opcode::kCreateObjectLiteral:
|
||||
case Opcode::kCreateShallowObjectLiteral:
|
||||
case Opcode::kCreateRegExpLiteral:
|
||||
case Opcode::kDeopt:
|
||||
case Opcode::kFloat64Constant:
|
||||
case Opcode::kGapMove:
|
||||
|
@ -894,6 +894,21 @@ void CreateClosure::PrintParams(std::ostream& os,
|
||||
os << ")";
|
||||
}
|
||||
|
||||
void CreateRegExpLiteral::AllocateVreg(MaglevVregAllocationState* vreg_state) {
|
||||
DefineAsFixed(vreg_state, this, kReturnRegister0);
|
||||
}
|
||||
void CreateRegExpLiteral::GenerateCode(MaglevCodeGenState* code_gen_state,
|
||||
const ProcessingState& state) {
|
||||
using D = CreateRegExpLiteralDescriptor;
|
||||
__ Move(D::ContextRegister(), code_gen_state->native_context().object());
|
||||
__ Move(D::GetRegisterParameter(D::kMaybeFeedbackVector), feedback().vector);
|
||||
__ Move(D::GetRegisterParameter(D::kSlot),
|
||||
TaggedIndex::FromIntptr(feedback().index()));
|
||||
__ Move(D::GetRegisterParameter(D::kPattern), pattern().object());
|
||||
__ Move(D::GetRegisterParameter(D::kFlags), Smi::FromInt(flags()));
|
||||
__ CallBuiltin(Builtin::kCreateRegExpLiteral);
|
||||
}
|
||||
|
||||
void Abort::GenerateCode(MaglevCodeGenState* code_gen_state,
|
||||
const ProcessingState& state) {
|
||||
__ Push(Smi::FromInt(static_cast<int>(reason())));
|
||||
|
@ -127,6 +127,7 @@ class CompactInterpreterFrameState;
|
||||
V(CreateFunctionContext) \
|
||||
V(CreateClosure) \
|
||||
V(FastCreateClosure) \
|
||||
V(CreateRegExpLiteral) \
|
||||
V(InitialValue) \
|
||||
V(LoadTaggedField) \
|
||||
V(LoadDoubleField) \
|
||||
@ -1961,6 +1962,34 @@ class FastCreateClosure : public FixedInputValueNodeT<1, FastCreateClosure> {
|
||||
const compiler::FeedbackCellRef feedback_cell_;
|
||||
};
|
||||
|
||||
class CreateRegExpLiteral
|
||||
: public FixedInputValueNodeT<0, CreateRegExpLiteral> {
|
||||
using Base = FixedInputValueNodeT<0, CreateRegExpLiteral>;
|
||||
|
||||
public:
|
||||
explicit CreateRegExpLiteral(uint64_t bitfield,
|
||||
const compiler::StringRef& pattern,
|
||||
const compiler::FeedbackSource& feedback,
|
||||
int flags)
|
||||
: Base(bitfield), pattern_(pattern), feedback_(feedback), flags_(flags) {}
|
||||
|
||||
compiler::StringRef pattern() { return pattern_; }
|
||||
compiler::FeedbackSource feedback() const { return feedback_; }
|
||||
int flags() const { return flags_; }
|
||||
|
||||
// The implementation currently calls runtime.
|
||||
static constexpr OpProperties kProperties = OpProperties::Call();
|
||||
|
||||
void AllocateVreg(MaglevVregAllocationState*);
|
||||
void GenerateCode(MaglevCodeGenState*, const ProcessingState&);
|
||||
void PrintParams(std::ostream&, MaglevGraphLabeller*) const {}
|
||||
|
||||
private:
|
||||
compiler::StringRef pattern_;
|
||||
const compiler::FeedbackSource feedback_;
|
||||
const int flags_;
|
||||
};
|
||||
|
||||
class CreateClosure : public FixedInputValueNodeT<1, CreateClosure> {
|
||||
using Base = FixedInputValueNodeT<1, CreateClosure>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user