OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4901 } | 4901 } |
4902 | 4902 |
4903 | 4903 |
4904 Object* CallFunctionStub::GetCachedValue(Address address) { | 4904 Object* CallFunctionStub::GetCachedValue(Address address) { |
4905 UNREACHABLE(); | 4905 UNREACHABLE(); |
4906 return NULL; | 4906 return NULL; |
4907 } | 4907 } |
4908 | 4908 |
4909 | 4909 |
4910 void CallFunctionStub::Generate(MacroAssembler* masm) { | 4910 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 4911 // r1 : the function to call |
4911 Label slow, non_function; | 4912 Label slow, non_function; |
4912 | 4913 |
4913 // The receiver might implicitly be the global object. This is | 4914 // The receiver might implicitly be the global object. This is |
4914 // indicated by passing the hole as the receiver to the call | 4915 // indicated by passing the hole as the receiver to the call |
4915 // function stub. | 4916 // function stub. |
4916 if (ReceiverMightBeImplicit()) { | 4917 if (ReceiverMightBeImplicit()) { |
4917 Label call; | 4918 Label call; |
4918 // Get the receiver from the stack. | 4919 // Get the receiver from the stack. |
4919 // function, receiver [, arguments] | 4920 // function, receiver [, arguments] |
4920 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); | 4921 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); |
4921 // Call as function is indicated with the hole. | 4922 // Call as function is indicated with the hole. |
4922 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 4923 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
4923 __ b(ne, &call); | 4924 __ b(ne, &call); |
4924 // Patch the receiver on the stack with the global receiver object. | 4925 // Patch the receiver on the stack with the global receiver object. |
4925 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4926 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
4926 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 4927 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
4927 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); | 4928 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); |
4928 __ bind(&call); | 4929 __ bind(&call); |
4929 } | 4930 } |
4930 | 4931 |
4931 // Get the function to call from the stack. | |
4932 // function, receiver [, arguments] | |
4933 __ ldr(r1, MemOperand(sp, (argc_ + 1) * kPointerSize)); | |
4934 | |
4935 // Check that the function is really a JavaScript function. | 4932 // Check that the function is really a JavaScript function. |
4936 // r1: pushed function (to be verified) | 4933 // r1: pushed function (to be verified) |
4937 __ JumpIfSmi(r1, &non_function); | 4934 __ JumpIfSmi(r1, &non_function); |
4938 // Get the map of the function object. | 4935 // Get the map of the function object. |
4939 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 4936 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
4940 __ b(ne, &slow); | 4937 __ b(ne, &slow); |
4941 | 4938 |
4942 // Fast-case: Invoke the function now. | 4939 // Fast-case: Invoke the function now. |
4943 // r1: pushed function | 4940 // r1: pushed function |
4944 ParameterCount actual(argc_); | 4941 ParameterCount actual(argc_); |
(...skipping 17 matching lines...) Expand all Loading... |
4962 | 4959 |
4963 // Slow-case: Non-function called. | 4960 // Slow-case: Non-function called. |
4964 __ bind(&slow); | 4961 __ bind(&slow); |
4965 // Check for function proxy. | 4962 // Check for function proxy. |
4966 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE)); | 4963 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE)); |
4967 __ b(ne, &non_function); | 4964 __ b(ne, &non_function); |
4968 __ push(r1); // put proxy as additional argument | 4965 __ push(r1); // put proxy as additional argument |
4969 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE)); | 4966 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE)); |
4970 __ mov(r2, Operand(0, RelocInfo::NONE)); | 4967 __ mov(r2, Operand(0, RelocInfo::NONE)); |
4971 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 4968 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
4972 __ SetCallKind(r5, CALL_AS_FUNCTION); | 4969 __ SetCallKind(r5, CALL_AS_METHOD); |
4973 { | 4970 { |
4974 Handle<Code> adaptor = | 4971 Handle<Code> adaptor = |
4975 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 4972 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
4976 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 4973 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
4977 } | 4974 } |
4978 | 4975 |
4979 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 4976 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
4980 // of the original receiver from the call site). | 4977 // of the original receiver from the call site). |
4981 __ bind(&non_function); | 4978 __ bind(&non_function); |
4982 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); | 4979 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); |
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7162 | 7159 |
7163 // Fall through when we need to inform the incremental marker. | 7160 // Fall through when we need to inform the incremental marker. |
7164 } | 7161 } |
7165 | 7162 |
7166 | 7163 |
7167 #undef __ | 7164 #undef __ |
7168 | 7165 |
7169 } } // namespace v8::internal | 7166 } } // namespace v8::internal |
7170 | 7167 |
7171 #endif // V8_TARGET_ARCH_ARM | 7168 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |