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