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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 __ push(Operand(edi, 0)); | 2364 __ push(Operand(edi, 0)); |
2365 __ sub(edi, Immediate(kPointerSize)); | 2365 __ sub(edi, Immediate(kPointerSize)); |
2366 __ cmp(eax, ebx); | 2366 __ cmp(eax, ebx); |
2367 __ j(less, ©); | 2367 __ j(less, ©); |
2368 // eax now contains the expected number of arguments. | 2368 // eax now contains the expected number of arguments. |
2369 __ jmp(&invoke); | 2369 __ jmp(&invoke); |
2370 } | 2370 } |
2371 | 2371 |
2372 { // Too few parameters: Actual < expected. | 2372 { // Too few parameters: Actual < expected. |
2373 __ bind(&too_few); | 2373 __ bind(&too_few); |
2374 | |
2375 // If the function is strong we need to throw an error. | |
2376 Label no_strong_error; | |
2377 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | |
2378 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset), | |
2379 1 << SharedFunctionInfo::kStrongModeBitWithinByte); | |
2380 __ j(equal, &no_strong_error, Label::kNear); | |
2381 | |
2382 // What we really care about is the required number of arguments. | |
2383 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset)); | |
2384 __ SmiUntag(ecx); | |
2385 __ cmp(eax, ecx); | |
2386 __ j(greater_equal, &no_strong_error, Label::kNear); | |
2387 | |
2388 { | |
2389 FrameScope frame(masm, StackFrame::MANUAL); | |
2390 EnterArgumentsAdaptorFrame(masm); | |
2391 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
2392 } | |
2393 | |
2394 __ bind(&no_strong_error); | |
2395 EnterArgumentsAdaptorFrame(masm); | 2374 EnterArgumentsAdaptorFrame(masm); |
2396 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 2375 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
2397 | 2376 |
2398 // Remember expected arguments in ecx. | 2377 // Remember expected arguments in ecx. |
2399 __ mov(ecx, ebx); | 2378 __ mov(ecx, ebx); |
2400 | 2379 |
2401 // Copy receiver and all actual arguments. | 2380 // Copy receiver and all actual arguments. |
2402 const int offset = StandardFrameConstants::kCallerSPOffset; | 2381 const int offset = StandardFrameConstants::kCallerSPOffset; |
2403 __ lea(edi, Operand(ebp, eax, times_4, offset)); | 2382 __ lea(edi, Operand(ebp, eax, times_4, offset)); |
2404 // ebx = expected - actual. | 2383 // ebx = expected - actual. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 // And "return" to the OSR entry point of the function. | 2582 // And "return" to the OSR entry point of the function. |
2604 __ ret(0); | 2583 __ ret(0); |
2605 } | 2584 } |
2606 | 2585 |
2607 | 2586 |
2608 #undef __ | 2587 #undef __ |
2609 } // namespace internal | 2588 } // namespace internal |
2610 } // namespace v8 | 2589 } // namespace v8 |
2611 | 2590 |
2612 #endif // V8_TARGET_ARCH_IA32 | 2591 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |