• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
42 namespace v8 {
43 namespace internal {
44 
45 #define __ ACCESS_MASM(masm_)
46 
47 
48 
49 // -------------------------------------------------------------------------
50 // Platform-specific DeferredCode functions.
51 
52 
SaveRegisters()53 void DeferredCode::SaveRegisters() {
54   UNIMPLEMENTED_MIPS();
55 }
56 
57 
RestoreRegisters()58 void DeferredCode::RestoreRegisters() {
59   UNIMPLEMENTED_MIPS();
60 }
61 
62 
63 // -------------------------------------------------------------------------
64 // CodeGenerator implementation
65 
CodeGenerator(MacroAssembler * masm)66 CodeGenerator::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 
Generate(CompilationInfo * info,Mode mode)84 void CodeGenerator::Generate(CompilationInfo* info, Mode mode) {
85   UNIMPLEMENTED_MIPS();
86 }
87 
88 
VisitStatements(ZoneList<Statement * > * statements)89 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
90   UNIMPLEMENTED_MIPS();
91 }
92 
93 
VisitBlock(Block * node)94 void CodeGenerator::VisitBlock(Block* node) {
95   UNIMPLEMENTED_MIPS();
96 }
97 
98 
DeclareGlobals(Handle<FixedArray> pairs)99 void CodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
100   UNIMPLEMENTED_MIPS();
101 }
102 
103 
VisitDeclaration(Declaration * node)104 void CodeGenerator::VisitDeclaration(Declaration* node) {
105   UNIMPLEMENTED_MIPS();
106 }
107 
108 
VisitExpressionStatement(ExpressionStatement * node)109 void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) {
110   UNIMPLEMENTED_MIPS();
111 }
112 
113 
VisitEmptyStatement(EmptyStatement * node)114 void CodeGenerator::VisitEmptyStatement(EmptyStatement* node) {
115   UNIMPLEMENTED_MIPS();
116 }
117 
118 
VisitIfStatement(IfStatement * node)119 void CodeGenerator::VisitIfStatement(IfStatement* node) {
120   UNIMPLEMENTED_MIPS();
121 }
122 
123 
VisitContinueStatement(ContinueStatement * node)124 void CodeGenerator::VisitContinueStatement(ContinueStatement* node) {
125   UNIMPLEMENTED_MIPS();
126 }
127 
128 
VisitBreakStatement(BreakStatement * node)129 void CodeGenerator::VisitBreakStatement(BreakStatement* node) {
130   UNIMPLEMENTED_MIPS();
131 }
132 
133 
VisitReturnStatement(ReturnStatement * node)134 void CodeGenerator::VisitReturnStatement(ReturnStatement* node) {
135   UNIMPLEMENTED_MIPS();
136 }
137 
138 
VisitWithEnterStatement(WithEnterStatement * node)139 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) {
140   UNIMPLEMENTED_MIPS();
141 }
142 
143 
VisitWithExitStatement(WithExitStatement * node)144 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) {
145   UNIMPLEMENTED_MIPS();
146 }
147 
148 
VisitSwitchStatement(SwitchStatement * node)149 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) {
150   UNIMPLEMENTED_MIPS();
151 }
152 
153 
VisitDoWhileStatement(DoWhileStatement * node)154 void CodeGenerator::VisitDoWhileStatement(DoWhileStatement* node) {
155   UNIMPLEMENTED_MIPS();
156 }
157 
158 
VisitWhileStatement(WhileStatement * node)159 void CodeGenerator::VisitWhileStatement(WhileStatement* node) {
160   UNIMPLEMENTED_MIPS();
161 }
162 
163 
VisitForStatement(ForStatement * node)164 void CodeGenerator::VisitForStatement(ForStatement* node) {
165   UNIMPLEMENTED_MIPS();
166 }
167 
168 
VisitForInStatement(ForInStatement * node)169 void CodeGenerator::VisitForInStatement(ForInStatement* node) {
170   UNIMPLEMENTED_MIPS();
171 }
172 
173 
VisitTryCatchStatement(TryCatchStatement * node)174 void CodeGenerator::VisitTryCatchStatement(TryCatchStatement* node) {
175   UNIMPLEMENTED_MIPS();
176 }
177 
178 
VisitTryFinallyStatement(TryFinallyStatement * node)179 void CodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* node) {
180   UNIMPLEMENTED_MIPS();
181 }
182 
183 
VisitDebuggerStatement(DebuggerStatement * node)184 void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) {
185   UNIMPLEMENTED_MIPS();
186 }
187 
188 
VisitFunctionLiteral(FunctionLiteral * node)189 void CodeGenerator::VisitFunctionLiteral(FunctionLiteral* node) {
190   UNIMPLEMENTED_MIPS();
191 }
192 
193 
VisitFunctionBoilerplateLiteral(FunctionBoilerplateLiteral * node)194 void CodeGenerator::VisitFunctionBoilerplateLiteral(
195     FunctionBoilerplateLiteral* node) {
196   UNIMPLEMENTED_MIPS();
197 }
198 
199 
VisitConditional(Conditional * node)200 void CodeGenerator::VisitConditional(Conditional* node) {
201   UNIMPLEMENTED_MIPS();
202 }
203 
204 
VisitSlot(Slot * node)205 void CodeGenerator::VisitSlot(Slot* node) {
206   UNIMPLEMENTED_MIPS();
207 }
208 
209 
VisitVariableProxy(VariableProxy * node)210 void CodeGenerator::VisitVariableProxy(VariableProxy* node) {
211   UNIMPLEMENTED_MIPS();
212 }
213 
214 
VisitLiteral(Literal * node)215 void CodeGenerator::VisitLiteral(Literal* node) {
216   UNIMPLEMENTED_MIPS();
217 }
218 
219 
VisitRegExpLiteral(RegExpLiteral * node)220 void CodeGenerator::VisitRegExpLiteral(RegExpLiteral* node) {
221   UNIMPLEMENTED_MIPS();
222 }
223 
224 
VisitObjectLiteral(ObjectLiteral * node)225 void CodeGenerator::VisitObjectLiteral(ObjectLiteral* node) {
226   UNIMPLEMENTED_MIPS();
227 }
228 
229 
VisitArrayLiteral(ArrayLiteral * node)230 void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
231   UNIMPLEMENTED_MIPS();
232 }
233 
234 
VisitCatchExtensionObject(CatchExtensionObject * node)235 void CodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* node) {
236   UNIMPLEMENTED_MIPS();
237 }
238 
239 
VisitAssignment(Assignment * node)240 void CodeGenerator::VisitAssignment(Assignment* node) {
241   UNIMPLEMENTED_MIPS();
242 }
243 
244 
VisitThrow(Throw * node)245 void CodeGenerator::VisitThrow(Throw* node) {
246   UNIMPLEMENTED_MIPS();
247 }
248 
249 
VisitProperty(Property * node)250 void CodeGenerator::VisitProperty(Property* node) {
251   UNIMPLEMENTED_MIPS();
252 }
253 
254 
VisitCall(Call * node)255 void CodeGenerator::VisitCall(Call* node) {
256   UNIMPLEMENTED_MIPS();
257 }
258 
259 
VisitCallNew(CallNew * node)260 void CodeGenerator::VisitCallNew(CallNew* node) {
261   UNIMPLEMENTED_MIPS();
262 }
263 
264 
GenerateClassOf(ZoneList<Expression * > * args)265 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) {
266   UNIMPLEMENTED_MIPS();
267 }
268 
269 
GenerateValueOf(ZoneList<Expression * > * args)270 void CodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) {
271   UNIMPLEMENTED_MIPS();
272 }
273 
274 
GenerateSetValueOf(ZoneList<Expression * > * args)275 void CodeGenerator::GenerateSetValueOf(ZoneList<Expression*>* args) {
276   UNIMPLEMENTED_MIPS();
277 }
278 
279 
GenerateIsSmi(ZoneList<Expression * > * args)280 void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
281   UNIMPLEMENTED_MIPS();
282 }
283 
284 
GenerateLog(ZoneList<Expression * > * args)285 void CodeGenerator::GenerateLog(ZoneList<Expression*>* args) {
286   UNIMPLEMENTED_MIPS();
287 }
288 
289 
GenerateIsNonNegativeSmi(ZoneList<Expression * > * args)290 void 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.
GenerateFastCharCodeAt(ZoneList<Expression * > * args)298 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
299   UNIMPLEMENTED_MIPS();
300 }
301 
302 
GenerateIsArray(ZoneList<Expression * > * args)303 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) {
304   UNIMPLEMENTED_MIPS();
305 }
306 
307 
GenerateIsRegExp(ZoneList<Expression * > * args)308 void CodeGenerator::GenerateIsRegExp(ZoneList<Expression*>* args) {
309   UNIMPLEMENTED_MIPS();
310 }
311 
312 
GenerateIsConstructCall(ZoneList<Expression * > * args)313 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
314   UNIMPLEMENTED_MIPS();
315 }
316 
317 
GenerateArgumentsLength(ZoneList<Expression * > * args)318 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
319   UNIMPLEMENTED_MIPS();
320 }
321 
322 
GenerateArgumentsAccess(ZoneList<Expression * > * args)323 void CodeGenerator::GenerateArgumentsAccess(ZoneList<Expression*>* args) {
324   UNIMPLEMENTED_MIPS();
325 }
326 
327 
GenerateRandomPositiveSmi(ZoneList<Expression * > * args)328 void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
329   UNIMPLEMENTED_MIPS();
330 }
331 
332 
GenerateObjectEquals(ZoneList<Expression * > * args)333 void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
334   UNIMPLEMENTED_MIPS();
335 }
336 
337 
GenerateIsObject(ZoneList<Expression * > * args)338 void CodeGenerator::GenerateIsObject(ZoneList<Expression*>* args) {
339   UNIMPLEMENTED_MIPS();
340 }
341 
342 
GenerateIsFunction(ZoneList<Expression * > * args)343 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
344   UNIMPLEMENTED_MIPS();
345 }
346 
347 
GenerateIsUndetectableObject(ZoneList<Expression * > * args)348 void CodeGenerator::GenerateIsUndetectableObject(ZoneList<Expression*>* args) {
349   UNIMPLEMENTED_MIPS();
350 }
351 
352 
GenerateStringAdd(ZoneList<Expression * > * args)353 void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) {
354   UNIMPLEMENTED_MIPS();
355 }
356 
357 
GenerateSubString(ZoneList<Expression * > * args)358 void CodeGenerator::GenerateSubString(ZoneList<Expression*>* args) {
359   UNIMPLEMENTED_MIPS();
360 }
361 
362 
GenerateStringCompare(ZoneList<Expression * > * args)363 void CodeGenerator::GenerateStringCompare(ZoneList<Expression*>* args) {
364   UNIMPLEMENTED_MIPS();
365 }
366 
367 
GenerateRegExpExec(ZoneList<Expression * > * args)368 void CodeGenerator::GenerateRegExpExec(ZoneList<Expression*>* args) {
369   UNIMPLEMENTED_MIPS();
370 }
371 
372 
GenerateNumberToString(ZoneList<Expression * > * args)373 void CodeGenerator::GenerateNumberToString(ZoneList<Expression*>* args) {
374   UNIMPLEMENTED_MIPS();
375 }
376 
377 
VisitCallRuntime(CallRuntime * node)378 void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
379   UNIMPLEMENTED_MIPS();
380 }
381 
382 
VisitUnaryOperation(UnaryOperation * node)383 void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
384   UNIMPLEMENTED_MIPS();
385 }
386 
387 
VisitCountOperation(CountOperation * node)388 void CodeGenerator::VisitCountOperation(CountOperation* node) {
389   UNIMPLEMENTED_MIPS();
390 }
391 
392 
VisitBinaryOperation(BinaryOperation * node)393 void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
394   UNIMPLEMENTED_MIPS();
395 }
396 
397 
VisitThisFunction(ThisFunction * node)398 void CodeGenerator::VisitThisFunction(ThisFunction* node) {
399   UNIMPLEMENTED_MIPS();
400 }
401 
402 
VisitCompareOperation(CompareOperation * node)403 void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
404   UNIMPLEMENTED_MIPS();
405 }
406 
407 
408 #ifdef DEBUG
HasValidEntryRegisters()409 bool 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.
Generate(MacroAssembler * masm)419 void CompareStub::Generate(MacroAssembler* masm) {
420   UNIMPLEMENTED_MIPS();
421   __ break_(0x765);
422 }
423 
424 
Generate(MacroAssembler * masm)425 void StackCheckStub::Generate(MacroAssembler* masm) {
426   UNIMPLEMENTED_MIPS();
427   __ break_(0x790);
428 }
429 
430 
GenerateThrowTOS(MacroAssembler * masm)431 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
432   UNIMPLEMENTED_MIPS();
433   __ break_(0x808);
434 }
435 
436 
GenerateThrowUncatchable(MacroAssembler * masm,UncatchableExceptionType type)437 void CEntryStub::GenerateThrowUncatchable(MacroAssembler* masm,
438                                           UncatchableExceptionType type) {
439   UNIMPLEMENTED_MIPS();
440   __ break_(0x815);
441 }
442 
GenerateCore(MacroAssembler * masm,Label * throw_normal_exception,Label * throw_termination_exception,Label * throw_out_of_memory_exception,bool do_gc,bool always_allocate)443 void 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 
Generate(MacroAssembler * masm)453 void CEntryStub::Generate(MacroAssembler* masm) {
454   UNIMPLEMENTED_MIPS();
455   __ break_(0x831);
456 }
457 
GenerateBody(MacroAssembler * masm,bool is_construct)458 void 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).
Generate(MacroAssembler * masm)471 void InstanceofStub::Generate(MacroAssembler* masm) {
472   UNIMPLEMENTED_MIPS();
473   __ break_(0x845);
474 }
475 
476 
GenerateReadLength(MacroAssembler * masm)477 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
478   UNIMPLEMENTED_MIPS();
479   __ break_(0x851);
480 }
481 
482 
GenerateReadElement(MacroAssembler * masm)483 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
484   UNIMPLEMENTED_MIPS();
485   __ break_(0x857);
486 }
487 
488 
GenerateNewObject(MacroAssembler * masm)489 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
490   UNIMPLEMENTED_MIPS();
491   __ break_(0x863);
492 }
493 
494 
GetName()495 const char* CompareStub::GetName() {
496   UNIMPLEMENTED_MIPS();
497   return NULL;  // UNIMPLEMENTED RETURN
498 }
499 
500 
MinorKey()501 int 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