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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 __ sub(edi, Immediate(kPointerSize)); | 2432 __ sub(edi, Immediate(kPointerSize)); |
2433 __ cmp(eax, ebx); | 2433 __ cmp(eax, ebx); |
2434 __ j(less, ©); | 2434 __ j(less, ©); |
2435 // eax now contains the expected number of arguments. | 2435 // eax now contains the expected number of arguments. |
2436 __ jmp(&invoke); | 2436 __ jmp(&invoke); |
2437 } | 2437 } |
2438 | 2438 |
2439 { // Too few parameters: Actual < expected. | 2439 { // Too few parameters: Actual < expected. |
2440 __ bind(&too_few); | 2440 __ bind(&too_few); |
2441 | 2441 |
2442 // If the function is strong we need to throw an error. | |
2443 Label no_strong_error; | |
2444 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | |
2445 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), | |
2446 1 << SharedFunctionInfo::kStrongModeBitWithinByte); | |
2447 __ j(equal, &no_strong_error, Label::kNear); | |
2448 | |
2449 // What we really care about is the required number of arguments. | |
2450 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset)); | |
2451 __ SmiUntag(ecx); | |
2452 __ cmp(eax, ecx); | |
2453 __ j(greater_equal, &no_strong_error, Label::kNear); | |
2454 | |
2455 { | |
2456 FrameScope frame(masm, StackFrame::MANUAL); | |
2457 EnterArgumentsAdaptorFrame(masm); | |
2458 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
2459 } | |
2460 | |
2461 __ bind(&no_strong_error); | |
2462 EnterArgumentsAdaptorFrame(masm); | 2442 EnterArgumentsAdaptorFrame(masm); |
2463 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 2443 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
2464 | 2444 |
2465 // Remember expected arguments in ecx. | 2445 // Remember expected arguments in ecx. |
2466 __ mov(ecx, ebx); | 2446 __ mov(ecx, ebx); |
2467 | 2447 |
2468 // Copy receiver and all actual arguments. | 2448 // Copy receiver and all actual arguments. |
2469 const int offset = StandardFrameConstants::kCallerSPOffset; | 2449 const int offset = StandardFrameConstants::kCallerSPOffset; |
2470 __ lea(edi, Operand(ebp, eax, times_4, offset)); | 2450 __ lea(edi, Operand(ebp, eax, times_4, offset)); |
2471 // ebx = expected - actual. | 2451 // ebx = expected - actual. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 | 2668 |
2689 __ bind(&ok); | 2669 __ bind(&ok); |
2690 __ ret(0); | 2670 __ ret(0); |
2691 } | 2671 } |
2692 | 2672 |
2693 #undef __ | 2673 #undef __ |
2694 } // namespace internal | 2674 } // namespace internal |
2695 } // namespace v8 | 2675 } // namespace v8 |
2696 | 2676 |
2697 #endif // V8_TARGET_ARCH_X87 | 2677 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |