OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 ASSERT(depth2 == kInvalidProtoDepth); | 628 ASSERT(depth2 == kInvalidProtoDepth); |
629 } | 629 } |
630 | 630 |
631 // Invoke function. | 631 // Invoke function. |
632 if (can_do_fast_api_call) { | 632 if (can_do_fast_api_call) { |
633 GenerateFastApiCall(masm, optimization, arguments_.immediate()); | 633 GenerateFastApiCall(masm, optimization, arguments_.immediate()); |
634 } else { | 634 } else { |
635 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 635 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
636 ? CALL_AS_FUNCTION | 636 ? CALL_AS_FUNCTION |
637 : CALL_AS_METHOD; | 637 : CALL_AS_METHOD; |
638 Handle<JSFunction> fun = optimization.constant_function(); | 638 Handle<JSFunction> function = optimization.constant_function(); |
639 __ InvokeFunction(fun, ParameterCount(fun), arguments_, | 639 ParameterCount expected(function); |
| 640 __ InvokeFunction(function, expected, arguments_, |
640 JUMP_FUNCTION, NullCallWrapper(), call_kind); | 641 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
641 } | 642 } |
642 | 643 |
643 // Deferred code for fast API call case---clean preallocated space. | 644 // Deferred code for fast API call case---clean preallocated space. |
644 if (can_do_fast_api_call) { | 645 if (can_do_fast_api_call) { |
645 __ bind(&miss_cleanup); | 646 __ bind(&miss_cleanup); |
646 FreeSpaceForFastApiCall(masm, scratch1); | 647 FreeSpaceForFastApiCall(masm, scratch1); |
647 __ jmp(miss_label); | 648 __ jmp(miss_label); |
648 } | 649 } |
649 | 650 |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 | 2051 |
2051 StubRuntimeCallHelper call_helper; | 2052 StubRuntimeCallHelper call_helper; |
2052 generator.GenerateSlow(masm(), call_helper); | 2053 generator.GenerateSlow(masm(), call_helper); |
2053 | 2054 |
2054 // Tail call the full function. We do not have to patch the receiver | 2055 // Tail call the full function. We do not have to patch the receiver |
2055 // because the function makes no use of it. | 2056 // because the function makes no use of it. |
2056 __ bind(&slow); | 2057 __ bind(&slow); |
2057 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2058 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
2058 ? CALL_AS_FUNCTION | 2059 ? CALL_AS_FUNCTION |
2059 : CALL_AS_METHOD; | 2060 : CALL_AS_METHOD; |
2060 __ InvokeFunction(function, ParameterCount(function), arguments(), | 2061 ParameterCount expected(function); |
| 2062 __ InvokeFunction(function, expected, arguments(), |
2061 JUMP_FUNCTION, NullCallWrapper(), call_kind); | 2063 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
2062 | 2064 |
2063 __ bind(&miss); | 2065 __ bind(&miss); |
2064 // ecx: function name. | 2066 // ecx: function name. |
2065 GenerateMissBranch(); | 2067 GenerateMissBranch(); |
2066 | 2068 |
2067 // Return the generated code. | 2069 // Return the generated code. |
2068 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2070 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2069 } | 2071 } |
2070 | 2072 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 __ ret(2 * kPointerSize); | 2182 __ ret(2 * kPointerSize); |
2181 | 2183 |
2182 // Return the argument (when it's an already round heap number). | 2184 // Return the argument (when it's an already round heap number). |
2183 __ bind(&already_round); | 2185 __ bind(&already_round); |
2184 __ mov(eax, Operand(esp, 1 * kPointerSize)); | 2186 __ mov(eax, Operand(esp, 1 * kPointerSize)); |
2185 __ ret(2 * kPointerSize); | 2187 __ ret(2 * kPointerSize); |
2186 | 2188 |
2187 // Tail call the full function. We do not have to patch the receiver | 2189 // Tail call the full function. We do not have to patch the receiver |
2188 // because the function makes no use of it. | 2190 // because the function makes no use of it. |
2189 __ bind(&slow); | 2191 __ bind(&slow); |
2190 __ InvokeFunction(function, ParameterCount(function), arguments(), | 2192 ParameterCount expected(function); |
| 2193 __ InvokeFunction(function, expected, arguments(), |
2191 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2194 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2192 | 2195 |
2193 __ bind(&miss); | 2196 __ bind(&miss); |
2194 // ecx: function name. | 2197 // ecx: function name. |
2195 GenerateMissBranch(); | 2198 GenerateMissBranch(); |
2196 | 2199 |
2197 // Return the generated code. | 2200 // Return the generated code. |
2198 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2201 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2199 } | 2202 } |
2200 | 2203 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 __ and_(ebx, ~HeapNumber::kSignMask); | 2288 __ and_(ebx, ~HeapNumber::kSignMask); |
2286 __ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset)); | 2289 __ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset)); |
2287 __ AllocateHeapNumber(eax, edi, edx, &slow); | 2290 __ AllocateHeapNumber(eax, edi, edx, &slow); |
2288 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx); | 2291 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx); |
2289 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); | 2292 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); |
2290 __ ret(2 * kPointerSize); | 2293 __ ret(2 * kPointerSize); |
2291 | 2294 |
2292 // Tail call the full function. We do not have to patch the receiver | 2295 // Tail call the full function. We do not have to patch the receiver |
2293 // because the function makes no use of it. | 2296 // because the function makes no use of it. |
2294 __ bind(&slow); | 2297 __ bind(&slow); |
2295 __ InvokeFunction(function, ParameterCount(function), arguments(), | 2298 ParameterCount expected(function); |
| 2299 __ InvokeFunction(function, expected, arguments(), |
2296 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2300 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2297 | 2301 |
2298 __ bind(&miss); | 2302 __ bind(&miss); |
2299 // ecx: function name. | 2303 // ecx: function name. |
2300 GenerateMissBranch(); | 2304 GenerateMissBranch(); |
2301 | 2305 |
2302 // Return the generated code. | 2306 // Return the generated code. |
2303 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2307 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2304 } | 2308 } |
2305 | 2309 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 // Handle call cache miss. | 2472 // Handle call cache miss. |
2469 __ bind(&miss); | 2473 __ bind(&miss); |
2470 GenerateMissBranch(); | 2474 GenerateMissBranch(); |
2471 } | 2475 } |
2472 | 2476 |
2473 | 2477 |
2474 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { | 2478 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { |
2475 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2479 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
2476 ? CALL_AS_FUNCTION | 2480 ? CALL_AS_FUNCTION |
2477 : CALL_AS_METHOD; | 2481 : CALL_AS_METHOD; |
2478 __ InvokeFunction(function, ParameterCount(function), arguments(), | 2482 ParameterCount expected(function); |
| 2483 __ InvokeFunction(function, expected, arguments(), |
2479 JUMP_FUNCTION, NullCallWrapper(), call_kind); | 2484 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
2480 } | 2485 } |
2481 | 2486 |
2482 | 2487 |
2483 Handle<Code> CallStubCompiler::CompileCallConstant( | 2488 Handle<Code> CallStubCompiler::CompileCallConstant( |
2484 Handle<Object> object, | 2489 Handle<Object> object, |
2485 Handle<JSObject> holder, | 2490 Handle<JSObject> holder, |
2486 Handle<Name> name, | 2491 Handle<Name> name, |
2487 CheckType check, | 2492 CheckType check, |
2488 Handle<JSFunction> function) { | 2493 Handle<JSFunction> function) { |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3693 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3698 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3694 } | 3699 } |
3695 } | 3700 } |
3696 | 3701 |
3697 | 3702 |
3698 #undef __ | 3703 #undef __ |
3699 | 3704 |
3700 } } // namespace v8::internal | 3705 } } // namespace v8::internal |
3701 | 3706 |
3702 #endif // V8_TARGET_ARCH_IA32 | 3707 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |