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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 ASSERT(depth2 == kInvalidProtoDepth); | 947 ASSERT(depth2 == kInvalidProtoDepth); |
948 } | 948 } |
949 | 949 |
950 // Invoke function. | 950 // Invoke function. |
951 if (can_do_fast_api_call) { | 951 if (can_do_fast_api_call) { |
952 GenerateFastApiDirectCall(masm, optimization, arguments_.immediate()); | 952 GenerateFastApiDirectCall(masm, optimization, arguments_.immediate()); |
953 } else { | 953 } else { |
954 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) | 954 CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state_) |
955 ? CALL_AS_FUNCTION | 955 ? CALL_AS_FUNCTION |
956 : CALL_AS_METHOD; | 956 : CALL_AS_METHOD; |
957 __ InvokeFunction(optimization.constant_function(), arguments_, | 957 Handle<JSFunction> fun = optimization.constant_function(); |
| 958 __ InvokeFunction(fun, ParameterCount(fun), arguments_, |
958 JUMP_FUNCTION, NullCallWrapper(), call_kind); | 959 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
959 } | 960 } |
960 | 961 |
961 // Deferred code for fast API call case---clean preallocated space. | 962 // Deferred code for fast API call case---clean preallocated space. |
962 if (can_do_fast_api_call) { | 963 if (can_do_fast_api_call) { |
963 __ bind(&miss_cleanup); | 964 __ bind(&miss_cleanup); |
964 FreeSpaceForFastApiCall(masm); | 965 FreeSpaceForFastApiCall(masm); |
965 __ b(miss_label); | 966 __ b(miss_label); |
966 } | 967 } |
967 | 968 |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2078 generator.GenerateFast(masm()); | 2079 generator.GenerateFast(masm()); |
2079 __ Drop(argc + 1); | 2080 __ Drop(argc + 1); |
2080 __ Ret(); | 2081 __ Ret(); |
2081 | 2082 |
2082 StubRuntimeCallHelper call_helper; | 2083 StubRuntimeCallHelper call_helper; |
2083 generator.GenerateSlow(masm(), call_helper); | 2084 generator.GenerateSlow(masm(), call_helper); |
2084 | 2085 |
2085 // Tail call the full function. We do not have to patch the receiver | 2086 // Tail call the full function. We do not have to patch the receiver |
2086 // because the function makes no use of it. | 2087 // because the function makes no use of it. |
2087 __ bind(&slow); | 2088 __ bind(&slow); |
2088 __ InvokeFunction( | 2089 __ InvokeFunction(function, ParameterCount(function), arguments(), |
2089 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2090 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2090 | 2091 |
2091 __ bind(&miss); | 2092 __ bind(&miss); |
2092 // r2: function name. | 2093 // r2: function name. |
2093 GenerateMissBranch(); | 2094 GenerateMissBranch(); |
2094 | 2095 |
2095 // Return the generated code. | 2096 // Return the generated code. |
2096 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2097 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2097 } | 2098 } |
2098 | 2099 |
2099 | 2100 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 // Tag the result. | 2190 // Tag the result. |
2190 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | 2191 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
2191 | 2192 |
2192 __ bind(&just_return); | 2193 __ bind(&just_return); |
2193 __ Drop(argc + 1); | 2194 __ Drop(argc + 1); |
2194 __ Ret(); | 2195 __ Ret(); |
2195 | 2196 |
2196 __ bind(&slow); | 2197 __ bind(&slow); |
2197 // Tail call the full function. We do not have to patch the receiver | 2198 // Tail call the full function. We do not have to patch the receiver |
2198 // because the function makes no use of it. | 2199 // because the function makes no use of it. |
2199 __ InvokeFunction( | 2200 __ InvokeFunction(function, ParameterCount(function), arguments(), |
2200 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2201 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2201 | 2202 |
2202 __ bind(&miss); | 2203 __ bind(&miss); |
2203 // r2: function name. | 2204 // r2: function name. |
2204 GenerateMissBranch(); | 2205 GenerateMissBranch(); |
2205 | 2206 |
2206 // Return the generated code. | 2207 // Return the generated code. |
2207 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2208 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2208 } | 2209 } |
2209 | 2210 |
2210 | 2211 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | 2289 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); |
2289 __ AllocateHeapNumber(r0, r4, r5, r6, &slow); | 2290 __ AllocateHeapNumber(r0, r4, r5, r6, &slow); |
2290 __ str(r1, FieldMemOperand(r0, HeapNumber::kExponentOffset)); | 2291 __ str(r1, FieldMemOperand(r0, HeapNumber::kExponentOffset)); |
2291 __ str(r3, FieldMemOperand(r0, HeapNumber::kMantissaOffset)); | 2292 __ str(r3, FieldMemOperand(r0, HeapNumber::kMantissaOffset)); |
2292 __ Drop(argc + 1); | 2293 __ Drop(argc + 1); |
2293 __ Ret(); | 2294 __ Ret(); |
2294 | 2295 |
2295 // Tail call the full function. We do not have to patch the receiver | 2296 // Tail call the full function. We do not have to patch the receiver |
2296 // because the function makes no use of it. | 2297 // because the function makes no use of it. |
2297 __ bind(&slow); | 2298 __ bind(&slow); |
2298 __ InvokeFunction( | 2299 __ InvokeFunction(function, ParameterCount(function), arguments(), |
2299 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | 2300 JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2300 | 2301 |
2301 __ bind(&miss); | 2302 __ bind(&miss); |
2302 // r2: function name. | 2303 // r2: function name. |
2303 GenerateMissBranch(); | 2304 GenerateMissBranch(); |
2304 | 2305 |
2305 // Return the generated code. | 2306 // Return the generated code. |
2306 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); | 2307 return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name); |
2307 } | 2308 } |
2308 | 2309 |
2309 | 2310 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 // Handle call cache miss. | 2464 // Handle call cache miss. |
2464 __ bind(&miss); | 2465 __ bind(&miss); |
2465 GenerateMissBranch(); | 2466 GenerateMissBranch(); |
2466 } | 2467 } |
2467 | 2468 |
2468 | 2469 |
2469 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { | 2470 void CallStubCompiler::CompileHandlerBackend(Handle<JSFunction> function) { |
2470 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2471 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
2471 ? CALL_AS_FUNCTION | 2472 ? CALL_AS_FUNCTION |
2472 : CALL_AS_METHOD; | 2473 : CALL_AS_METHOD; |
2473 __ InvokeFunction( | 2474 __ InvokeFunction(function, ParameterCount(function), arguments(), |
2474 function, arguments(), JUMP_FUNCTION, NullCallWrapper(), call_kind); | 2475 JUMP_FUNCTION, NullCallWrapper(), call_kind); |
2475 } | 2476 } |
2476 | 2477 |
2477 | 2478 |
2478 Handle<Code> CallStubCompiler::CompileCallConstant( | 2479 Handle<Code> CallStubCompiler::CompileCallConstant( |
2479 Handle<Object> object, | 2480 Handle<Object> object, |
2480 Handle<JSObject> holder, | 2481 Handle<JSObject> holder, |
2481 Handle<Name> name, | 2482 Handle<Name> name, |
2482 CheckType check, | 2483 CheckType check, |
2483 Handle<JSFunction> function) { | 2484 Handle<JSFunction> function) { |
2484 if (HasCustomCallGenerator(function)) { | 2485 if (HasCustomCallGenerator(function)) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2646 { | 2647 { |
2647 FrameScope scope(masm, StackFrame::INTERNAL); | 2648 FrameScope scope(masm, StackFrame::INTERNAL); |
2648 | 2649 |
2649 // Save value register, so we can restore it later. | 2650 // Save value register, so we can restore it later. |
2650 __ push(r0); | 2651 __ push(r0); |
2651 | 2652 |
2652 if (!setter.is_null()) { | 2653 if (!setter.is_null()) { |
2653 // Call the JavaScript setter with receiver and value on the stack. | 2654 // Call the JavaScript setter with receiver and value on the stack. |
2654 __ Push(r1, r0); | 2655 __ Push(r1, r0); |
2655 ParameterCount actual(1); | 2656 ParameterCount actual(1); |
2656 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2657 ParameterCount expected(setter); |
2657 CALL_AS_METHOD); | 2658 __ InvokeFunction(setter, expected, actual, |
| 2659 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2658 } else { | 2660 } else { |
2659 // If we generate a global code snippet for deoptimization only, remember | 2661 // If we generate a global code snippet for deoptimization only, remember |
2660 // the place to continue after deoptimization. | 2662 // the place to continue after deoptimization. |
2661 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 2663 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
2662 } | 2664 } |
2663 | 2665 |
2664 // We have to return the passed value, not the return value of the setter. | 2666 // We have to return the passed value, not the return value of the setter. |
2665 __ pop(r0); | 2667 __ pop(r0); |
2666 | 2668 |
2667 // Restore context register. | 2669 // Restore context register. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 // -- r2 : name | 2833 // -- r2 : name |
2832 // -- lr : return address | 2834 // -- lr : return address |
2833 // ----------------------------------- | 2835 // ----------------------------------- |
2834 { | 2836 { |
2835 FrameScope scope(masm, StackFrame::INTERNAL); | 2837 FrameScope scope(masm, StackFrame::INTERNAL); |
2836 | 2838 |
2837 if (!getter.is_null()) { | 2839 if (!getter.is_null()) { |
2838 // Call the JavaScript getter with the receiver on the stack. | 2840 // Call the JavaScript getter with the receiver on the stack. |
2839 __ push(r0); | 2841 __ push(r0); |
2840 ParameterCount actual(0); | 2842 ParameterCount actual(0); |
2841 __ InvokeFunction(getter, actual, CALL_FUNCTION, NullCallWrapper(), | 2843 ParameterCount expected(getter); |
2842 CALL_AS_METHOD); | 2844 __ InvokeFunction(getter, expected, actual, |
| 2845 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
2843 } else { | 2846 } else { |
2844 // If we generate a global code snippet for deoptimization only, remember | 2847 // If we generate a global code snippet for deoptimization only, remember |
2845 // the place to continue after deoptimization. | 2848 // the place to continue after deoptimization. |
2846 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 2849 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
2847 } | 2850 } |
2848 | 2851 |
2849 // Restore context register. | 2852 // Restore context register. |
2850 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2853 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2851 } | 2854 } |
2852 __ Ret(); | 2855 __ Ret(); |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3684 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3687 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3685 } | 3688 } |
3686 } | 3689 } |
3687 | 3690 |
3688 | 3691 |
3689 #undef __ | 3692 #undef __ |
3690 | 3693 |
3691 } } // namespace v8::internal | 3694 } } // namespace v8::internal |
3692 | 3695 |
3693 #endif // V8_TARGET_ARCH_ARM | 3696 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |