[turbofan] Add handling of Construct to the serializer
This CL adds handling for Construct bytecode to the serializer for backgorund compilation, similar to the hanling of Call* bytecodes. Design doc: https://docs.google.com/document/d/1vCQYhtFPqXafSMweSnGD8l0TKEIB6cPV5UGMHJtpy8k/edit?ts=5bf7d341 Bug: v8:7790 Change-Id: If518ba44fff18c1b30fdf5c764bdb9e77886af78 Reviewed-on: https://chromium-review.googlesource.com/c/1424947 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#58967}
This commit is contained in:
parent
2e161cfd5b
commit
337c773069
@ -327,7 +327,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver0(
|
||||
|
||||
HintsVector parameters(zone());
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver1(
|
||||
@ -344,7 +344,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver1(
|
||||
HintsVector parameters(zone());
|
||||
parameters.push_back(arg0);
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver2(
|
||||
@ -364,7 +364,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver2(
|
||||
parameters.push_back(arg0);
|
||||
parameters.push_back(arg1);
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitCallAnyReceiver(
|
||||
@ -391,7 +391,7 @@ void SerializerForBackgroundCompilation::VisitCallProperty0(
|
||||
|
||||
HintsVector parameters(zone());
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitCallProperty1(
|
||||
@ -406,7 +406,7 @@ void SerializerForBackgroundCompilation::VisitCallProperty1(
|
||||
HintsVector parameters(zone());
|
||||
parameters.push_back(arg0);
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitCallProperty2(
|
||||
@ -424,10 +424,10 @@ void SerializerForBackgroundCompilation::VisitCallProperty2(
|
||||
parameters.push_back(arg0);
|
||||
parameters.push_back(arg1);
|
||||
|
||||
ProcessCall(callee, receiver, parameters);
|
||||
ProcessCallOrConstruct(callee, receiver, parameters);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::ProcessCall(
|
||||
void SerializerForBackgroundCompilation::ProcessCallOrConstruct(
|
||||
const Hints& callee, const Hints& receiver, const HintsVector& arguments) {
|
||||
environment()->ClearAccumulatorHints();
|
||||
|
||||
@ -482,7 +482,7 @@ void SerializerForBackgroundCompilation::ProcessCallVarArgs(
|
||||
environment()->LookupRegister(interpreter::Register(arg_base + i)));
|
||||
}
|
||||
|
||||
ProcessCall(callee, receiver, arguments);
|
||||
ProcessCallOrConstruct(callee, receiver, arguments);
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitReturn(
|
||||
@ -491,6 +491,36 @@ void SerializerForBackgroundCompilation::VisitReturn(
|
||||
environment()->Clear();
|
||||
}
|
||||
|
||||
void SerializerForBackgroundCompilation::VisitConstruct(
|
||||
interpreter::BytecodeArrayIterator* iterator) {
|
||||
const Hints& callee =
|
||||
environment()->LookupRegister(iterator->GetRegisterOperand(0));
|
||||
|
||||
interpreter::Register first_reg = iterator->GetRegisterOperand(1);
|
||||
size_t reg_count = iterator->GetRegisterCountOperand(2);
|
||||
|
||||
Hints receiver = environment()->LookupRegister(first_reg);
|
||||
interpreter::Register first_arg =
|
||||
interpreter::Register(first_reg.index() + 1);
|
||||
|
||||
int arg_count = static_cast<int>(reg_count) - 1;
|
||||
|
||||
HintsVector arguments(zone());
|
||||
// Push the target of the construct.
|
||||
arguments.push_back(callee);
|
||||
|
||||
// The function arguments are in consecutive registers.
|
||||
int arg_base = first_arg.index();
|
||||
for (int i = 0; i < arg_count; ++i) {
|
||||
arguments.push_back(
|
||||
environment()->LookupRegister(interpreter::Register(arg_base + i)));
|
||||
}
|
||||
// Push the new_target of the construct.
|
||||
arguments.push_back(environment()->LookupAccumulator());
|
||||
|
||||
ProcessCallOrConstruct(callee, receiver, arguments);
|
||||
}
|
||||
|
||||
#define DEFINE_SKIPPED_JUMP(name, ...) \
|
||||
void SerializerForBackgroundCompilation::Visit##name( \
|
||||
interpreter::BytecodeArrayIterator* iterator) { \
|
||||
|
@ -63,7 +63,8 @@ namespace compiler {
|
||||
V(Throw)
|
||||
|
||||
#define CLEAR_ACCUMULATOR_LIST(V) \
|
||||
V(Construct) \
|
||||
V(CallWithSpread) \
|
||||
V(ConstructWithSpread) \
|
||||
V(CreateClosure) \
|
||||
V(CreateEmptyObjectLiteral) \
|
||||
V(CreateMappedArguments) \
|
||||
@ -90,6 +91,7 @@ namespace compiler {
|
||||
V(CallUndefinedReceiver0) \
|
||||
V(CallUndefinedReceiver1) \
|
||||
V(CallUndefinedReceiver2) \
|
||||
V(Construct) \
|
||||
V(ExtraWide) \
|
||||
V(Illegal) \
|
||||
V(LdaConstant) \
|
||||
@ -138,8 +140,8 @@ class SerializerForBackgroundCompilation {
|
||||
JSHeapBroker* broker() const { return broker_; }
|
||||
Environment* environment() const { return environment_; }
|
||||
|
||||
void ProcessCall(const Hints& callee, const Hints& receiver,
|
||||
const HintsVector& arguments);
|
||||
void ProcessCallOrConstruct(const Hints& callee, const Hints& receiver,
|
||||
const HintsVector& arguments);
|
||||
void ProcessCallVarArgs(interpreter::BytecodeArrayIterator* iterator,
|
||||
ConvertReceiverMode receiver_mode);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user