OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 UNREACHABLE(); | 46 UNREACHABLE(); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 void VirtualFrame::SyncElementByPushing(int index) { | 50 void VirtualFrame::SyncElementByPushing(int index) { |
51 UNREACHABLE(); | 51 UNREACHABLE(); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 void VirtualFrame::SyncRange(int begin, int end) { | 55 void VirtualFrame::SyncRange(int begin, int end) { |
56 UNIMPLEMENTED_MIPS(); | 56 // All elements are in memory on MIPS (ie, synced). |
| 57 #ifdef DEBUG |
| 58 for (int i = begin; i <= end; i++) { |
| 59 ASSERT(elements_[i].is_synced()); |
| 60 } |
| 61 #endif |
57 } | 62 } |
58 | 63 |
59 | 64 |
60 void VirtualFrame::MergeTo(VirtualFrame* expected) { | 65 void VirtualFrame::MergeTo(VirtualFrame* expected) { |
61 UNIMPLEMENTED_MIPS(); | 66 UNIMPLEMENTED_MIPS(); |
62 } | 67 } |
63 | 68 |
64 | 69 |
65 void VirtualFrame::Enter() { | 70 void VirtualFrame::Enter() { |
66 UNIMPLEMENTED_MIPS(); | 71 // TODO(MIPS): Implement DEBUG |
| 72 |
| 73 // We are about to push four values to the frame. |
| 74 Adjust(4); |
| 75 __ MultiPush(ra.bit() | fp.bit() | cp.bit() | a1.bit()); |
| 76 // Adjust FP to point to saved FP. |
| 77 __ addiu(fp, sp, 2 * kPointerSize); |
67 } | 78 } |
68 | 79 |
69 | 80 |
70 void VirtualFrame::Exit() { | 81 void VirtualFrame::Exit() { |
71 UNIMPLEMENTED_MIPS(); | 82 UNIMPLEMENTED_MIPS(); |
72 } | 83 } |
73 | 84 |
74 | 85 |
75 void VirtualFrame::AllocateStackSlots() { | 86 void VirtualFrame::AllocateStackSlots() { |
76 UNIMPLEMENTED_MIPS(); | 87 int count = local_count(); |
| 88 if (count > 0) { |
| 89 Comment cmnt(masm(), "[ Allocate space for locals"); |
| 90 Adjust(count); |
| 91 // Initialize stack slots with 'undefined' value. |
| 92 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); |
| 93 __ addiu(sp, sp, -count * kPointerSize); |
| 94 for (int i = 0; i < count; i++) { |
| 95 __ sw(t0, MemOperand(sp, (count-i-1)*kPointerSize)); |
| 96 } |
| 97 } |
77 } | 98 } |
78 | 99 |
79 | 100 |
80 void VirtualFrame::SaveContextRegister() { | 101 void VirtualFrame::SaveContextRegister() { |
81 UNIMPLEMENTED_MIPS(); | 102 UNIMPLEMENTED_MIPS(); |
82 } | 103 } |
83 | 104 |
84 | 105 |
85 void VirtualFrame::RestoreContextRegister() { | 106 void VirtualFrame::RestoreContextRegister() { |
86 UNIMPLEMENTED_MIPS(); | 107 UNIMPLEMENTED_MIPS(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 UNIMPLEMENTED_MIPS(); | 142 UNIMPLEMENTED_MIPS(); |
122 } | 143 } |
123 | 144 |
124 | 145 |
125 void VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) { | 146 void VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) { |
126 UNIMPLEMENTED_MIPS(); | 147 UNIMPLEMENTED_MIPS(); |
127 } | 148 } |
128 | 149 |
129 | 150 |
130 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { | 151 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { |
131 UNIMPLEMENTED_MIPS(); | 152 PrepareForCall(arg_count, arg_count); |
| 153 ASSERT(cgen()->HasValidEntryRegisters()); |
| 154 __ CallRuntime(f, arg_count); |
132 } | 155 } |
133 | 156 |
134 | 157 |
135 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { | 158 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { |
136 UNIMPLEMENTED_MIPS(); | 159 PrepareForCall(arg_count, arg_count); |
| 160 ASSERT(cgen()->HasValidEntryRegisters()); |
| 161 __ CallRuntime(id, arg_count); |
137 } | 162 } |
138 | 163 |
139 | 164 |
140 void VirtualFrame::CallAlignedRuntime(Runtime::Function* f, int arg_count) { | 165 void VirtualFrame::CallAlignedRuntime(Runtime::Function* f, int arg_count) { |
141 UNIMPLEMENTED_MIPS(); | 166 UNIMPLEMENTED_MIPS(); |
142 } | 167 } |
143 | 168 |
144 | 169 |
145 void VirtualFrame::CallAlignedRuntime(Runtime::FunctionId id, int arg_count) { | 170 void VirtualFrame::CallAlignedRuntime(Runtime::FunctionId id, int arg_count) { |
146 UNIMPLEMENTED_MIPS(); | 171 UNIMPLEMENTED_MIPS(); |
147 } | 172 } |
148 | 173 |
149 | 174 |
150 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | 175 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, |
151 InvokeJSFlags flags, | 176 InvokeJSFlags flags, |
152 Result* arg_count_register, | 177 Result* arg_count_register, |
153 int arg_count) { | 178 int arg_count) { |
154 UNIMPLEMENTED_MIPS(); | 179 UNIMPLEMENTED_MIPS(); |
155 } | 180 } |
156 | 181 |
157 | 182 |
158 void VirtualFrame::RawCallCodeObject(Handle<Code> code, | |
159 RelocInfo::Mode rmode) { | |
160 UNIMPLEMENTED_MIPS(); | |
161 } | |
162 | |
163 | |
164 void VirtualFrame::CallCodeObject(Handle<Code> code, | 183 void VirtualFrame::CallCodeObject(Handle<Code> code, |
165 RelocInfo::Mode rmode, | 184 RelocInfo::Mode rmode, |
166 int dropped_args) { | 185 int dropped_args) { |
167 UNIMPLEMENTED_MIPS(); | 186 switch (code->kind()) { |
| 187 case Code::CALL_IC: |
| 188 break; |
| 189 case Code::FUNCTION: |
| 190 UNIMPLEMENTED_MIPS(); |
| 191 break; |
| 192 case Code::KEYED_LOAD_IC: |
| 193 UNIMPLEMENTED_MIPS(); |
| 194 break; |
| 195 case Code::LOAD_IC: |
| 196 UNIMPLEMENTED_MIPS(); |
| 197 break; |
| 198 case Code::KEYED_STORE_IC: |
| 199 UNIMPLEMENTED_MIPS(); |
| 200 break; |
| 201 case Code::STORE_IC: |
| 202 UNIMPLEMENTED_MIPS(); |
| 203 break; |
| 204 case Code::BUILTIN: |
| 205 UNIMPLEMENTED_MIPS(); |
| 206 break; |
| 207 default: |
| 208 UNREACHABLE(); |
| 209 break; |
| 210 } |
| 211 Forget(dropped_args); |
| 212 ASSERT(cgen()->HasValidEntryRegisters()); |
| 213 __ Call(code, rmode); |
168 } | 214 } |
169 | 215 |
170 | 216 |
171 void VirtualFrame::CallCodeObject(Handle<Code> code, | 217 void VirtualFrame::CallCodeObject(Handle<Code> code, |
172 RelocInfo::Mode rmode, | 218 RelocInfo::Mode rmode, |
173 Result* arg, | 219 Result* arg, |
174 int dropped_args) { | 220 int dropped_args) { |
175 UNIMPLEMENTED_MIPS(); | 221 UNIMPLEMENTED_MIPS(); |
176 } | 222 } |
177 | 223 |
178 | 224 |
179 void VirtualFrame::CallCodeObject(Handle<Code> code, | 225 void VirtualFrame::CallCodeObject(Handle<Code> code, |
180 RelocInfo::Mode rmode, | 226 RelocInfo::Mode rmode, |
181 Result* arg0, | 227 Result* arg0, |
182 Result* arg1, | 228 Result* arg1, |
183 int dropped_args, | 229 int dropped_args, |
184 bool set_auto_args_slots) { | 230 bool set_auto_args_slots) { |
185 UNIMPLEMENTED_MIPS(); | 231 UNIMPLEMENTED_MIPS(); |
186 } | 232 } |
187 | 233 |
188 | 234 |
189 void VirtualFrame::Drop(int count) { | 235 void VirtualFrame::Drop(int count) { |
190 UNIMPLEMENTED_MIPS(); | 236 ASSERT(count >= 0); |
| 237 ASSERT(height() >= count); |
| 238 int num_virtual_elements = (element_count() - 1) - stack_pointer_; |
| 239 |
| 240 // Emit code to lower the stack pointer if necessary. |
| 241 if (num_virtual_elements < count) { |
| 242 int num_dropped = count - num_virtual_elements; |
| 243 stack_pointer_ -= num_dropped; |
| 244 __ addiu(sp, sp, num_dropped * kPointerSize); |
| 245 } |
| 246 |
| 247 // Discard elements from the virtual frame and free any registers. |
| 248 for (int i = 0; i < count; i++) { |
| 249 FrameElement dropped = elements_.RemoveLast(); |
| 250 if (dropped.is_register()) { |
| 251 Unuse(dropped.reg()); |
| 252 } |
| 253 } |
191 } | 254 } |
192 | 255 |
193 | 256 |
194 void VirtualFrame::DropFromVFrameOnly(int count) { | 257 void VirtualFrame::DropFromVFrameOnly(int count) { |
195 UNIMPLEMENTED_MIPS(); | 258 UNIMPLEMENTED_MIPS(); |
196 } | 259 } |
197 | 260 |
198 | 261 |
199 Result VirtualFrame::Pop() { | 262 Result VirtualFrame::Pop() { |
200 UNIMPLEMENTED_MIPS(); | 263 UNIMPLEMENTED_MIPS(); |
201 Result res = Result(); | 264 Result res = Result(); |
202 return res; // UNIMPLEMENTED RETUR | 265 return res; // UNIMPLEMENTED RETURN |
203 } | 266 } |
204 | 267 |
205 | 268 |
206 void VirtualFrame::EmitPop(Register reg) { | 269 void VirtualFrame::EmitPop(Register reg) { |
207 UNIMPLEMENTED_MIPS(); | 270 ASSERT(stack_pointer_ == element_count() - 1); |
| 271 stack_pointer_--; |
| 272 elements_.RemoveLast(); |
| 273 __ Pop(reg); |
208 } | 274 } |
209 | 275 |
| 276 |
210 void VirtualFrame::EmitMultiPop(RegList regs) { | 277 void VirtualFrame::EmitMultiPop(RegList regs) { |
211 UNIMPLEMENTED_MIPS(); | 278 ASSERT(stack_pointer_ == element_count() - 1); |
| 279 for (int16_t i = 0; i < kNumRegisters; i++) { |
| 280 if ((regs & (1 << i)) != 0) { |
| 281 stack_pointer_--; |
| 282 elements_.RemoveLast(); |
| 283 } |
| 284 } |
| 285 __ MultiPop(regs); |
212 } | 286 } |
213 | 287 |
214 | 288 |
215 void VirtualFrame::EmitPush(Register reg) { | 289 void VirtualFrame::EmitPush(Register reg) { |
216 UNIMPLEMENTED_MIPS(); | 290 ASSERT(stack_pointer_ == element_count() - 1); |
| 291 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); |
| 292 stack_pointer_++; |
| 293 __ Push(reg); |
217 } | 294 } |
218 | 295 |
| 296 |
219 void VirtualFrame::EmitMultiPush(RegList regs) { | 297 void VirtualFrame::EmitMultiPush(RegList regs) { |
220 UNIMPLEMENTED_MIPS(); | 298 ASSERT(stack_pointer_ == element_count() - 1); |
| 299 for (int16_t i = kNumRegisters; i > 0; i--) { |
| 300 if ((regs & (1 << i)) != 0) { |
| 301 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); |
| 302 stack_pointer_++; |
| 303 } |
| 304 } |
| 305 __ MultiPush(regs); |
221 } | 306 } |
222 | 307 |
| 308 |
223 void VirtualFrame::EmitArgumentSlots(RegList reglist) { | 309 void VirtualFrame::EmitArgumentSlots(RegList reglist) { |
224 UNIMPLEMENTED_MIPS(); | 310 UNIMPLEMENTED_MIPS(); |
225 } | 311 } |
226 | 312 |
227 #undef __ | 313 #undef __ |
228 | 314 |
229 } } // namespace v8::internal | 315 } } // namespace v8::internal |
230 | 316 |
OLD | NEW |