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

Side by Side Diff: src/mips/virtual-frame-mips.cc

Issue 6709022: Re-establish mips basic infrastructure. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 9 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
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28
29
30 #include "v8.h" 28 #include "v8.h"
31 29
32 #if defined(V8_TARGET_ARCH_MIPS) 30 #if defined(V8_TARGET_ARCH_MIPS)
33 31
34 #include "codegen-inl.h" 32 #include "codegen-inl.h"
35 #include "register-allocator-inl.h" 33 #include "register-allocator-inl.h"
36 #include "scopes.h" 34 #include "scopes.h"
37 #include "virtual-frame-inl.h" 35 #include "virtual-frame-inl.h"
38 36
39 namespace v8 { 37 namespace v8 {
40 namespace internal { 38 namespace internal {
41 39
42 // -------------------------------------------------------------------------
43 // VirtualFrame implementation.
44
45 #define __ ACCESS_MASM(masm()) 40 #define __ ACCESS_MASM(masm())
46 41
47 void VirtualFrame::SyncElementBelowStackPointer(int index) { 42 void VirtualFrame::PopToA1A0() {
48 UNREACHABLE(); 43 UNIMPLEMENTED_MIPS();
49 } 44 }
50 45
51 46
52 void VirtualFrame::SyncElementByPushing(int index) { 47 void VirtualFrame::PopToA1() {
53 UNREACHABLE(); 48 UNIMPLEMENTED_MIPS();
54 } 49 }
55 50
56 51
57 void VirtualFrame::SyncRange(int begin, int end) { 52 void VirtualFrame::PopToA0() {
58 // All elements are in memory on MIPS (ie, synced). 53 UNIMPLEMENTED_MIPS();
59 #ifdef DEBUG
60 for (int i = begin; i <= end; i++) {
61 ASSERT(elements_[i].is_synced());
62 }
63 #endif
64 } 54 }
65 55
66 56
67 void VirtualFrame::MergeTo(VirtualFrame* expected) { 57 void VirtualFrame::MergeTo(const VirtualFrame* expected,
58 Condition cond,
59 Register r1,
60 const Operand& r2) {
61 UNIMPLEMENTED_MIPS();
62 }
63
64
65 void VirtualFrame::MergeTo(VirtualFrame* expected,
66 Condition cond,
67 Register r1,
68 const Operand& r2) {
69 UNIMPLEMENTED_MIPS();
70 }
71
72
73 void VirtualFrame::MergeTOSTo(
74 VirtualFrame::TopOfStack expected_top_of_stack_state,
75 Condition cond,
76 Register r1,
77 const Operand& r2) {
68 UNIMPLEMENTED_MIPS(); 78 UNIMPLEMENTED_MIPS();
69 } 79 }
70 80
71 81
72 void VirtualFrame::Enter() { 82 void VirtualFrame::Enter() {
73 // TODO(MIPS): Implement DEBUG 83 UNIMPLEMENTED_MIPS();
74
75 // We are about to push four values to the frame.
76 Adjust(4);
77 __ MultiPush(ra.bit() | fp.bit() | cp.bit() | a1.bit());
78 // Adjust FP to point to saved FP.
79 __ addiu(fp, sp, 2 * kPointerSize);
80 } 84 }
81 85
82 86
83 void VirtualFrame::Exit() { 87 void VirtualFrame::Exit() {
84 UNIMPLEMENTED_MIPS(); 88 UNIMPLEMENTED_MIPS();
85 } 89 }
86 90
87 91
88 void VirtualFrame::AllocateStackSlots() { 92 void VirtualFrame::AllocateStackSlots() {
89 int count = local_count(); 93 UNIMPLEMENTED_MIPS();
90 if (count > 0) { 94 }
91 Comment cmnt(masm(), "[ Allocate space for locals"); 95
92 Adjust(count);
93 // Initialize stack slots with 'undefined' value.
94 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
95 __ addiu(sp, sp, -count * kPointerSize);
96 for (int i = 0; i < count; i++) {
97 __ sw(t0, MemOperand(sp, (count-i-1)*kPointerSize));
98 }
99 }
100 }
101
102
103 void VirtualFrame::SaveContextRegister() {
104 UNIMPLEMENTED_MIPS();
105 }
106
107
108 void VirtualFrame::RestoreContextRegister() {
109 UNIMPLEMENTED_MIPS();
110 }
111 96
112 97
113 void VirtualFrame::PushReceiverSlotAddress() { 98 void VirtualFrame::PushReceiverSlotAddress() {
114 UNIMPLEMENTED_MIPS(); 99 UNIMPLEMENTED_MIPS();
115 } 100 }
116 101
117 102
118 int VirtualFrame::InvalidateFrameSlotAt(int index) {
119 return kIllegalIndex;
120 }
121
122
123 void VirtualFrame::TakeFrameSlotAt(int index) {
124 UNIMPLEMENTED_MIPS();
125 }
126
127
128 void VirtualFrame::StoreToFrameSlotAt(int index) {
129 UNIMPLEMENTED_MIPS();
130 }
131
132
133 void VirtualFrame::PushTryHandler(HandlerType type) { 103 void VirtualFrame::PushTryHandler(HandlerType type) {
134 UNIMPLEMENTED_MIPS(); 104 UNIMPLEMENTED_MIPS();
135 } 105 }
136 106
137 107
138 void VirtualFrame::RawCallStub(CodeStub* stub) { 108 void VirtualFrame::CallJSFunction(int arg_count) {
139 UNIMPLEMENTED_MIPS();
140 }
141
142
143 void VirtualFrame::CallStub(CodeStub* stub, Result* arg) {
144 UNIMPLEMENTED_MIPS();
145 }
146
147
148 void VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) {
149 UNIMPLEMENTED_MIPS(); 109 UNIMPLEMENTED_MIPS();
150 } 110 }
151 111
152 112
153 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { 113 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) {
154 PrepareForCall(arg_count, arg_count); 114 UNIMPLEMENTED_MIPS();
155 ASSERT(cgen()->HasValidEntryRegisters());
156 __ CallRuntime(f, arg_count);
157 } 115 }
158 116
159 117
160 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { 118 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) {
161 PrepareForCall(arg_count, arg_count); 119 UNIMPLEMENTED_MIPS();
162 ASSERT(cgen()->HasValidEntryRegisters()); 120 }
163 __ CallRuntime(id, arg_count); 121
164 } 122
165 123 #ifdef ENABLE_DEBUGGER_SUPPORT
166 124 void VirtualFrame::DebugBreak() {
167 void VirtualFrame::CallAlignedRuntime(Runtime::Function* f, int arg_count) { 125 UNIMPLEMENTED_MIPS();
168 UNIMPLEMENTED_MIPS(); 126 }
169 } 127 #endif
170
171
172 void VirtualFrame::CallAlignedRuntime(Runtime::FunctionId id, int arg_count) {
173 UNIMPLEMENTED_MIPS();
174 }
175 128
176 129
177 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, 130 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id,
178 InvokeJSFlags flags, 131 InvokeJSFlags flags,
179 Result* arg_count_register,
180 int arg_count) { 132 int arg_count) {
181 UNIMPLEMENTED_MIPS(); 133 UNIMPLEMENTED_MIPS();
182 } 134 }
183 135
184 136
137 void VirtualFrame::CallLoadIC(Handle<String> name, RelocInfo::Mode mode) {
138 UNIMPLEMENTED_MIPS();
139 }
140
141
142 void VirtualFrame::CallStoreIC(Handle<String> name, bool is_contextual) {
143 UNIMPLEMENTED_MIPS();
144 }
145
146
147 void VirtualFrame::CallKeyedLoadIC() {
148 UNIMPLEMENTED_MIPS();
149 }
150
151
152 void VirtualFrame::CallKeyedStoreIC() {
153 UNIMPLEMENTED_MIPS();
154 }
155
156
185 void VirtualFrame::CallCodeObject(Handle<Code> code, 157 void VirtualFrame::CallCodeObject(Handle<Code> code,
186 RelocInfo::Mode rmode, 158 RelocInfo::Mode rmode,
187 int dropped_args) { 159 int dropped_args) {
188 switch (code->kind()) { 160 UNIMPLEMENTED_MIPS();
189 case Code::CALL_IC: 161 }
190 break; 162
191 case Code::FUNCTION: 163
192 UNIMPLEMENTED_MIPS(); 164 // NO_TOS_REGISTERS, A0_TOS, A1_TOS, A1_A0_TOS, A0_A1_TOS.
193 break; 165 const bool VirtualFrame::kA0InUse[TOS_STATES] =
194 case Code::KEYED_LOAD_IC: 166 { false, true, false, true, true };
195 UNIMPLEMENTED_MIPS(); 167 const bool VirtualFrame::kA1InUse[TOS_STATES] =
196 break; 168 { false, false, true, true, true };
197 case Code::LOAD_IC: 169 const int VirtualFrame::kVirtualElements[TOS_STATES] =
198 UNIMPLEMENTED_MIPS(); 170 { 0, 1, 1, 2, 2 };
199 break; 171 const Register VirtualFrame::kTopRegister[TOS_STATES] =
200 case Code::KEYED_STORE_IC: 172 { a0, a0, a1, a1, a0 };
201 UNIMPLEMENTED_MIPS(); 173 const Register VirtualFrame::kBottomRegister[TOS_STATES] =
202 break; 174 { a0, a0, a1, a0, a1 };
203 case Code::STORE_IC: 175 const Register VirtualFrame::kAllocatedRegisters[
204 UNIMPLEMENTED_MIPS(); 176 VirtualFrame::kNumberOfAllocatedRegisters] = { a2, a3, t0, t1, t2 };
205 break; 177 // Popping is done by the transition implied by kStateAfterPop. Of course if
206 case Code::BUILTIN: 178 // there were no stack slots allocated to registers then the physical SP must
207 UNIMPLEMENTED_MIPS(); 179 // be adjusted.
208 break; 180 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPop[TOS_STATES] =
209 default: 181 { NO_TOS_REGISTERS, NO_TOS_REGISTERS, NO_TOS_REGISTERS, A0_TOS, A1_TOS };
210 UNREACHABLE(); 182 // Pushing is done by the transition implied by kStateAfterPush. Of course if
211 break; 183 // the maximum number of registers was already allocated to the top of stack
212 } 184 // slots then one register must be physically pushed onto the stack.
213 Forget(dropped_args); 185 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPush[TOS_STATES] =
214 ASSERT(cgen()->HasValidEntryRegisters()); 186 { A0_TOS, A1_A0_TOS, A0_A1_TOS, A0_A1_TOS, A1_A0_TOS };
215 __ Call(code, rmode); 187
216 } 188
217 189 bool VirtualFrame::SpilledScope::is_spilled_ = false;
218
219 void VirtualFrame::CallCodeObject(Handle<Code> code,
220 RelocInfo::Mode rmode,
221 Result* arg,
222 int dropped_args) {
223 UNIMPLEMENTED_MIPS();
224 }
225
226
227 void VirtualFrame::CallCodeObject(Handle<Code> code,
228 RelocInfo::Mode rmode,
229 Result* arg0,
230 Result* arg1,
231 int dropped_args,
232 bool set_auto_args_slots) {
233 UNIMPLEMENTED_MIPS();
234 }
235 190
236 191
237 void VirtualFrame::Drop(int count) { 192 void VirtualFrame::Drop(int count) {
238 ASSERT(count >= 0); 193 UNIMPLEMENTED_MIPS();
239 ASSERT(height() >= count); 194 }
240 int num_virtual_elements = (element_count() - 1) - stack_pointer_; 195
241 196
242 // Emit code to lower the stack pointer if necessary. 197 void VirtualFrame::Pop() {
243 if (num_virtual_elements < count) { 198 UNIMPLEMENTED_MIPS();
244 int num_dropped = count - num_virtual_elements;
245 stack_pointer_ -= num_dropped;
246 __ addiu(sp, sp, num_dropped * kPointerSize);
247 }
248
249 // Discard elements from the virtual frame and free any registers.
250 for (int i = 0; i < count; i++) {
251 FrameElement dropped = elements_.RemoveLast();
252 if (dropped.is_register()) {
253 Unuse(dropped.reg());
254 }
255 }
256 }
257
258
259 void VirtualFrame::DropFromVFrameOnly(int count) {
260 UNIMPLEMENTED_MIPS();
261 }
262
263
264 Result VirtualFrame::Pop() {
265 UNIMPLEMENTED_MIPS();
266 Result res = Result();
267 return res; // UNIMPLEMENTED RETURN
268 } 199 }
269 200
270 201
271 void VirtualFrame::EmitPop(Register reg) { 202 void VirtualFrame::EmitPop(Register reg) {
272 ASSERT(stack_pointer_ == element_count() - 1); 203 UNIMPLEMENTED_MIPS();
273 stack_pointer_--; 204 }
274 elements_.RemoveLast(); 205
275 __ Pop(reg); 206
207 void VirtualFrame::SpillAllButCopyTOSToA0() {
208 UNIMPLEMENTED_MIPS();
209 }
210
211
212 void VirtualFrame::SpillAllButCopyTOSToA1() {
213 UNIMPLEMENTED_MIPS();
214 }
215
216
217 void VirtualFrame::SpillAllButCopyTOSToA1A0() {
218 UNIMPLEMENTED_MIPS();
219 }
220
221
222 Register VirtualFrame::Peek() {
223 UNIMPLEMENTED_MIPS();
224 return no_reg;
225 }
226
227
228 Register VirtualFrame::Peek2() {
229 UNIMPLEMENTED_MIPS();
230 return no_reg;
231 }
232
233
234 void VirtualFrame::Dup() {
235 UNIMPLEMENTED_MIPS();
236 }
237
238
239 void VirtualFrame::Dup2() {
240 UNIMPLEMENTED_MIPS();
241 }
242
243
244 Register VirtualFrame::PopToRegister(Register but_not_to_this_one) {
245 UNIMPLEMENTED_MIPS();
246 return no_reg;
247 }
248
249
250 void VirtualFrame::EnsureOneFreeTOSRegister() {
251 UNIMPLEMENTED_MIPS();
276 } 252 }
277 253
278 254
279 void VirtualFrame::EmitMultiPop(RegList regs) { 255 void VirtualFrame::EmitMultiPop(RegList regs) {
280 ASSERT(stack_pointer_ == element_count() - 1); 256 UNIMPLEMENTED_MIPS();
281 for (int16_t i = 0; i < kNumRegisters; i++) { 257 }
282 if ((regs & (1 << i)) != 0) { 258
283 stack_pointer_--; 259
284 elements_.RemoveLast(); 260 void VirtualFrame::EmitPush(Register reg, TypeInfo info) {
285 } 261 UNIMPLEMENTED_MIPS();
286 } 262 }
287 __ MultiPop(regs); 263
288 } 264
289 265 void VirtualFrame::SetElementAt(Register reg, int this_far_down) {
290 266 UNIMPLEMENTED_MIPS();
291 void VirtualFrame::EmitPush(Register reg) { 267 }
292 ASSERT(stack_pointer_ == element_count() - 1); 268
293 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); 269
294 stack_pointer_++; 270 Register VirtualFrame::GetTOSRegister() {
295 __ Push(reg); 271 UNIMPLEMENTED_MIPS();
272 return no_reg;
273 }
274
275
276 void VirtualFrame::EmitPush(Operand operand, TypeInfo info) {
277 UNIMPLEMENTED_MIPS();
278 }
279
280
281 void VirtualFrame::EmitPush(MemOperand operand, TypeInfo info) {
282 UNIMPLEMENTED_MIPS();
283 }
284
285
286 void VirtualFrame::EmitPushRoot(Heap::RootListIndex index) {
287 UNIMPLEMENTED_MIPS();
296 } 288 }
297 289
298 290
299 void VirtualFrame::EmitMultiPush(RegList regs) { 291 void VirtualFrame::EmitMultiPush(RegList regs) {
300 ASSERT(stack_pointer_ == element_count() - 1); 292 UNIMPLEMENTED_MIPS();
301 for (int16_t i = kNumRegisters; i > 0; i--) { 293 }
302 if ((regs & (1 << i)) != 0) { 294
303 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); 295
304 stack_pointer_++; 296 void VirtualFrame::EmitMultiPushReversed(RegList regs) {
305 } 297 UNIMPLEMENTED_MIPS();
306 } 298 }
307 __ MultiPush(regs); 299
308 } 300
309 301 void VirtualFrame::SpillAll() {
310 302 UNIMPLEMENTED_MIPS();
311 void VirtualFrame::EmitArgumentSlots(RegList reglist) { 303 }
312 UNIMPLEMENTED_MIPS(); 304
313 }
314 305
315 #undef __ 306 #undef __
316 307
317 } } // namespace v8::internal 308 } } // namespace v8::internal
318 309
319 #endif // V8_TARGET_ARCH_MIPS 310 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698