Commit cd2af2c7 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[nci] Add remaining Call and Construct builtins with feedback

Call_WithFeedback
CallWithArrayLike_WithFeedback
CallWithSpread_WithFeedback

ConstructWithArrayLike_WithFeedback
ConstructWithSpread_WithFeedback

These are used in generic lowering if --turbo-nci is passed.

Bug: v8:8888
Change-Id: I78b56a1f358fa7c213e375eeb2feaa65432adfdb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2199352Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67888}
parent 67990d56
......@@ -64,6 +64,49 @@ void Builtins::Generate_CallFunctionForwardVarargs(MacroAssembler* masm) {
masm->isolate()->builtins()->CallFunction());
}
TF_BUILTIN(Call_ReceiverIsNullOrUndefined_WithFeedback,
CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kFunction));
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
CollectCallFeedback(target, context, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)));
TailCallBuiltin(Builtins::kCall_ReceiverIsNullOrUndefined, context, target,
argc);
}
TF_BUILTIN(Call_ReceiverIsNotNullOrUndefined_WithFeedback,
CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kFunction));
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
CollectCallFeedback(target, context, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)));
TailCallBuiltin(Builtins::kCall_ReceiverIsNotNullOrUndefined, context, target,
argc);
}
TF_BUILTIN(Call_ReceiverIsAny_WithFeedback, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kFunction));
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
CollectCallFeedback(target, context, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)));
TailCallBuiltin(Builtins::kCall_ReceiverIsAny, context, target, argc);
}
void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
TNode<Object> target, base::Optional<TNode<Object>> new_target,
TNode<Object> arguments_list, TNode<Context> context) {
......@@ -387,6 +430,19 @@ TF_BUILTIN(CallWithArrayLike, CallOrConstructBuiltinsAssembler) {
CallOrConstructWithArrayLike(target, new_target, arguments_list, context);
}
TF_BUILTIN(CallWithArrayLike_WithFeedback, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
base::Optional<TNode<Object>> new_target = base::nullopt;
TNode<Object> arguments_list = CAST(Parameter(Descriptor::kArgumentsList));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
CollectCallFeedback(target, context, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)));
CallOrConstructWithArrayLike(target, new_target, arguments_list, context);
}
TF_BUILTIN(CallWithSpread, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
base::Optional<TNode<Object>> new_target = base::nullopt;
......@@ -397,6 +453,21 @@ TF_BUILTIN(CallWithSpread, CallOrConstructBuiltinsAssembler) {
CallOrConstructWithSpread(target, new_target, spread, args_count, context);
}
TF_BUILTIN(CallWithSpread_WithFeedback, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
base::Optional<TNode<Object>> new_target = base::nullopt;
TNode<Object> spread = CAST(Parameter(Descriptor::kSpread));
TNode<Int32T> args_count =
UncheckedCast<Int32T>(Parameter(Descriptor::kArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
CollectCallFeedback(target, context, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)));
CallOrConstructWithSpread(target, new_target, spread, args_count, context);
}
TNode<JSReceiver> CallOrConstructBuiltinsAssembler::GetCompatibleReceiver(
TNode<JSReceiver> receiver, TNode<HeapObject> signature,
TNode<Context> context) {
......
......@@ -69,6 +69,30 @@ TF_BUILTIN(ConstructWithArrayLike, CallOrConstructBuiltinsAssembler) {
CallOrConstructWithArrayLike(target, new_target, arguments_list, context);
}
TF_BUILTIN(ConstructWithArrayLike_WithFeedback,
CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget));
TNode<Object> arguments_list = CAST(Parameter(Descriptor::kArgumentsList));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
TVARIABLE(AllocationSite, allocation_site);
Label if_construct_generic(this), if_construct_array(this);
CollectConstructFeedback(context, target, new_target, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)),
&if_construct_generic, &if_construct_array,
&allocation_site);
BIND(&if_construct_array);
Goto(&if_construct_generic); // Not implemented.
BIND(&if_construct_generic);
CallOrConstructWithArrayLike(target, new_target, arguments_list, context);
}
TF_BUILTIN(ConstructWithSpread, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget));
......@@ -79,6 +103,31 @@ TF_BUILTIN(ConstructWithSpread, CallOrConstructBuiltinsAssembler) {
CallOrConstructWithSpread(target, new_target, spread, args_count, context);
}
TF_BUILTIN(ConstructWithSpread_WithFeedback, CallOrConstructBuiltinsAssembler) {
TNode<Object> target = CAST(Parameter(Descriptor::kTarget));
TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget));
TNode<Object> spread = CAST(Parameter(Descriptor::kSpread));
TNode<Int32T> args_count =
UncheckedCast<Int32T>(Parameter(Descriptor::kActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<HeapObject> maybe_feedback_vector =
CAST(Parameter(Descriptor::kMaybeFeedbackVector));
TNode<Int32T> slot = UncheckedCast<Int32T>(Parameter(Descriptor::kSlot));
TVARIABLE(AllocationSite, allocation_site);
Label if_construct_generic(this), if_construct_array(this);
CollectConstructFeedback(context, target, new_target, maybe_feedback_vector,
Unsigned(ChangeInt32ToIntPtr(slot)),
&if_construct_generic, &if_construct_array,
&allocation_site);
BIND(&if_construct_array);
Goto(&if_construct_generic); // Not implemented.
BIND(&if_construct_generic);
CallOrConstructWithSpread(target, new_target, spread, args_count, context);
}
using Node = compiler::Node;
TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
......
......@@ -51,12 +51,19 @@ namespace internal {
ASM(Call_ReceiverIsNullOrUndefined, CallTrampoline) \
ASM(Call_ReceiverIsNotNullOrUndefined, CallTrampoline) \
ASM(Call_ReceiverIsAny, CallTrampoline) \
TFC(Call_ReceiverIsNullOrUndefined_WithFeedback, \
CallTrampoline_WithFeedback) \
TFC(Call_ReceiverIsNotNullOrUndefined_WithFeedback, \
CallTrampoline_WithFeedback) \
TFC(Call_ReceiverIsAny_WithFeedback, CallTrampoline_WithFeedback) \
\
/* ES6 section 9.5.12[[Call]] ( thisArgument, argumentsList ) */ \
TFC(CallProxy, CallTrampoline) \
ASM(CallVarargs, CallVarargs) \
TFC(CallWithSpread, CallWithSpread) \
TFC(CallWithSpread_WithFeedback, CallWithSpread_WithFeedback) \
TFC(CallWithArrayLike, CallWithArrayLike) \
TFC(CallWithArrayLike_WithFeedback, CallWithArrayLike_WithFeedback) \
ASM(CallForwardVarargs, CallForwardVarargs) \
ASM(CallFunctionForwardVarargs, CallForwardVarargs) \
/* Call an API callback via a {FunctionTemplateInfo}, doing appropriate */ \
......@@ -76,7 +83,10 @@ namespace internal {
ASM(Construct, JSTrampoline) \
ASM(ConstructVarargs, ConstructVarargs) \
TFC(ConstructWithSpread, ConstructWithSpread) \
TFC(ConstructWithSpread_WithFeedback, ConstructWithSpread_WithFeedback) \
TFC(ConstructWithArrayLike, ConstructWithArrayLike) \
TFC(ConstructWithArrayLike_WithFeedback, \
ConstructWithArrayLike_WithFeedback) \
ASM(ConstructForwardVarargs, ConstructForwardVarargs) \
ASM(ConstructFunctionForwardVarargs, ConstructForwardVarargs) \
TFC(Construct_WithFeedback, Construct_WithFeedback) \
......
......@@ -295,6 +295,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -299,6 +299,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -267,6 +267,23 @@ Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode) {
return Callable(isolate->builtins()->Call(mode), CallTrampolineDescriptor{});
}
// static
Callable CodeFactory::Call_WithFeedback(Isolate* isolate,
ConvertReceiverMode mode) {
switch (mode) {
case ConvertReceiverMode::kNullOrUndefined:
return Builtins::CallableFor(
isolate, Builtins::kCall_ReceiverIsNullOrUndefined_WithFeedback);
case ConvertReceiverMode::kNotNullOrUndefined:
return Builtins::CallableFor(
isolate, Builtins::kCall_ReceiverIsNotNullOrUndefined_WithFeedback);
case ConvertReceiverMode::kAny:
return Builtins::CallableFor(isolate,
Builtins::kCall_ReceiverIsAny_WithFeedback);
}
UNREACHABLE();
}
// static
Callable CodeFactory::CallWithArrayLike(Isolate* isolate) {
return Builtins::CallableFor(isolate, Builtins::kCallWithArrayLike);
......
......@@ -71,6 +71,7 @@ class V8_EXPORT_PRIVATE CodeFactory final {
static Callable ArgumentAdaptor(Isolate* isolate);
static Callable Call(Isolate* isolate,
ConvertReceiverMode mode = ConvertReceiverMode::kAny);
static Callable Call_WithFeedback(Isolate* isolate, ConvertReceiverMode mode);
static Callable CallWithArrayLike(Isolate* isolate);
static Callable CallWithSpread(Isolate* isolate);
static Callable CallFunction(
......
......@@ -312,6 +312,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
This diff is collapsed.
......@@ -322,6 +322,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -322,6 +322,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -295,6 +295,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -295,6 +295,30 @@ void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
DefaultInitializePlatformSpecific(data, 4);
}
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// TODO(v8:8888): Implement on this platform.
......
......@@ -129,6 +129,16 @@ void CallWithSpreadDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rax : number of arguments (on the stack, not including receiver)
// rdi : the target to call
// rbx : the object to spread
// rdx : the feedback slot
Register registers[] = {rdi, rax, rbx, rdx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rdi : the target to call
......@@ -137,6 +147,16 @@ void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rdi : the target to call
// rbx : the arguments list
// rdx : the feedback slot
// rax : the feedback vector
Register registers[] = {rdi, rbx, rdx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructVarargsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rax : number of arguments (on the stack, not including receiver)
......@@ -168,6 +188,16 @@ void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rax : number of arguments (on the stack, not including receiver)
// rdi : the target to call
// rdx : the new target
// rbx : the feedback slot
Register registers[] = {rdi, rdx, rax, rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rdi : the target to call
......@@ -177,6 +207,16 @@ void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rdi : the target to call
// rdx : the new target
// rbx : the arguments list
// rax : the feedback slot
Register registers[] = {rdi, rdx, rbx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructStubDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rax : number of arguments
......
......@@ -2947,8 +2947,8 @@ Reduction JSCallReducer::ReduceReflectConstruct(Node* node) {
while (arity-- > 3) {
node->RemoveInput(arity);
}
NodeProperties::ChangeOp(node,
javascript()->ConstructWithArrayLike(p.frequency()));
NodeProperties::ChangeOp(
node, javascript()->ConstructWithArrayLike(p.frequency(), p.feedback()));
return Changed(node).FollowedBy(ReduceJSConstructWithArrayLike(node));
}
......@@ -4839,9 +4839,11 @@ Reduction JSCallReducer::ReduceStringPrototypeSubstr(Node* node) {
Reduction JSCallReducer::ReduceJSConstructWithArrayLike(Node* node) {
DCHECK_EQ(IrOpcode::kJSConstructWithArrayLike, node->opcode());
CallFrequency frequency = CallFrequencyOf(node->op());
ConstructParameters const& p = ConstructParametersOf(node->op());
const int arity = static_cast<int>(p.arity() - 2);
DCHECK_EQ(arity, 1);
return ReduceCallOrConstructWithArrayLikeOrSpread(
node, 1, frequency, FeedbackSource(),
node, arity, p.frequency(), p.feedback(),
SpeculationMode::kDisallowSpeculation, CallFeedbackRelation::kRelated);
}
......
This diff is collapsed.
......@@ -22,11 +22,6 @@ std::ostream& operator<<(std::ostream& os, CallFrequency const& f) {
return os << f.value();
}
CallFrequency CallFrequencyOf(Operator const* op) {
DCHECK_EQ(op->opcode(), IrOpcode::kJSConstructWithArrayLike);
return OpParameter<CallFrequency>(op);
}
std::ostream& operator<<(std::ostream& os,
ConstructForwardVarargsParameters const& p) {
return os << p.arity() << ", " << p.start_index();
......@@ -60,6 +55,7 @@ std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) {
ConstructParameters const& ConstructParametersOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kJSConstruct ||
op->opcode() == IrOpcode::kJSConstructWithArrayLike ||
op->opcode() == IrOpcode::kJSConstructWithSpread);
return OpParameter<ConstructParameters>(op);
}
......@@ -972,13 +968,15 @@ const Operator* JSOperatorBuilder::Construct(uint32_t arity,
}
const Operator* JSOperatorBuilder::ConstructWithArrayLike(
CallFrequency const& frequency) {
return new (zone()) Operator1<CallFrequency>( // --
IrOpcode::kJSConstructWithArrayLike, // opcode
Operator::kNoProperties, // properties
"JSConstructWithArrayLike", // name
3, 1, 1, 1, 1, 2, // counts
frequency); // parameter
CallFrequency const& frequency, FeedbackSource const& feedback) {
static constexpr uint32_t arity = 3;
ConstructParameters parameters(arity, frequency, feedback);
return new (zone()) Operator1<ConstructParameters>( // --
IrOpcode::kJSConstructWithArrayLike, // opcode
Operator::kNoProperties, // properties
"JSConstructWithArrayLike", // name
parameters.arity(), 1, 1, 1, 1, 2, // counts
parameters); // parameter
}
const Operator* JSOperatorBuilder::ConstructWithSpread(
......
......@@ -60,8 +60,6 @@ class CallFrequency final {
std::ostream& operator<<(std::ostream&, CallFrequency const&);
CallFrequency CallFrequencyOf(Operator const* op) V8_WARN_UNUSED_RESULT;
// Defines the flags for a JavaScript call forwarding parameters. This
// is used as parameter by JSConstructForwardVarargs operators.
class ConstructForwardVarargsParameters final {
......@@ -98,7 +96,8 @@ ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
Operator const*) V8_WARN_UNUSED_RESULT;
// Defines the arity and the feedback for a JavaScript constructor call. This is
// used as a parameter by JSConstruct and JSConstructWithSpread operators.
// used as a parameter by JSConstruct, JSConstructWithArrayLike, and
// JSConstructWithSpread operators.
class ConstructParameters final {
public:
ConstructParameters(uint32_t arity, CallFrequency const& frequency,
......@@ -849,7 +848,8 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* Construct(uint32_t arity,
CallFrequency const& frequency = CallFrequency(),
FeedbackSource const& feedback = FeedbackSource());
const Operator* ConstructWithArrayLike(CallFrequency const& frequency);
const Operator* ConstructWithArrayLike(CallFrequency const& frequency,
FeedbackSource const& feedback);
const Operator* ConstructWithSpread(
uint32_t arity, CallFrequency const& frequency = CallFrequency(),
FeedbackSource const& feedback = FeedbackSource());
......
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