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 5151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 // function stub. | 5162 // function stub. |
5163 if (ReceiverMightBeImplicit()) { | 5163 if (ReceiverMightBeImplicit()) { |
5164 Label call; | 5164 Label call; |
5165 // Get the receiver from the stack. | 5165 // Get the receiver from the stack. |
5166 // function, receiver [, arguments] | 5166 // function, receiver [, arguments] |
5167 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); | 5167 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); |
5168 // Call as function is indicated with the hole. | 5168 // Call as function is indicated with the hole. |
5169 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 5169 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
5170 __ b(ne, &call); | 5170 __ b(ne, &call); |
5171 // Patch the receiver on the stack with the global receiver object. | 5171 // Patch the receiver on the stack with the global receiver object. |
5172 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 5172 __ ldr(r3, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
5173 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 5173 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalReceiverOffset)); |
5174 __ str(r2, MemOperand(sp, argc_ * kPointerSize)); | 5174 __ str(r3, MemOperand(sp, argc_ * kPointerSize)); |
5175 __ bind(&call); | 5175 __ bind(&call); |
5176 } | 5176 } |
5177 | 5177 |
5178 // Check that the function is really a JavaScript function. | 5178 // Check that the function is really a JavaScript function. |
5179 // r1: pushed function (to be verified) | 5179 // r1: pushed function (to be verified) |
5180 __ JumpIfSmi(r1, &non_function); | 5180 __ JumpIfSmi(r1, &non_function); |
5181 // Get the map of the function object. | 5181 // Get the map of the function object. |
5182 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 5182 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
5183 __ b(ne, &slow); | 5183 __ b(ne, &slow); |
5184 | 5184 |
| 5185 if (RecordCallTarget()) { |
| 5186 GenerateRecordCallTarget(masm); |
| 5187 } |
| 5188 |
5185 // Fast-case: Invoke the function now. | 5189 // Fast-case: Invoke the function now. |
5186 // r1: pushed function | 5190 // r1: pushed function |
5187 ParameterCount actual(argc_); | 5191 ParameterCount actual(argc_); |
5188 | 5192 |
5189 if (ReceiverMightBeImplicit()) { | 5193 if (ReceiverMightBeImplicit()) { |
5190 Label call_as_function; | 5194 Label call_as_function; |
5191 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 5195 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
5192 __ b(eq, &call_as_function); | 5196 __ b(eq, &call_as_function); |
5193 __ InvokeFunction(r1, | 5197 __ InvokeFunction(r1, |
5194 actual, | 5198 actual, |
5195 JUMP_FUNCTION, | 5199 JUMP_FUNCTION, |
5196 NullCallWrapper(), | 5200 NullCallWrapper(), |
5197 CALL_AS_METHOD); | 5201 CALL_AS_METHOD); |
5198 __ bind(&call_as_function); | 5202 __ bind(&call_as_function); |
5199 } | 5203 } |
5200 __ InvokeFunction(r1, | 5204 __ InvokeFunction(r1, |
5201 actual, | 5205 actual, |
5202 JUMP_FUNCTION, | 5206 JUMP_FUNCTION, |
5203 NullCallWrapper(), | 5207 NullCallWrapper(), |
5204 CALL_AS_FUNCTION); | 5208 CALL_AS_FUNCTION); |
5205 | 5209 |
5206 // Slow-case: Non-function called. | 5210 // Slow-case: Non-function called. |
5207 __ bind(&slow); | 5211 __ bind(&slow); |
| 5212 if (RecordCallTarget()) { |
| 5213 // If there is a call target cache, mark it megamorphic in the |
| 5214 // non-function case. MegamorphicSentinel is an immortal immovable |
| 5215 // object (undefined) so no write barrier is needed. |
| 5216 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 5217 masm->isolate()->heap()->undefined_value()); |
| 5218 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 5219 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); |
| 5220 } |
5208 // Check for function proxy. | 5221 // Check for function proxy. |
5209 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE)); | 5222 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); |
5210 __ b(ne, &non_function); | 5223 __ b(ne, &non_function); |
5211 __ push(r1); // put proxy as additional argument | 5224 __ push(r1); // put proxy as additional argument |
5212 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE)); | 5225 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE)); |
5213 __ mov(r2, Operand(0, RelocInfo::NONE)); | 5226 __ mov(r2, Operand(0, RelocInfo::NONE)); |
5214 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 5227 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
5215 __ SetCallKind(r5, CALL_AS_METHOD); | 5228 __ SetCallKind(r5, CALL_AS_METHOD); |
5216 { | 5229 { |
5217 Handle<Code> adaptor = | 5230 Handle<Code> adaptor = |
5218 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 5231 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
5219 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 5232 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7385 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, | 7398 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, |
7386 &slow_elements); | 7399 &slow_elements); |
7387 __ Ret(); | 7400 __ Ret(); |
7388 } | 7401 } |
7389 | 7402 |
7390 #undef __ | 7403 #undef __ |
7391 | 7404 |
7392 } } // namespace v8::internal | 7405 } } // namespace v8::internal |
7393 | 7406 |
7394 #endif // V8_TARGET_ARCH_ARM | 7407 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |