| 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 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3158 | 3158 |
| 3159 __ bind(&done); | 3159 __ bind(&done); |
| 3160 } | 3160 } |
| 3161 | 3161 |
| 3162 | 3162 |
| 3163 void CallFunctionStub::Generate(MacroAssembler* masm) { | 3163 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 3164 // r1 : the function to call | 3164 // r1 : the function to call |
| 3165 // r2 : cache cell for call target | 3165 // r2 : cache cell for call target |
| 3166 Label slow, non_function; | 3166 Label slow, non_function; |
| 3167 | 3167 |
| 3168 // Check that the function is really a JavaScript function. |
| 3169 // r1: pushed function (to be verified) |
| 3170 __ JumpIfSmi(r1, &non_function); |
| 3171 |
| 3168 // The receiver might implicitly be the global object. This is | 3172 // The receiver might implicitly be the global object. This is |
| 3169 // indicated by passing the hole as the receiver to the call | 3173 // indicated by passing the hole as the receiver to the call |
| 3170 // function stub. | 3174 // function stub. |
| 3171 if (ReceiverMightBeImplicit()) { | 3175 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) { |
| 3172 Label call; | 3176 Label call, patch_current_context; |
| 3173 // Get the receiver from the stack. | 3177 if (ReceiverMightBeImplicit()) { |
| 3174 // function, receiver [, arguments] | 3178 // Get the receiver from the stack. |
| 3175 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); | 3179 // function, receiver [, arguments] |
| 3176 // Call as function is indicated with the hole. | 3180 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); |
| 3177 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 3181 // Call as function is indicated with the hole. |
| 3178 __ b(ne, &call); | 3182 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
| 3183 __ b(ne, &call); |
| 3184 } |
| 3179 // Patch the receiver on the stack with the global receiver object. | 3185 // Patch the receiver on the stack with the global receiver object. |
| 3186 // Goto slow case if we do not have a function. |
| 3187 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
| 3188 __ b(ne, &patch_current_context); |
| 3189 CallStubCompiler::FetchGlobalProxy(masm, r3, r1); |
| 3190 __ str(r3, MemOperand(sp, argc_ * kPointerSize)); |
| 3191 __ jmp(&call); |
| 3192 __ bind(&patch_current_context); |
| 3180 __ ldr(r3, | 3193 __ ldr(r3, |
| 3181 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 3194 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 3182 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalReceiverOffset)); | 3195 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalReceiverOffset)); |
| 3183 __ str(r3, MemOperand(sp, argc_ * kPointerSize)); | 3196 __ str(r3, MemOperand(sp, argc_ * kPointerSize)); |
| 3197 __ jmp(&slow); |
| 3184 __ bind(&call); | 3198 __ bind(&call); |
| 3199 } else { |
| 3200 // Get the map of the function object. |
| 3201 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
| 3202 __ b(ne, &slow); |
| 3185 } | 3203 } |
| 3186 | 3204 |
| 3187 // Check that the function is really a JavaScript function. | |
| 3188 // r1: pushed function (to be verified) | |
| 3189 __ JumpIfSmi(r1, &non_function); | |
| 3190 // Get the map of the function object. | |
| 3191 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); | |
| 3192 __ b(ne, &slow); | |
| 3193 | |
| 3194 if (RecordCallTarget()) { | 3205 if (RecordCallTarget()) { |
| 3195 GenerateRecordCallTarget(masm); | 3206 GenerateRecordCallTarget(masm); |
| 3196 } | 3207 } |
| 3197 | 3208 |
| 3198 // Fast-case: Invoke the function now. | 3209 // Fast-case: Invoke the function now. |
| 3199 // r1: pushed function | 3210 // r1: pushed function |
| 3200 ParameterCount actual(argc_); | 3211 ParameterCount actual(argc_); |
| 3201 | 3212 |
| 3202 if (ReceiverMightBeImplicit()) { | 3213 if (ReceiverMightBeImplicit()) { |
| 3203 Label call_as_function; | 3214 Label call_as_function; |
| (...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5805 __ bind(&fast_elements_case); | 5816 __ bind(&fast_elements_case); |
| 5806 GenerateCase(masm, FAST_ELEMENTS); | 5817 GenerateCase(masm, FAST_ELEMENTS); |
| 5807 } | 5818 } |
| 5808 | 5819 |
| 5809 | 5820 |
| 5810 #undef __ | 5821 #undef __ |
| 5811 | 5822 |
| 5812 } } // namespace v8::internal | 5823 } } // namespace v8::internal |
| 5813 | 5824 |
| 5814 #endif // V8_TARGET_ARCH_ARM | 5825 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |