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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 __ sub(eax, Immediate(kPointerSize)); | 1572 __ sub(eax, Immediate(kPointerSize)); |
1573 __ cmp(edi, ebx); | 1573 __ cmp(edi, ebx); |
1574 __ j(less, ©); | 1574 __ j(less, ©); |
1575 __ jmp(&invoke); | 1575 __ jmp(&invoke); |
1576 } | 1576 } |
1577 | 1577 |
1578 { // Too few parameters: Actual < expected. | 1578 { // Too few parameters: Actual < expected. |
1579 __ bind(&too_few); | 1579 __ bind(&too_few); |
1580 | 1580 |
1581 // If the function is strong we need to throw an error. | 1581 // If the function is strong we need to throw an error. |
1582 Label weak_function; | 1582 Label no_strong_error; |
1583 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 1583 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
1584 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), | 1584 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), |
1585 1 << SharedFunctionInfo::kStrongModeBitWithinByte); | 1585 1 << SharedFunctionInfo::kStrongModeBitWithinByte); |
1586 __ j(equal, &weak_function, Label::kNear); | 1586 __ j(equal, &no_strong_error, Label::kNear); |
| 1587 |
| 1588 // What we really care about is the required number of arguments. |
| 1589 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset)); |
| 1590 __ SmiUntag(ecx); |
| 1591 __ cmp(eax, ecx); |
| 1592 __ j(greater_equal, &no_strong_error, Label::kNear); |
1587 | 1593 |
1588 { | 1594 { |
1589 FrameScope frame(masm, StackFrame::MANUAL); | 1595 FrameScope frame(masm, StackFrame::MANUAL); |
1590 EnterArgumentsAdaptorFrame(masm); | 1596 EnterArgumentsAdaptorFrame(masm); |
1591 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); | 1597 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
1592 } | 1598 } |
1593 | 1599 |
1594 __ bind(&weak_function); | 1600 __ bind(&no_strong_error); |
1595 EnterArgumentsAdaptorFrame(masm); | 1601 EnterArgumentsAdaptorFrame(masm); |
1596 | 1602 |
1597 // Copy receiver and all actual arguments. | 1603 // Copy receiver and all actual arguments. |
1598 const int offset = StandardFrameConstants::kCallerSPOffset; | 1604 const int offset = StandardFrameConstants::kCallerSPOffset; |
1599 __ lea(edi, Operand(ebp, eax, times_4, offset)); | 1605 __ lea(edi, Operand(ebp, eax, times_4, offset)); |
1600 // ebx = expected - actual. | 1606 // ebx = expected - actual. |
1601 __ sub(ebx, eax); | 1607 __ sub(ebx, eax); |
1602 // eax = -actual - 1 | 1608 // eax = -actual - 1 |
1603 __ neg(eax); | 1609 __ neg(eax); |
1604 __ sub(eax, Immediate(1)); | 1610 __ sub(eax, Immediate(1)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 | 1708 |
1703 __ bind(&ok); | 1709 __ bind(&ok); |
1704 __ ret(0); | 1710 __ ret(0); |
1705 } | 1711 } |
1706 | 1712 |
1707 #undef __ | 1713 #undef __ |
1708 } | 1714 } |
1709 } // namespace v8::internal | 1715 } // namespace v8::internal |
1710 | 1716 |
1711 #endif // V8_TARGET_ARCH_X87 | 1717 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |