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 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 __ sub(edi, Immediate(kPointerSize)); | 2391 __ sub(edi, Immediate(kPointerSize)); |
2392 __ cmp(eax, ebx); | 2392 __ cmp(eax, ebx); |
2393 __ j(less, ©); | 2393 __ j(less, ©); |
2394 // eax now contains the expected number of arguments. | 2394 // eax now contains the expected number of arguments. |
2395 __ jmp(&invoke); | 2395 __ jmp(&invoke); |
2396 } | 2396 } |
2397 | 2397 |
2398 { // Too few parameters: Actual < expected. | 2398 { // Too few parameters: Actual < expected. |
2399 __ bind(&too_few); | 2399 __ bind(&too_few); |
2400 | 2400 |
2401 // If the function is strong we need to throw an error. | |
2402 Label no_strong_error; | |
2403 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | |
2404 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), | |
2405 1 << SharedFunctionInfo::kStrongModeBitWithinByte); | |
2406 __ j(equal, &no_strong_error, Label::kNear); | |
2407 | |
2408 // What we really care about is the required number of arguments. | |
2409 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset)); | |
2410 __ SmiUntag(ecx); | |
2411 __ cmp(eax, ecx); | |
2412 __ j(greater_equal, &no_strong_error, Label::kNear); | |
2413 | |
2414 { | |
2415 FrameScope frame(masm, StackFrame::MANUAL); | |
2416 EnterArgumentsAdaptorFrame(masm); | |
2417 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
2418 } | |
2419 | |
2420 __ bind(&no_strong_error); | |
2421 EnterArgumentsAdaptorFrame(masm); | 2401 EnterArgumentsAdaptorFrame(masm); |
2422 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 2402 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
2423 | 2403 |
2424 // Remember expected arguments in ecx. | 2404 // Remember expected arguments in ecx. |
2425 __ mov(ecx, ebx); | 2405 __ mov(ecx, ebx); |
2426 | 2406 |
2427 // Copy receiver and all actual arguments. | 2407 // Copy receiver and all actual arguments. |
2428 const int offset = StandardFrameConstants::kCallerSPOffset; | 2408 const int offset = StandardFrameConstants::kCallerSPOffset; |
2429 __ lea(edi, Operand(ebp, eax, times_4, offset)); | 2409 __ lea(edi, Operand(ebp, eax, times_4, offset)); |
2430 // ebx = expected - actual. | 2410 // ebx = expected - actual. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 // And "return" to the OSR entry point of the function. | 2609 // And "return" to the OSR entry point of the function. |
2630 __ ret(0); | 2610 __ ret(0); |
2631 } | 2611 } |
2632 | 2612 |
2633 | 2613 |
2634 #undef __ | 2614 #undef __ |
2635 } // namespace internal | 2615 } // namespace internal |
2636 } // namespace v8 | 2616 } // namespace v8 |
2637 | 2617 |
2638 #endif // V8_TARGET_ARCH_X87 | 2618 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |