Commit d652a5db authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/s390: Remove ClassConstructor check from CallFunction

Port 99a5bb74

Original Commit Message:

    CallFunction is only called for targets that are checked not to be class
    constructors, therefore we can remove the check for class constructors
    from CallFunction.

R=pthier@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: I327c075bdd2e561236820818c2a26e8fc4ed6522
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3421506Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78839}
parent 4b8f1b1c
...@@ -2076,12 +2076,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2076,12 +2076,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// ----------------------------------- // -----------------------------------
__ AssertCallableFunction(r4); __ AssertCallableFunction(r4);
Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset), r0); r5, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset), r0);
__ lwz(r6, FieldMemOperand(r5, SharedFunctionInfo::kFlagsOffset));
__ TestBitMask(r6, SharedFunctionInfo::IsClassConstructorBit::kMask, r0);
__ bne(&class_constructor, cr0);
// Enter the context of the function; ToObject has to run in the function // Enter the context of the function; ToObject has to run in the function
// context, and we also need to take the global proxy from the function // context, and we also need to take the global proxy from the function
...@@ -2159,15 +2155,6 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2159,15 +2155,6 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ LoadU16( __ LoadU16(
r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset));
__ InvokeFunctionCode(r4, no_reg, r5, r3, InvokeType::kJump); __ InvokeFunctionCode(r4, no_reg, r5, r3, InvokeType::kJump);
// The function is a "classConstructor", need to raise an exception.
__ bind(&class_constructor);
{
FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL);
__ push(r4);
__ CallRuntime(Runtime::kThrowConstructorNonCallableError);
__ Trap(); // Unreachable.
}
} }
namespace { namespace {
......
...@@ -2508,12 +2508,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2508,12 +2508,8 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// ----------------------------------- // -----------------------------------
__ AssertCallableFunction(r3); __ AssertCallableFunction(r3);
Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
r4, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); r4, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadU32(r5, FieldMemOperand(r4, SharedFunctionInfo::kFlagsOffset));
__ TestBitMask(r5, SharedFunctionInfo::IsClassConstructorBit::kMask, r0);
__ bne(&class_constructor);
// Enter the context of the function; ToObject has to run in the function // Enter the context of the function; ToObject has to run in the function
// context, and we also need to take the global proxy from the function // context, and we also need to take the global proxy from the function
...@@ -2591,15 +2587,6 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2591,15 +2587,6 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ LoadU16( __ LoadU16(
r4, FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset)); r4, FieldMemOperand(r4, SharedFunctionInfo::kFormalParameterCountOffset));
__ InvokeFunctionCode(r3, no_reg, r4, r2, InvokeType::kJump); __ InvokeFunctionCode(r3, no_reg, r4, r2, InvokeType::kJump);
// The function is a "classConstructor", need to raise an exception.
__ bind(&class_constructor);
{
FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL);
__ push(r3);
__ CallRuntime(Runtime::kThrowConstructorNonCallableError);
__ Trap(); // Unreachable.
}
} }
namespace { namespace {
......
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