OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); | 110 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); |
111 __ push(ip); | 111 __ push(ip); |
112 __ bind(&entry); | 112 __ bind(&entry); |
113 __ sub(r3, r3, Operand(2), SetCC); | 113 __ sub(r3, r3, Operand(2), SetCC); |
114 __ b(ge, &loop); | 114 __ b(ge, &loop); |
115 | 115 |
116 // Call the function. | 116 // Call the function. |
117 // r0: number of arguments | 117 // r0: number of arguments |
118 // r1: constructor function | 118 // r1: constructor function |
119 Label return_site; | 119 Label return_site; |
120 __ RecordPosition(position); | |
121 ParameterCount actual(r0); | 120 ParameterCount actual(r0); |
122 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 121 __ InvokeFunction(r1, actual, CALL_FUNCTION); |
123 __ bind(&return_site); | 122 __ bind(&return_site); |
124 | 123 |
125 // Pop the function from the stack. | 124 // Pop the function from the stack. |
126 // sp[0]: constructor function | 125 // sp[0]: constructor function |
127 // sp[2]: receiver | 126 // sp[2]: receiver |
128 // sp[3]: constructor function | 127 // sp[3]: constructor function |
129 // sp[4]: number of arguments (smi-tagged) | 128 // sp[4]: number of arguments (smi-tagged) |
130 __ pop(); | 129 __ pop(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 __ mov(r5, Operand(r4)); | 225 __ mov(r5, Operand(r4)); |
227 __ mov(r6, Operand(r4)); | 226 __ mov(r6, Operand(r4)); |
228 __ mov(r7, Operand(r4)); | 227 __ mov(r7, Operand(r4)); |
229 if (kR9Available == 1) | 228 if (kR9Available == 1) |
230 __ mov(r9, Operand(r4)); | 229 __ mov(r9, Operand(r4)); |
231 | 230 |
232 // Invoke the code and pass argc as r0. | 231 // Invoke the code and pass argc as r0. |
233 __ mov(r0, Operand(r3)); | 232 __ mov(r0, Operand(r3)); |
234 if (is_construct) { | 233 if (is_construct) { |
235 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), | 234 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), |
236 code_target); | 235 RelocInfo::CODE_TARGET); |
237 } else { | 236 } else { |
238 ParameterCount actual(r0); | 237 ParameterCount actual(r0); |
239 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 238 __ InvokeFunction(r1, actual, CALL_FUNCTION); |
240 } | 239 } |
241 | 240 |
242 // Exit the JS frame and remove the parameters (except function), and return. | 241 // Exit the JS frame and remove the parameters (except function), and return. |
243 // Respect ABI stack constraint. | 242 // Respect ABI stack constraint. |
244 __ ExitInternalFrame(); | 243 __ ExitInternalFrame(); |
245 __ mov(pc, lr); | 244 __ mov(pc, lr); |
246 | 245 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // 6. Get the code for the function or the non-function builtin. | 378 // 6. Get the code for the function or the non-function builtin. |
380 // If number of expected arguments matches, then call. Otherwise restart | 379 // If number of expected arguments matches, then call. Otherwise restart |
381 // the arguments adaptor stub. | 380 // the arguments adaptor stub. |
382 // r0: actual number of arguments | 381 // r0: actual number of arguments |
383 // r1: function | 382 // r1: function |
384 { Label invoke; | 383 { Label invoke; |
385 __ tst(r1, r1); | 384 __ tst(r1, r1); |
386 __ b(ne, &invoke); | 385 __ b(ne, &invoke); |
387 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION | 386 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION |
388 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 387 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
389 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), code_target); | 388 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), |
| 389 RelocInfo::CODE_TARGET); |
390 | 390 |
391 __ bind(&invoke); | 391 __ bind(&invoke); |
392 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 392 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
393 __ ldr(r2, | 393 __ ldr(r2, |
394 FieldMemOperand(r3, | 394 FieldMemOperand(r3, |
395 SharedFunctionInfo::kFormalParameterCountOffset)); | 395 SharedFunctionInfo::kFormalParameterCountOffset)); |
396 __ ldr(r3, | 396 __ ldr(r3, |
397 MemOperand(r3, SharedFunctionInfo::kCodeOffset - kHeapObjectTag)); | 397 MemOperand(r3, SharedFunctionInfo::kCodeOffset - kHeapObjectTag)); |
398 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 398 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
399 __ cmp(r2, r0); // Check formal and actual parameter counts. | 399 __ cmp(r2, r0); // Check formal and actual parameter counts. |
400 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), code_target, ne); | 400 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), |
| 401 RelocInfo::CODE_TARGET, ne); |
401 | 402 |
402 // 7. Jump to the code in r3 without checking arguments. | 403 // 7. Jump to the code in r3 without checking arguments. |
403 ParameterCount expected(0); | 404 ParameterCount expected(0); |
404 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); | 405 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); |
405 } | 406 } |
406 } | 407 } |
407 | 408 |
408 | 409 |
409 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 410 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
410 const int kIndexOffset = -5 * kPointerSize; | 411 const int kIndexOffset = -5 * kPointerSize; |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 } | 829 } |
829 | 830 |
830 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { | 831 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { |
831 // Generate nothing as CodeStub CallFunction is not used on ARM. | 832 // Generate nothing as CodeStub CallFunction is not used on ARM. |
832 } | 833 } |
833 | 834 |
834 | 835 |
835 #undef __ | 836 #undef __ |
836 | 837 |
837 } } // namespace v8::internal | 838 } } // namespace v8::internal |
OLD | NEW |