Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: src/ia32/builtins-ia32.cc

Issue 1133933003: [strong] Function arity check should be based on required parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added dchecks and cleaned up assembly based on feedback Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 6b39f6442df40828f3ad0bc81cb763672f1586fb..e26728a1a664df74c51f7a8e2e613ca5ae391ada 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -1579,11 +1579,17 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ bind(&too_few);
// If the function is strong we need to throw an error.
- Label weak_function;
+ Label no_strong_error;
__ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset),
1 << SharedFunctionInfo::kStrongModeBitWithinByte);
- __ j(equal, &weak_function, Label::kNear);
+ __ j(equal, &no_strong_error, Label::kNear);
+
+ // What we really care about is the required number of arguments.
+ __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset));
+ __ SmiUntag(ecx);
+ __ cmp(eax, ecx);
+ __ j(greater_equal, &no_strong_error, Label::kNear);
{
FrameScope frame(masm, StackFrame::MANUAL);
@@ -1591,7 +1597,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0);
}
- __ bind(&weak_function);
+ __ bind(&no_strong_error);
EnterArgumentsAdaptorFrame(masm);
// Copy receiver and all actual arguments.

Powered by Google App Engine
This is Rietveld 408576698