Commit 8add369a authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[asm] Cleanup the various incarnations of PushThenCall/Construct

This CL renames InterpreterPushArgsMode::kJSFunction to kArrayFunction
because we only ever use it for the array function.

We never use PushArgsThenCall with kArrayFunction mode, so remove the
unused helpers that provide the plumbing there.

This is in preparation for changes to PushArgsThenConstruct, where we
will no longer pass the allocation site as undefined for modes other
than kArrayFunction.

Bug: v8:7503
Change-Id: I86e3333e2ebd912fc8f9b0e4248282330af4b9e2
Reviewed-on: https://chromium-review.googlesource.com/972047
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@google.com>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52109}
parent b51f8f66
......@@ -1098,10 +1098,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
}
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Unreachable code.
__ bkpt(0);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1146,7 +1145,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ AssertUndefinedOrAllocationSite(r2, r5);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(r1);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -1240,10 +1240,8 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
receiver_mode, mode);
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ Unreachable();
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1275,7 +1273,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
Generate_InterpreterPushArgs(masm, num_args, first_arg_index, spread_arg_out,
ConvertReceiverMode::kNullOrUndefined, mode);
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(x1);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -110,11 +110,9 @@ namespace internal {
ASM(InterpreterEntryTrampoline) \
ASM(InterpreterPushArgsThenCall) \
ASM(InterpreterPushUndefinedAndArgsThenCall) \
ASM(InterpreterPushArgsThenCallFunction) \
ASM(InterpreterPushUndefinedAndArgsThenCallFunction) \
ASM(InterpreterPushArgsThenCallWithFinalSpread) \
ASM(InterpreterPushArgsThenConstruct) \
ASM(InterpreterPushArgsThenConstructFunction) \
ASM(InterpreterPushArgsThenConstructArrayFunction) \
ASM(InterpreterPushArgsThenConstructWithFinalSpread) \
ASM(InterpreterEnterBytecodeAdvance) \
ASM(InterpreterEnterBytecodeDispatch) \
......
......@@ -14,12 +14,6 @@ void Builtins::Generate_InterpreterPushArgsThenCall(MacroAssembler* masm) {
masm, ConvertReceiverMode::kAny, InterpreterPushArgsMode::kOther);
}
void Builtins::Generate_InterpreterPushArgsThenCallFunction(
MacroAssembler* masm) {
return Generate_InterpreterPushArgsThenCallImpl(
masm, ConvertReceiverMode::kAny, InterpreterPushArgsMode::kJSFunction);
}
void Builtins::Generate_InterpreterPushUndefinedAndArgsThenCall(
MacroAssembler* masm) {
return Generate_InterpreterPushArgsThenCallImpl(
......@@ -27,13 +21,6 @@ void Builtins::Generate_InterpreterPushUndefinedAndArgsThenCall(
InterpreterPushArgsMode::kOther);
}
void Builtins::Generate_InterpreterPushUndefinedAndArgsThenCallFunction(
MacroAssembler* masm) {
return Generate_InterpreterPushArgsThenCallImpl(
masm, ConvertReceiverMode::kNullOrUndefined,
InterpreterPushArgsMode::kJSFunction);
}
void Builtins::Generate_InterpreterPushArgsThenCallWithFinalSpread(
MacroAssembler* masm) {
return Generate_InterpreterPushArgsThenCallImpl(
......@@ -52,10 +39,10 @@ void Builtins::Generate_InterpreterPushArgsThenConstructWithFinalSpread(
masm, InterpreterPushArgsMode::kWithFinalSpread);
}
void Builtins::Generate_InterpreterPushArgsThenConstructFunction(
void Builtins::Generate_InterpreterPushArgsThenConstructArrayFunction(
MacroAssembler* masm) {
return Generate_InterpreterPushArgsThenConstructImpl(
masm, InterpreterPushArgsMode::kJSFunction);
masm, InterpreterPushArgsMode::kArrayFunction);
}
} // namespace internal
......
......@@ -14,15 +14,10 @@ namespace internal {
Handle<Code> Builtins::InterpreterPushArgsThenCall(
ConvertReceiverMode receiver_mode, InterpreterPushArgsMode mode) {
switch (mode) {
case InterpreterPushArgsMode::kJSFunction:
switch (receiver_mode) {
case ConvertReceiverMode::kNullOrUndefined:
return builtin_handle(
kInterpreterPushUndefinedAndArgsThenCallFunction);
case ConvertReceiverMode::kNotNullOrUndefined:
case ConvertReceiverMode::kAny:
return builtin_handle(kInterpreterPushArgsThenCallFunction);
}
case InterpreterPushArgsMode::kArrayFunction:
// There is no special-case handling of calls to Array. They will all go
// through the kOther case below.
UNREACHABLE();
case InterpreterPushArgsMode::kWithFinalSpread:
return builtin_handle(kInterpreterPushArgsThenCallWithFinalSpread);
case InterpreterPushArgsMode::kOther:
......@@ -40,8 +35,8 @@ Handle<Code> Builtins::InterpreterPushArgsThenCall(
Handle<Code> Builtins::InterpreterPushArgsThenConstruct(
InterpreterPushArgsMode mode) {
switch (mode) {
case InterpreterPushArgsMode::kJSFunction:
return builtin_handle(kInterpreterPushArgsThenConstructFunction);
case InterpreterPushArgsMode::kArrayFunction:
return builtin_handle(kInterpreterPushArgsThenConstructArrayFunction);
case InterpreterPushArgsMode::kWithFinalSpread:
return builtin_handle(kInterpreterPushArgsThenConstructWithFinalSpread);
case InterpreterPushArgsMode::kOther:
......
......@@ -1050,10 +1050,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
// Call the target.
__ Push(edx); // Re-push return address.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// This should be unreachable.
__ int3();
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1198,7 +1197,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ AssertUndefinedOrAllocationSite(ebx);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
__ AssertFunction(edi);
......
......@@ -1103,10 +1103,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
}
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Unreachable code.
__ break_(0xCC);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1150,7 +1149,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ AssertUndefinedOrAllocationSite(a2, t0);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(a1);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -1100,10 +1100,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
}
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Unreachable code.
__ break_(0xCC);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1147,7 +1146,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ AssertUndefinedOrAllocationSite(a2, t0);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(a1);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -1130,10 +1130,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
}
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Unreachable Code.
__ bkpt(0);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1180,7 +1179,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
} else {
__ AssertUndefinedOrAllocationSite(r5, r8);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(r4);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -1130,10 +1130,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
}
// Call the target.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(
masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Unreachable Code.
__ bkpt(0);
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1180,7 +1179,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
} else {
__ AssertUndefinedOrAllocationSite(r4, r7);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
__ AssertFunction(r3);
// Tail call to the function-specific construct stub (still in the caller
......
......@@ -1112,9 +1112,9 @@ void Builtins::Generate_InterpreterPushArgsThenCallImpl(
// Call the target.
__ PushReturnAddressFrom(kScratchRegister); // Re-push return address.
if (mode == InterpreterPushArgsMode::kJSFunction) {
__ Jump(masm->isolate()->builtins()->CallFunction(receiver_mode),
RelocInfo::CODE_TARGET);
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// This should be unreachable.
__ int3();
} else if (mode == InterpreterPushArgsMode::kWithFinalSpread) {
__ Jump(BUILTIN_CODE(masm->isolate(), CallWithSpread),
RelocInfo::CODE_TARGET);
......@@ -1170,7 +1170,7 @@ void Builtins::Generate_InterpreterPushArgsThenConstructImpl(
__ AssertUndefinedOrAllocationSite(rbx);
}
if (mode == InterpreterPushArgsMode::kJSFunction) {
if (mode == InterpreterPushArgsMode::kArrayFunction) {
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
__ AssertFunction(rdi);
......
......@@ -1201,7 +1201,7 @@ inline std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
}
enum class InterpreterPushArgsMode : unsigned {
kJSFunction,
kArrayFunction,
kWithFinalSpread,
kOther
};
......@@ -1213,8 +1213,8 @@ inline size_t hash_value(InterpreterPushArgsMode mode) {
inline std::ostream& operator<<(std::ostream& os,
InterpreterPushArgsMode mode) {
switch (mode) {
case InterpreterPushArgsMode::kJSFunction:
return os << "JSFunction";
case InterpreterPushArgsMode::kArrayFunction:
return os << "ArrayFunction";
case InterpreterPushArgsMode::kWithFinalSpread:
return os << "WithFinalSpread";
case InterpreterPushArgsMode::kOther:
......
......@@ -1085,7 +1085,7 @@ Node* InterpreterAssembler::Construct(Node* target, Node* context,
// constructor feedback collection inside of Ignition.
Comment("call using ConstructArray builtin");
Callable callable = CodeFactory::InterpreterPushArgsThenConstruct(
isolate(), InterpreterPushArgsMode::kJSFunction);
isolate(), InterpreterPushArgsMode::kArrayFunction);
Node* code_target = HeapConstant(callable.code());
var_result.Bind(CallStub(callable.descriptor(), code_target, context,
args.reg_count(), new_target, target,
......
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