1// Copyright 2010 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6//     * Redistributions of source code must retain the above copyright
7//       notice, this list of conditions and the following disclaimer.
8//     * Redistributions in binary form must reproduce the above
9//       copyright notice, this list of conditions and the following
10//       disclaimer in the documentation and/or other materials provided
11//       with the distribution.
12//     * Neither the name of Google Inc. nor the names of its
13//       contributors may be used to endorse or promote products derived
14//       from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
28
29#include "v8.h"
30
31#include "bootstrapper.h"
32#include "codegen-inl.h"
33#include "debug.h"
34#include "parser.h"
35#include "register-allocator-inl.h"
36#include "runtime.h"
37#include "scopes.h"
38#include "compiler.h"
39
40
41
42namespace v8 {
43namespace internal {
44
45#define __ ACCESS_MASM(masm_)
46
47
48
49// -------------------------------------------------------------------------
50// Platform-specific DeferredCode functions.
51
52
53void DeferredCode::SaveRegisters() {
54  UNIMPLEMENTED_MIPS();
55}
56
57
58void DeferredCode::RestoreRegisters() {
59  UNIMPLEMENTED_MIPS();
60}
61
62
63// -------------------------------------------------------------------------
64// CodeGenerator implementation
65
66CodeGenerator::CodeGenerator(MacroAssembler* masm)
67    : deferred_(8),
68      masm_(masm),
69      scope_(NULL),
70      frame_(NULL),
71      allocator_(NULL),
72      cc_reg_(cc_always),
73      state_(NULL),
74      function_return_is_shadowed_(false) {
75}
76
77
78// Calling conventions:
79// s8_fp: caller's frame pointer
80// sp: stack pointer
81// a1: called JS function
82// cp: callee's context
83
84void CodeGenerator::Generate(CompilationInfo* info, Mode mode) {
85  UNIMPLEMENTED_MIPS();
86}
87
88
89void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
90  UNIMPLEMENTED_MIPS();
91}
92
93
94void CodeGenerator::VisitBlock(Block* node) {
95  UNIMPLEMENTED_MIPS();
96}
97
98
99void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
100  UNIMPLEMENTED_MIPS();
101}
102
103
104void CodeGenerator::VisitDeclaration(Declaration* node) {
105  UNIMPLEMENTED_MIPS();
106}
107
108
109void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) {
110  UNIMPLEMENTED_MIPS();
111}
112
113
114void CodeGenerator::VisitEmptyStatement(EmptyStatement* node) {
115  UNIMPLEMENTED_MIPS();
116}
117
118
119void CodeGenerator::VisitIfStatement(IfStatement* node) {
120  UNIMPLEMENTED_MIPS();
121}
122
123
124void CodeGenerator::VisitContinueStatement(ContinueStatement* node) {
125  UNIMPLEMENTED_MIPS();
126}
127
128
129void CodeGenerator::VisitBreakStatement(BreakStatement* node) {
130  UNIMPLEMENTED_MIPS();
131}
132
133
134void CodeGenerator::VisitReturnStatement(ReturnStatement* node) {
135  UNIMPLEMENTED_MIPS();
136}
137
138
139void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) {
140  UNIMPLEMENTED_MIPS();
141}
142
143
144void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) {
145  UNIMPLEMENTED_MIPS();
146}
147
148
149void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) {
150  UNIMPLEMENTED_MIPS();
151}
152
153
154void CodeGenerator::VisitDoWhileStatement(DoWhileStatement* node) {
155  UNIMPLEMENTED_MIPS();
156}
157
158
159void CodeGenerator::VisitWhileStatement(WhileStatement* node) {
160  UNIMPLEMENTED_MIPS();
161}
162
163
164void CodeGenerator::VisitForStatement(ForStatement* node) {
165  UNIMPLEMENTED_MIPS();
166}
167
168
169void CodeGenerator::VisitForInStatement(ForInStatement* node) {
170  UNIMPLEMENTED_MIPS();
171}
172
173
174void CodeGenerator::VisitTryCatchStatement(TryCatchStatement* node) {
175  UNIMPLEMENTED_MIPS();
176}
177
178
179void CodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* node) {
180  UNIMPLEMENTED_MIPS();
181}
182
183
184void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) {
185  UNIMPLEMENTED_MIPS();
186}
187
188
189void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
190  UNIMPLEMENTED_MIPS();
191}
192
193
194void CodeGenerator::VisitFunctionBoilerplateLiteral(
195    FunctionBoilerplateLiteral* node) {
196  UNIMPLEMENTED_MIPS();
197}
198
199
200void CodeGenerator::VisitConditional(Conditional* node) {
201  UNIMPLEMENTED_MIPS();
202}
203
204
205void CodeGenerator::VisitSlot(Slot* node) {
206  UNIMPLEMENTED_MIPS();
207}
208
209
210void CodeGenerator::VisitVariableProxy(VariableProxy* node) {
211  UNIMPLEMENTED_MIPS();
212}
213
214
215void CodeGenerator::VisitLiteral(Literal* node) {
216  UNIMPLEMENTED_MIPS();
217}
218
219
220void CodeGenerator::VisitRegExpLiteral(RegExpLiteral* node) {
221  UNIMPLEMENTED_MIPS();
222}
223
224
225void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) {
226  UNIMPLEMENTED_MIPS();
227}
228
229
230void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
231  UNIMPLEMENTED_MIPS();
232}
233
234
235void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) {
236  UNIMPLEMENTED_MIPS();
237}
238
239
240void CodeGenerator::VisitAssignment(Assignment* node) {
241  UNIMPLEMENTED_MIPS();
242}
243
244
245void CodeGenerator::VisitThrow(Throw* node) {
246  UNIMPLEMENTED_MIPS();
247}
248
249
250void CodeGenerator::VisitProperty(Property* node) {
251  UNIMPLEMENTED_MIPS();
252}
253
254
255void CodeGenerator::VisitCall(Call* node) {
256  UNIMPLEMENTED_MIPS();
257}
258
259
260void CodeGenerator::VisitCallNew(CallNew* node) {
261  UNIMPLEMENTED_MIPS();
262}
263
264
265void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) {
266  UNIMPLEMENTED_MIPS();
267}
268
269
270void CodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) {
271  UNIMPLEMENTED_MIPS();
272}
273
274
275void CodeGenerator::GenerateSetValueOf(ZoneList<Expression*>* args) {
276  UNIMPLEMENTED_MIPS();
277}
278
279
280void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
281  UNIMPLEMENTED_MIPS();
282}
283
284
285void CodeGenerator::GenerateLog(ZoneList<Expression*>* args) {
286  UNIMPLEMENTED_MIPS();
287}
288
289
290void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* args) {
291  UNIMPLEMENTED_MIPS();
292}
293
294
295// This should generate code that performs a charCodeAt() call or returns
296// undefined in order to trigger the slow case, Runtime_StringCharCodeAt.
297// It is not yet implemented on ARM, so it always goes to the slow case.
298void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
299  UNIMPLEMENTED_MIPS();
300}
301
302
303void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) {
304  UNIMPLEMENTED_MIPS();
305}
306
307
308void CodeGenerator::GenerateIsRegExp(ZoneList<Expression*>* args) {
309  UNIMPLEMENTED_MIPS();
310}
311
312
313void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
314  UNIMPLEMENTED_MIPS();
315}
316
317
318void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
319  UNIMPLEMENTED_MIPS();
320}
321
322
323void CodeGenerator::GenerateArgumentsAccess(ZoneList<Expression*>* args) {
324  UNIMPLEMENTED_MIPS();
325}
326
327
328void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
329  UNIMPLEMENTED_MIPS();
330}
331
332
333void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
334  UNIMPLEMENTED_MIPS();
335}
336
337
338void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) {
339  UNIMPLEMENTED_MIPS();
340}
341
342
343void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
344  UNIMPLEMENTED_MIPS();
345}
346
347
348void CodeGenerator::GenerateIsUndetectableObject(ZoneList<Expression*>* args) {
349  UNIMPLEMENTED_MIPS();
350}
351
352
353void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) {
354  UNIMPLEMENTED_MIPS();
355}
356
357
358void CodeGenerator::GenerateSubString(ZoneList<Expression*>* args) {
359  UNIMPLEMENTED_MIPS();
360}
361
362
363void CodeGenerator::GenerateStringCompare(ZoneList<Expression*>* args) {
364  UNIMPLEMENTED_MIPS();
365}
366
367
368void CodeGenerator::GenerateRegExpExec(ZoneList<Expression*>* args) {
369  UNIMPLEMENTED_MIPS();
370}
371
372
373void CodeGenerator::GenerateNumberToString(ZoneList<Expression*>* args) {
374  UNIMPLEMENTED_MIPS();
375}
376
377
378void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
379  UNIMPLEMENTED_MIPS();
380}
381
382
383void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
384  UNIMPLEMENTED_MIPS();
385}
386
387
388void CodeGenerator::VisitCountOperation(CountOperation* node) {
389  UNIMPLEMENTED_MIPS();
390}
391
392
393void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
394  UNIMPLEMENTED_MIPS();
395}
396
397
398void CodeGenerator::VisitThisFunction(ThisFunction* node) {
399  UNIMPLEMENTED_MIPS();
400}
401
402
403void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
404  UNIMPLEMENTED_MIPS();
405}
406
407
408#ifdef DEBUG
409bool CodeGenerator::HasValidEntryRegisters() { return true; }
410#endif
411
412
413#undef __
414#define __ ACCESS_MASM(masm)
415
416
417// On entry a0 and a1 are the things to be compared.  On exit v0 is 0,
418// positive or negative to indicate the result of the comparison.
419void CompareStub::Generate(MacroAssembler* masm) {
420  UNIMPLEMENTED_MIPS();
421  __ break_(0x765);
422}
423
424
425void StackCheckStub::Generate(MacroAssembler* masm) {
426  UNIMPLEMENTED_MIPS();
427  __ break_(0x790);
428}
429
430
431void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
432  UNIMPLEMENTED_MIPS();
433  __ break_(0x808);
434}
435
436
437void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
438                                          UncatchableExceptionType type) {
439  UNIMPLEMENTED_MIPS();
440  __ break_(0x815);
441}
442
443void CEntryStub::GenerateCore(MacroAssembler* masm,
444                              Label* throw_normal_exception,
445                              Label* throw_termination_exception,
446                              Label* throw_out_of_memory_exception,
447                              bool do_gc,
448                              bool always_allocate) {
449  UNIMPLEMENTED_MIPS();
450  __ break_(0x826);
451}
452
453void CEntryStub::Generate(MacroAssembler* masm) {
454  UNIMPLEMENTED_MIPS();
455  __ break_(0x831);
456}
457
458void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
459  UNIMPLEMENTED_MIPS();
460  // Load a result.
461  __ li(v0, Operand(0x1234));
462  __ jr(ra);
463  // Return
464  __ nop();
465}
466
467
468// This stub performs an instanceof, calling the builtin function if
469// necessary.  Uses a1 for the object, a0 for the function that it may
470// be an instance of (these are fetched from the stack).
471void InstanceofStub::Generate(MacroAssembler* masm) {
472  UNIMPLEMENTED_MIPS();
473  __ break_(0x845);
474}
475
476
477void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
478  UNIMPLEMENTED_MIPS();
479  __ break_(0x851);
480}
481
482
483void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
484  UNIMPLEMENTED_MIPS();
485  __ break_(0x857);
486}
487
488
489void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
490  UNIMPLEMENTED_MIPS();
491  __ break_(0x863);
492}
493
494
495const char* CompareStub::GetName() {
496  UNIMPLEMENTED_MIPS();
497  return NULL;  // UNIMPLEMENTED RETURN
498}
499
500
501int CompareStub::MinorKey() {
502  // Encode the two parameters in a unique 16 bit value.
503  ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15));
504  return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0);
505}
506
507
508#undef __
509
510} }  // namespace v8::internal
511