Commit 01e657d4 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Inline FastCloneRegExpStub to CreateRegExpLiteral bytecode handler.

BUG=v8:4280

Review-Url: https://codereview.chromium.org/2217193002
Cr-Commit-Position: refs/heads/master@{#38422}
parent 642c184f
......@@ -4615,14 +4615,20 @@ void FastNewFunctionContextStub::GenerateAssembly(
assembler->Return(Generate(assembler, function, slots, context));
}
void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const {
// static
compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
compiler::Node* closure,
compiler::Node* literal_index,
compiler::Node* pattern,
compiler::Node* flags,
compiler::Node* context) {
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
typedef compiler::Node Node;
Label call_runtime(assembler, Label::kDeferred);
Label call_runtime(assembler, Label::kDeferred), end(assembler);
Node* closure = assembler->Parameter(Descriptor::kClosure);
Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex);
Variable result(assembler, MachineRepresentation::kTagged);
Node* undefined = assembler->UndefinedConstant();
Node* literals_array =
......@@ -4641,17 +4647,31 @@ void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const {
Node* value = assembler->LoadObjectField(boilerplate, offset);
assembler->StoreObjectFieldNoWriteBarrier(copy, offset, value);
}
assembler->Return(copy);
result.Bind(copy);
assembler->Goto(&end);
}
assembler->Bind(&call_runtime);
{
Node* context = assembler->Parameter(Descriptor::kContext);
Node* pattern = assembler->Parameter(Descriptor::kPattern);
Node* flags = assembler->Parameter(Descriptor::kFlags);
assembler->TailCallRuntime(Runtime::kCreateRegExpLiteral, context, closure,
literal_index, pattern, flags);
result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context,
closure, literal_index, pattern, flags));
assembler->Goto(&end);
}
assembler->Bind(&end);
return result.value();
}
void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* closure = assembler->Parameter(Descriptor::kClosure);
Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex);
Node* pattern = assembler->Parameter(Descriptor::kPattern);
Node* flags = assembler->Parameter(Descriptor::kFlags);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->Return(
Generate(assembler, closure, literal_index, pattern, flags, context));
}
void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
......
......@@ -1169,6 +1169,13 @@ class FastCloneRegExpStub final : public TurboFanCodeStub {
public:
explicit FastCloneRegExpStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
static compiler::Node* Generate(CodeStubAssembler* assembler,
compiler::Node* closure,
compiler::Node* literal_index,
compiler::Node* pattern,
compiler::Node* flags,
compiler::Node* context);
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneRegExp);
DEFINE_TURBOFAN_CODE_STUB(FastCloneRegExp, TurboFanCodeStub);
......
......@@ -1594,8 +1594,6 @@ void Interpreter::DoJumpIfNotHoleConstant(InterpreterAssembler* assembler) {
// Creates a regular expression literal for literal index <literal_idx> with
// <flags> and the pattern in <pattern_idx>.
void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) {
Callable callable = CodeFactory::FastCloneRegExp(isolate_);
Node* target = __ HeapConstant(callable.code());
Node* index = __ BytecodeOperandIdx(0);
Node* pattern = __ LoadConstantPoolEntry(index);
Node* literal_index_raw = __ BytecodeOperandIdx(1);
......@@ -1604,8 +1602,8 @@ void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) {
Node* flags = __ SmiTag(flags_raw);
Node* closure = __ LoadRegister(Register::function_closure());
Node* context = __ GetContext();
Node* result = __ CallStub(callable.descriptor(), target, context, closure,
literal_index, pattern, flags);
Node* result = FastCloneRegExpStub::Generate(
assembler, closure, literal_index, pattern, flags, context);
__ SetAccumulator(result);
__ Dispatch();
}
......
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