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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 | 52 |
53 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 53 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
54 // ----------- S t a t e ------------- | 54 // ----------- S t a t e ------------- |
55 // -- r0 : number of arguments | 55 // -- r0 : number of arguments |
56 // -- r1 : constructor function | 56 // -- r1 : constructor function |
57 // -- lr : return address | 57 // -- lr : return address |
58 // -- sp[...]: constructor arguments | 58 // -- sp[...]: constructor arguments |
59 // ----------------------------------- | 59 // ----------------------------------- |
60 | 60 |
61 // Enter an internal frame. | 61 // Enter a construct frame. |
62 __ EnterInternalFrame(); | 62 __ EnterConstructFrame(); |
63 | 63 |
64 // Preserve the two incoming parameters | 64 // Preserve the two incoming parameters |
65 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | 65 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
66 __ push(r0); // smi-tagged arguments count | 66 __ push(r0); // smi-tagged arguments count |
67 __ push(r1); // constructor function | 67 __ push(r1); // constructor function |
68 | 68 |
69 // Allocate the new receiver object. | 69 // Allocate the new receiver object. |
70 __ push(r1); // argument for Runtime_NewObject | 70 __ push(r1); // argument for Runtime_NewObject |
71 __ CallRuntime(Runtime::kNewObject, 1); | 71 __ CallRuntime(Runtime::kNewObject, 1); |
72 __ push(r0); // save the receiver | 72 __ push(r0); // save the receiver |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 __ bind(&loop); | 109 __ bind(&loop); |
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; | |
120 ParameterCount actual(r0); | 119 ParameterCount actual(r0); |
121 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 120 __ InvokeFunction(r1, actual, CALL_FUNCTION); |
122 __ bind(&return_site); | |
123 | 121 |
124 // Pop the function from the stack. | 122 // Pop the function from the stack. |
125 // sp[0]: constructor function | 123 // sp[0]: constructor function |
126 // sp[2]: receiver | 124 // sp[2]: receiver |
127 // sp[3]: constructor function | 125 // sp[3]: constructor function |
128 // sp[4]: number of arguments (smi-tagged) | 126 // sp[4]: number of arguments (smi-tagged) |
129 __ pop(); | 127 __ pop(); |
130 | 128 |
131 // Restore context from the frame. | 129 // Restore context from the frame. |
132 // r0: result | 130 // r0: result |
(...skipping 28 matching lines...) Expand all Loading... |
161 __ ldr(r0, MemOperand(sp)); | 159 __ ldr(r0, MemOperand(sp)); |
162 | 160 |
163 // Remove receiver from the stack, remove caller arguments, and | 161 // Remove receiver from the stack, remove caller arguments, and |
164 // return. | 162 // return. |
165 __ bind(&exit); | 163 __ bind(&exit); |
166 // r0: result | 164 // r0: result |
167 // sp[0]: receiver (newly allocated object) | 165 // sp[0]: receiver (newly allocated object) |
168 // sp[1]: constructor function | 166 // sp[1]: constructor function |
169 // sp[2]: number of arguments (smi-tagged) | 167 // sp[2]: number of arguments (smi-tagged) |
170 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); | 168 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
171 __ LeaveInternalFrame(); | 169 __ LeaveConstructFrame(); |
172 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); | 170 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
173 __ add(sp, sp, Operand(kPointerSize)); | 171 __ add(sp, sp, Operand(kPointerSize)); |
174 __ mov(pc, Operand(lr)); | 172 __ mov(pc, Operand(lr)); |
175 | |
176 // Compute the offset from the beginning of the JSConstructCall | |
177 // builtin code object to the return address after the call. | |
178 ASSERT(return_site.is_bound()); | |
179 construct_call_pc_offset_ = return_site.pos() + Code::kHeaderSize; | |
180 } | 173 } |
181 | 174 |
182 | 175 |
183 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 176 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
184 bool is_construct) { | 177 bool is_construct) { |
185 // Called from Generate_JS_Entry | 178 // Called from Generate_JS_Entry |
186 // r0: code entry | 179 // r0: code entry |
187 // r1: function | 180 // r1: function |
188 // r2: receiver | 181 // r2: receiver |
189 // r3: argc | 182 // r3: argc |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 525 |
533 | 526 |
534 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 527 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
535 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | 528 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
536 __ mov(r4, Operand(ArgumentsAdaptorFrame::SENTINEL)); | 529 __ mov(r4, Operand(ArgumentsAdaptorFrame::SENTINEL)); |
537 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); | 530 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); |
538 __ add(fp, sp, Operand(3 * kPointerSize)); | 531 __ add(fp, sp, Operand(3 * kPointerSize)); |
539 } | 532 } |
540 | 533 |
541 | 534 |
542 static void ExitArgumentsAdaptorFrame(MacroAssembler* masm) { | 535 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { |
543 // ----------- S t a t e ------------- | 536 // ----------- S t a t e ------------- |
544 // -- r0 : result being passed through | 537 // -- r0 : result being passed through |
545 // ----------------------------------- | 538 // ----------------------------------- |
546 // Get the number of arguments passed (as a smi), tear down the frame and | 539 // Get the number of arguments passed (as a smi), tear down the frame and |
547 // then tear down the parameters. | 540 // then tear down the parameters. |
548 __ ldr(r1, MemOperand(fp, -3 * kPointerSize)); | 541 __ ldr(r1, MemOperand(fp, -3 * kPointerSize)); |
549 __ mov(sp, fp); | 542 __ mov(sp, fp); |
550 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 543 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
551 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); | 544 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); |
552 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver | 545 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 __ sub(r2, r2, Operand(4 * kPointerSize)); // Adjust for frame. | 627 __ sub(r2, r2, Operand(4 * kPointerSize)); // Adjust for frame. |
635 | 628 |
636 Label fill; | 629 Label fill; |
637 __ bind(&fill); | 630 __ bind(&fill); |
638 __ push(ip); | 631 __ push(ip); |
639 __ cmp(sp, r2); | 632 __ cmp(sp, r2); |
640 __ b(ne, &fill); | 633 __ b(ne, &fill); |
641 } | 634 } |
642 | 635 |
643 // Call the entry point. | 636 // Call the entry point. |
644 Label return_site; | |
645 __ bind(&invoke); | 637 __ bind(&invoke); |
| 638 __ Call(r3); |
646 | 639 |
647 __ Call(r3); | 640 // Exit frame and return. |
648 __ bind(&return_site); | 641 LeaveArgumentsAdaptorFrame(masm); |
649 | |
650 ExitArgumentsAdaptorFrame(masm); | |
651 __ mov(pc, lr); | 642 __ mov(pc, lr); |
652 | 643 |
653 // Compute the offset from the beginning of the ArgumentsAdaptorTrampoline | |
654 // builtin code object to the return address after the call. | |
655 ASSERT(return_site.is_bound()); | |
656 arguments_adaptor_call_pc_offset_ = return_site.pos() + Code::kHeaderSize; | |
657 | |
658 | 644 |
659 // ------------------------------------------- | 645 // ------------------------------------------- |
660 // Dont adapt arguments. | 646 // Dont adapt arguments. |
661 // ------------------------------------------- | 647 // ------------------------------------------- |
662 __ bind(&dont_adapt_arguments); | 648 __ bind(&dont_adapt_arguments); |
663 __ mov(pc, r3); | 649 __ mov(pc, r3); |
664 } | 650 } |
665 | 651 |
666 | 652 |
667 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 653 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 } | 809 } |
824 | 810 |
825 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { | 811 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { |
826 // Generate nothing as CodeStub CallFunction is not used on ARM. | 812 // Generate nothing as CodeStub CallFunction is not used on ARM. |
827 } | 813 } |
828 | 814 |
829 | 815 |
830 #undef __ | 816 #undef __ |
831 | 817 |
832 } } // namespace v8::internal | 818 } } // namespace v8::internal |
OLD | NEW |