OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 __ push(Operand(edi, 0)); | 2405 __ push(Operand(edi, 0)); |
2406 __ sub(edi, Immediate(kPointerSize)); | 2406 __ sub(edi, Immediate(kPointerSize)); |
2407 __ cmp(eax, ebx); | 2407 __ cmp(eax, ebx); |
2408 __ j(less, ©); | 2408 __ j(less, ©); |
2409 // eax now contains the expected number of arguments. | 2409 // eax now contains the expected number of arguments. |
2410 __ jmp(&invoke); | 2410 __ jmp(&invoke); |
2411 } | 2411 } |
2412 | 2412 |
2413 { // Too few parameters: Actual < expected. | 2413 { // Too few parameters: Actual < expected. |
2414 __ bind(&too_few); | 2414 __ bind(&too_few); |
2415 | |
2416 // If the function is strong we need to throw an error. | |
2417 Label no_strong_error; | |
2418 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | |
2419 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), | |
2420 1 << SharedFunctionInfo::kStrongModeBitWithinByte); | |
2421 __ j(equal, &no_strong_error, Label::kNear); | |
2422 | |
2423 // What we really care about is the required number of arguments. | |
2424 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset)); | |
2425 __ SmiUntag(ecx); | |
2426 __ cmp(eax, ecx); | |
2427 __ j(greater_equal, &no_strong_error, Label::kNear); | |
2428 | |
2429 { | |
2430 FrameScope frame(masm, StackFrame::MANUAL); | |
2431 EnterArgumentsAdaptorFrame(masm); | |
2432 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
2433 } | |
2434 | |
2435 __ bind(&no_strong_error); | |
2436 EnterArgumentsAdaptorFrame(masm); | 2415 EnterArgumentsAdaptorFrame(masm); |
2437 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 2416 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
2438 | 2417 |
2439 // Remember expected arguments in ecx. | 2418 // Remember expected arguments in ecx. |
2440 __ mov(ecx, ebx); | 2419 __ mov(ecx, ebx); |
2441 | 2420 |
2442 // Copy receiver and all actual arguments. | 2421 // Copy receiver and all actual arguments. |
2443 const int offset = StandardFrameConstants::kCallerSPOffset; | 2422 const int offset = StandardFrameConstants::kCallerSPOffset; |
2444 __ lea(edi, Operand(ebp, eax, times_4, offset)); | 2423 __ lea(edi, Operand(ebp, eax, times_4, offset)); |
2445 // ebx = expected - actual. | 2424 // ebx = expected - actual. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2662 | 2641 |
2663 __ bind(&ok); | 2642 __ bind(&ok); |
2664 __ ret(0); | 2643 __ ret(0); |
2665 } | 2644 } |
2666 | 2645 |
2667 #undef __ | 2646 #undef __ |
2668 } // namespace internal | 2647 } // namespace internal |
2669 } // namespace v8 | 2648 } // namespace v8 |
2670 | 2649 |
2671 #endif // V8_TARGET_ARCH_IA32 | 2650 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |