Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/mips/builtins-mips.cc

Issue 1018001: MIPS simple function calls (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/codegen-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 69
70 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 70 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
71 UNIMPLEMENTED_MIPS(); 71 UNIMPLEMENTED_MIPS();
72 } 72 }
73 73
74 74
75 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 75 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
76 bool is_construct) { 76 bool is_construct) {
77 UNIMPLEMENTED_MIPS(); 77 // Called from JSEntryStub::GenerateBody
78
79 // Registers:
80 // a0: entry_address
81 // a1: function
82 // a2: reveiver_pointer
83 // a3: argc
84 // s0: argv
85 //
86 // Stack:
87 // arguments slots
88 // handler frame
89 // entry frame
90 // callee saved registers + ra
91 // 4 args slots
92 // args
93
94 // Clear the context before we push it when entering the JS frame.
95 __ li(cp, Operand(0));
96
97 // Enter an internal frame.
98 __ EnterInternalFrame();
99
100 // Set up the context from the function argument.
101 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
102
103 // Set up the roots register.
104 ExternalReference roots_address = ExternalReference::roots_address();
105 __ li(s6, Operand(roots_address));
106
107 // Push the function and the receiver onto the stack.
108 __ MultiPushReversed(a1.bit() | a2.bit());
109
110 // Copy arguments to the stack in a loop.
111 // a3: argc
112 // s0: argv, ie points to first arg
113 Label loop, entry;
114 __ sll(t0, a3, kPointerSizeLog2);
115 __ add(t2, s0, t0);
116 __ b(&entry);
117 __ nop(); // Branch delay slot nop.
118 // t2 points past last arg.
119 __ bind(&loop);
120 __ lw(t0, MemOperand(s0)); // Read next parameter.
121 __ addiu(s0, s0, kPointerSize);
122 __ lw(t0, MemOperand(t0)); // Dereference handle.
123 __ Push(t0); // Push parameter.
124 __ bind(&entry);
125 __ Branch(ne, &loop, s0, Operand(t2));
126
127 // Registers:
128 // a0: entry_address
129 // a1: function
130 // a2: reveiver_pointer
131 // a3: argc
132 // s0: argv
133 // s6: roots_address
134 //
135 // Stack:
136 // arguments
137 // receiver
138 // function
139 // arguments slots
140 // handler frame
141 // entry frame
142 // callee saved registers + ra
143 // 4 args slots
144 // args
145
146 // Initialize all JavaScript callee-saved registers, since they will be seen
147 // by the garbage collector as part of handlers.
148 __ LoadRoot(t4, Heap::kUndefinedValueRootIndex);
149 __ mov(s1, t4);
150 __ mov(s2, t4);
151 __ mov(s3, t4);
152 __ mov(s4, s4);
153 __ mov(s5, t4);
154 // s6 holds the root address. Do not clobber.
155 // s7 is cp. Do not init.
156
157 // Invoke the code and pass argc as a0.
158 __ mov(a0, a3);
159 if (is_construct) {
160 UNIMPLEMENTED_MIPS();
161 __ break_(0x164);
162 } else {
163 ParameterCount actual(a0);
164 __ InvokeFunction(a1, actual, CALL_FUNCTION);
165 }
166
167 __ LeaveInternalFrame();
168
169 __ Jump(ra);
78 } 170 }
79 171
80 172
81 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 173 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
82 Generate_JSEntryTrampolineHelper(masm, false); 174 Generate_JSEntryTrampolineHelper(masm, false);
83 } 175 }
84 176
85 177
86 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 178 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
87 Generate_JSEntryTrampolineHelper(masm, true); 179 Generate_JSEntryTrampolineHelper(masm, true);
88 } 180 }
89 181
90 182
91 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 183 void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
92 UNIMPLEMENTED_MIPS(); 184 UNIMPLEMENTED_MIPS();
93 } 185 }
94 186
95 187
96 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 188 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
97 UNIMPLEMENTED_MIPS(); 189 UNIMPLEMENTED_MIPS();
98 } 190 }
99 191
100 192
101 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 193 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
102 UNIMPLEMENTED_MIPS(); 194 UNIMPLEMENTED_MIPS();
195 __ break_(0x201);
103 } 196 }
104 197
105 198
106 #undef __ 199 #undef __
107 200
108 } } // namespace v8::internal 201 } } // namespace v8::internal
109 202
OLDNEW
« no previous file with comments | « no previous file | src/mips/codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698