| 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 __ InvokeFunction(optimization.constant_function(), arguments_, | 638 Handle<JSFunction> fun = optimization.constant_function(); |
| 639 __ InvokeFunction(fun, ParameterCount(fun), arguments_, |
| 639 JUMP_FUNCTION, NullCallWrapper(), call_kind); | 640 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
| 640 } | 641 } |
| 641 | 642 |
| 642 // Deferred code for fast API call case---clean preallocated space. | 643 // Deferred code for fast API call case---clean preallocated space. |
| 643 if (can_do_fast_api_call) { | 644 if (can_do_fast_api_call) { |
| 644 __ bind(&miss_cleanup); | 645 __ bind(&miss_cleanup); |
| 645 FreeSpaceForFastApiCall(masm, scratch1); | 646 FreeSpaceForFastApiCall(masm, scratch1); |
| 646 __ jmp(miss_label); | 647 __ jmp(miss_label); |
| 647 } | 648 } |
| 648 | 649 |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 | 2050 |
| 2050 StubRuntimeCallHelper call_helper; | 2051 StubRuntimeCallHelper call_helper; |
| 2051 generator.GenerateSlow(masm(), call_helper); | 2052 generator.GenerateSlow(masm(), call_helper); |
| 2052 | 2053 |
| 2053 // Tail call the full function. We do not have to patch the receiver | 2054 // Tail call the full function. We do not have to patch the receiver |
| 2054 // because the function makes no use of it. | 2055 // because the function makes no use of it. |
| 2055 __ bind(&slow); | 2056 __ bind(&slow); |
| 2056 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2057 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
| 2057 ? CALL_AS_FUNCTION | 2058 ? CALL_AS_FUNCTION |
| 2058 : CALL_AS_METHOD; | 2059 : CALL_AS_METHOD; |
| 2059 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 2060 __ InvokeFunction(function, ParameterCount(function), arguments(), |
| 2060 NullCallWrapper(), call_kind); | 2061 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
| 2061 | 2062 |
| 2062 __ bind(&miss); | 2063 __ bind(&miss); |
| 2063 // ecx: function name. | 2064 // ecx: function name. |
| 2064 GenerateMissBranch(); | 2065 GenerateMissBranch(); |
| 2065 | 2066 |
| 2066 // Return the generated code. | 2067 // Return the generated code. |
| 2067 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2068 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2068 } | 2069 } |
| 2069 | 2070 |
| 2070 | 2071 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 __ ret(2 * kPointerSize); | 2180 __ ret(2 * kPointerSize); |
| 2180 | 2181 |
| 2181 // Return the argument (when it's an already round heap number). | 2182 // Return the argument (when it's an already round heap number). |
| 2182 __ bind(&already_round); | 2183 __ bind(&already_round); |
| 2183 __ mov(eax, Operand(esp, 1 * kPointerSize)); | 2184 __ mov(eax, Operand(esp, 1 * kPointerSize)); |
| 2184 __ ret(2 * kPointerSize); | 2185 __ ret(2 * kPointerSize); |
| 2185 | 2186 |
| 2186 // Tail call the full function. We do not have to patch the receiver | 2187 // Tail call the full function. We do not have to patch the receiver |
| 2187 // because the function makes no use of it. | 2188 // because the function makes no use of it. |
| 2188 __ bind(&slow); | 2189 __ bind(&slow); |
| 2189 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 2190 __ InvokeFunction(function, ParameterCount(function), arguments(), |
| 2190 NullCallWrapper(), CALL_AS_METHOD); | 2191 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 2191 | 2192 |
| 2192 __ bind(&miss); | 2193 __ bind(&miss); |
| 2193 // ecx: function name. | 2194 // ecx: function name. |
| 2194 GenerateMissBranch(); | 2195 GenerateMissBranch(); |
| 2195 | 2196 |
| 2196 // Return the generated code. | 2197 // Return the generated code. |
| 2197 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2198 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2198 } | 2199 } |
| 2199 | 2200 |
| 2200 | 2201 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 __ and_(ebx, ~HeapNumber::kSignMask); | 2285 __ and_(ebx, ~HeapNumber::kSignMask); |
| 2285 __ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset)); | 2286 __ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset)); |
| 2286 __ AllocateHeapNumber(eax, edi, edx, &slow); | 2287 __ AllocateHeapNumber(eax, edi, edx, &slow); |
| 2287 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx); | 2288 __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx); |
| 2288 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); | 2289 __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); |
| 2289 __ ret(2 * kPointerSize); | 2290 __ ret(2 * kPointerSize); |
| 2290 | 2291 |
| 2291 // Tail call the full function. We do not have to patch the receiver | 2292 // Tail call the full function. We do not have to patch the receiver |
| 2292 // because the function makes no use of it. | 2293 // because the function makes no use of it. |
| 2293 __ bind(&slow); | 2294 __ bind(&slow); |
| 2294 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 2295 __ InvokeFunction(function, ParameterCount(function), arguments(), |
| 2295 NullCallWrapper(), CALL_AS_METHOD); | 2296 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 2296 | 2297 |
| 2297 __ bind(&miss); | 2298 __ bind(&miss); |
| 2298 // ecx: function name. | 2299 // ecx: function name. |
| 2299 GenerateMissBranch(); | 2300 GenerateMissBranch(); |
| 2300 | 2301 |
| 2301 // Return the generated code. | 2302 // Return the generated code. |
| 2302 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2303 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
| 2303 } | 2304 } |
| 2304 | 2305 |
| 2305 | 2306 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 // Handle call cache miss. | 2468 // Handle call cache miss. |
| 2468 __ bind(&miss); | 2469 __ bind(&miss); |
| 2469 GenerateMissBranch(); | 2470 GenerateMissBranch(); |
| 2470 } | 2471 } |
| 2471 | 2472 |
| 2472 | 2473 |
| 2473 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { | 2474 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { |
| 2474 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2475 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
| 2475 ? CALL_AS_FUNCTION | 2476 ? CALL_AS_FUNCTION |
| 2476 : CALL_AS_METHOD; | 2477 : CALL_AS_METHOD; |
| 2477 __ InvokeFunction(function, arguments(), JUMP_FUNCTION, | 2478 __ InvokeFunction(function, ParameterCount(function), arguments(), |
| 2478 NullCallWrapper(), call_kind); | 2479 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
| 2479 } | 2480 } |
| 2480 | 2481 |
| 2481 | 2482 |
| 2482 Handle<Code> CallStubCompiler::CompileCallConstant( | 2483 Handle<Code> CallStubCompiler::CompileCallConstant( |
| 2483 Handle<Object> object, | 2484 Handle<Object> object, |
| 2484 Handle<JSObject> holder, | 2485 Handle<JSObject> holder, |
| 2485 Handle<Name> name, | 2486 Handle<Name> name, |
| 2486 CheckType check, | 2487 CheckType check, |
| 2487 Handle<JSFunction> function) { | 2488 Handle<JSFunction> function) { |
| 2488 | 2489 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 FrameScope scope(masm, StackFrame::INTERNAL); | 2681 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2681 | 2682 |
| 2682 // Save value register, so we can restore it later. | 2683 // Save value register, so we can restore it later. |
| 2683 __ push(eax); | 2684 __ push(eax); |
| 2684 | 2685 |
| 2685 if (!setter.is_null()) { | 2686 if (!setter.is_null()) { |
| 2686 // Call the JavaScript setter with receiver and value on the stack. | 2687 // Call the JavaScript setter with receiver and value on the stack. |
| 2687 __ push(edx); | 2688 __ push(edx); |
| 2688 __ push(eax); | 2689 __ push(eax); |
| 2689 ParameterCount actual(1); | 2690 ParameterCount actual(1); |
| 2690 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2691 ParameterCount expected(setter); |
| 2691 CALL_AS_METHOD); | 2692 __ InvokeFunction(setter, expected, actual, |
| 2693 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 2692 } else { | 2694 } else { |
| 2693 // If we generate a global code snippet for deoptimization only, remember | 2695 // If we generate a global code snippet for deoptimization only, remember |
| 2694 // the place to continue after deoptimization. | 2696 // the place to continue after deoptimization. |
| 2695 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 2697 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
| 2696 } | 2698 } |
| 2697 | 2699 |
| 2698 // We have to return the passed value, not the return value of the setter. | 2700 // We have to return the passed value, not the return value of the setter. |
| 2699 __ pop(eax); | 2701 __ pop(eax); |
| 2700 | 2702 |
| 2701 // Restore context register. | 2703 // Restore context register. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2893 // -- edx : receiver | 2895 // -- edx : receiver |
| 2894 // -- esp[0] : return address | 2896 // -- esp[0] : return address |
| 2895 // ----------------------------------- | 2897 // ----------------------------------- |
| 2896 { | 2898 { |
| 2897 FrameScope scope(masm, StackFrame::INTERNAL); | 2899 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2898 | 2900 |
| 2899 if (!getter.is_null()) { | 2901 if (!getter.is_null()) { |
| 2900 // Call the JavaScript getter with the receiver on the stack. | 2902 // Call the JavaScript getter with the receiver on the stack. |
| 2901 __ push(edx); | 2903 __ push(edx); |
| 2902 ParameterCount actual(0); | 2904 ParameterCount actual(0); |
| 2903 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), | 2905 ParameterCount expected(getter); |
| 2904 CALL_AS_METHOD); | 2906 __ InvokeFunction(getter, expected, actual, |
| 2907 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 2905 } else { | 2908 } else { |
| 2906 // If we generate a global code snippet for deoptimization only, remember | 2909 // If we generate a global code snippet for deoptimization only, remember |
| 2907 // the place to continue after deoptimization. | 2910 // the place to continue after deoptimization. |
| 2908 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 2911 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
| 2909 } | 2912 } |
| 2910 | 2913 |
| 2911 // Restore context register. | 2914 // Restore context register. |
| 2912 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2915 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2913 } | 2916 } |
| 2914 __ ret(0); | 2917 __ ret(0); |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3690 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3693 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3691 } | 3694 } |
| 3692 } | 3695 } |
| 3693 | 3696 |
| 3694 | 3697 |
| 3695 #undef __ | 3698 #undef __ |
| 3696 | 3699 |
| 3697 } } // namespace v8::internal | 3700 } } // namespace v8::internal |
| 3698 | 3701 |
| 3699 #endif // V8_TARGET_ARCH_IA32 | 3702 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |