Commit f2aed960 authored by Patrick Thier's avatar Patrick Thier Committed by V8 LUCI CQ

Assert that a callable function is passed to CallFunction

Strengthen the assertion in CallFunction, that only callable functions
(not class constructors) are passed.

Change-Id: I2dc2d061cdc9930b5b8926285f021f9772e97570
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3380529Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78585}
parent 38117eba
...@@ -2283,7 +2283,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2283,7 +2283,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- r0 : the number of arguments // -- r0 : the number of arguments
// -- r1 : the function to call (checked to be a JSFunction) // -- r1 : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(r1); __ AssertCallableFunction(r1);
Label class_constructor; Label class_constructor;
__ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
......
...@@ -2654,7 +2654,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2654,7 +2654,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- x0 : the number of arguments // -- x0 : the number of arguments
// -- x1 : the function to call (checked to be a JSFunction) // -- x1 : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(x1); __ AssertCallableFunction(x1);
Label class_constructor; Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
......
...@@ -2447,7 +2447,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2447,7 +2447,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- edi : the function to call (checked to be a JSFunction) // -- edi : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
StackArgumentsAccessor args(eax); StackArgumentsAccessor args(eax);
__ AssertFunction(edi, edx); __ AssertCallableFunction(edi, edx);
Label class_constructor; Label class_constructor;
__ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
......
...@@ -2119,7 +2119,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2119,7 +2119,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- r3 : the number of arguments // -- r3 : the number of arguments
// -- r4 : the function to call (checked to be a JSFunction) // -- r4 : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(r4); __ AssertCallableFunction(r4);
Label class_constructor; Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
......
...@@ -2434,7 +2434,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2434,7 +2434,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- a0 : the number of arguments // -- a0 : the number of arguments
// -- a1 : the function to call (checked to be a JSFunction) // -- a1 : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(a1); __ AssertCallableFunction(a1);
Label class_constructor; Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
......
...@@ -2551,7 +2551,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2551,7 +2551,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// -- r2 : the number of arguments // -- r2 : the number of arguments
// -- r3 : the function to call (checked to be a JSFunction) // -- r3 : the function to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(r3); __ AssertCallableFunction(r3);
Label class_constructor; Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
......
...@@ -2372,7 +2372,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm, ...@@ -2372,7 +2372,7 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
// ----------------------------------- // -----------------------------------
StackArgumentsAccessor args(rax); StackArgumentsAccessor args(rax);
__ AssertFunction(rdi); __ AssertCallableFunction(rdi);
Label class_constructor; Label class_constructor;
__ LoadTaggedPointerField( __ LoadTaggedPointerField(
......
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