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

Side by Side Diff: src/mips/fast-codegen-mips.cc

Issue 549079: Support for MIPS in architecture independent files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 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
OLDNEW
(Empty)
1 // Copyright 2009 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 #include "v8.h"
29
30 #include "codegen-inl.h"
31 #include "fast-codegen.h"
32
33 namespace v8 {
34 namespace internal {
35
36 #define __ ACCESS_MASM(masm_)
37
38 // Generate code for a JS function. On entry to the function the receiver
39 // and arguments have been pushed on the stack left to right. The actual
40 // argument count matches the formal parameter count expected by the
41 // function.
42 //
43 // The live registers are:
44 // o r1: the JS function object being called (ie, ourselves)
45 // o cp: our context
46 // o fp: our caller's frame pointer
47 // o sp: stack pointer
48 // o lr: return address
49 //
50 // The function builds a JS frame. Please see JavaScriptFrameConstants in
51 // frames-arm.h for its layout.
52 void FastCodeGenerator::Generate(FunctionLiteral* fun) {
53 UNIMPLEMENTED();
54 // function_ = fun;
55 // SetFunctionPosition(fun);
56 //
57 // __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
58 // // Adjust fp to point to caller's fp.
59 // __ add(fp, sp, Operand(2 * kPointerSize));
60 //
61 // { Comment cmnt(masm_, "[ Allocate locals");
62 // int locals_count = fun->scope()->num_stack_slots();
63 // if (locals_count > 0) {
64 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
65 // }
66 // __ LoadRoot(r2, Heap::kStackLimitRootIndex);
67 // for (int i = 0; i < locals_count; i++) {
68 // __ push(ip);
69 // }
70 // }
71 //
72 // // Check the stack for overflow or break request.
73 // // Put the lr setup instruction in the delay slot. The kInstrSize is
74 // // added to the implicit 8 byte offset that always applies to operations
75 // // with pc and gives a return address 12 bytes down.
76 // Comment cmnt(masm_, "[ Stack check");
77 // __ add(lr, pc, Operand(Assembler::kInstrSize));
78 // __ cmp(sp, Operand(r2));
79 // StackCheckStub stub;
80 // __ mov(pc,
81 // Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
82 // RelocInfo::CODE_TARGET),
83 // LeaveCC,
84 // lo);
85 //
86 // { Comment cmnt(masm_, "[ Declarations");
87 // VisitDeclarations(fun->scope()->declarations());
88 // }
89 //
90 // if (FLAG_trace) {
91 // __ CallRuntime(Runtime::kTraceEnter, 0);
92 // }
93 //
94 // { Comment cmnt(masm_, "[ Body");
95 // ASSERT(loop_depth() == 0);
96 // VisitStatements(fun->body());
97 // ASSERT(loop_depth() == 0);
98 // }
99 //
100 // { Comment cmnt(masm_, "[ return <undefined>;");
101 // // Emit a 'return undefined' in case control fell off the end of the
102 // // body.
103 // __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
104 // }
105 // EmitReturnSequence(function_->end_position());
106 }
107
108
109 void FastCodeGenerator::EmitReturnSequence(int position) {
110 UNIMPLEMENTED();
111 // Comment cmnt(masm_, "[ Return sequence");
112 // if (return_label_.is_bound()) {
113 // __ b(&return_label_);
114 // } else {
115 // __ bind(&return_label_);
116 // if (FLAG_trace) {
117 // // Push the return value on the stack as the parameter.
118 // // Runtime::TraceExit returns its parameter in r0.
119 // __ push(r0);
120 // __ CallRuntime(Runtime::kTraceExit, 1);
121 // }
122 //
123 // // Add a label for checking the size of the code used for returning.
124 // Label check_exit_codesize;
125 // masm_->bind(&check_exit_codesize);
126 //
127 // // Calculate the exact length of the return sequence and make sure that
128 // // the constant pool is not emitted inside of the return sequence.
129 // int num_parameters = function_->scope()->num_parameters();
130 // int32_t sp_delta = (num_parameters + 1) * kPointerSize;
131 // int return_sequence_length = Debug::kARMJSReturnSequenceLength;
132 // if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
133 // // Additional mov instruction generated.
134 // return_sequence_length++;
135 // }
136 // masm_->BlockConstPoolFor(return_sequence_length);
137 //
138 // CodeGenerator::RecordPositions(masm_, position);
139 // __ RecordJSReturn();
140 // __ mov(sp, fp);
141 // __ ldm(ia_w, sp, fp.bit() | lr.bit());
142 // __ add(sp, sp, Operand(sp_delta));
143 // __ Jump(lr);
144 //
145 // // Check that the size of the code used for returning matches what is
146 // // expected by the debugger. The add instruction above is an addressing
147 // // mode 1 instruction where there are restrictions on which immediate valu es
148 // // can be encoded in the instruction and which immediate values requires
149 // // use of an additional instruction for moving the immediate to a temporar y
150 // // register.
151 // ASSERT_EQ(return_sequence_length,
152 // masm_->InstructionsGeneratedSince(&check_exit_codesize));
153 // }
154 }
155
156
157 void FastCodeGenerator::Move(Expression::Context context, Register source) {
158 UNIMPLEMENTED();
159 // switch (context) {
160 // case Expression::kUninitialized:
161 // UNREACHABLE();
162 // case Expression::kEffect:
163 // break;
164 // case Expression::kValue:
165 // __ push(source);
166 // break;
167 // case Expression::kTest:
168 // TestAndBranch(source, true_label_, false_label_);
169 // break;
170 // case Expression::kValueTest: {
171 // Label discard;
172 // __ push(source);
173 // TestAndBranch(source, true_label_, &discard);
174 // __ bind(&discard);
175 // __ pop();
176 // __ jmp(false_label_);
177 // break;
178 // }
179 // case Expression::kTestValue: {
180 // Label discard;
181 // __ push(source);
182 // TestAndBranch(source, &discard, false_label_);
183 // __ bind(&discard);
184 // __ pop();
185 // __ jmp(true_label_);
186 // }
187 // }
188 }
189
190
191 void FastCodeGenerator::Move(Expression::Context context, Slot* source) {
192 UNIMPLEMENTED();
193 // switch (context) {
194 // case Expression::kUninitialized:
195 // UNREACHABLE();
196 // case Expression::kEffect:
197 // break;
198 // case Expression::kValue: // Fall through.
199 // case Expression::kTest: // Fall through.
200 // case Expression::kValueTest: // Fall through.
201 // case Expression::kTestValue:
202 // __ ldr(ip, MemOperand(fp, SlotOffset(source)));
203 // Move(context, ip);
204 // break;
205 // }
206 }
207
208
209 void FastCodeGenerator::Move(Expression::Context context, Literal* expr) {
210 UNIMPLEMENTED();
211 // switch (context) {
212 // case Expression::kUninitialized:
213 // UNREACHABLE();
214 // case Expression::kEffect:
215 // break;
216 // case Expression::kValue: // Fall through.
217 // case Expression::kTest: // Fall through.
218 // case Expression::kValueTest: // Fall through.
219 // case Expression::kTestValue:
220 // __ mov(ip, Operand(expr->handle()));
221 // Move(context, ip);
222 // break;
223 // }
224 }
225
226
227 void FastCodeGenerator::DropAndMove(Expression::Context context,
228 Register source) {
229 UNIMPLEMENTED();
230 // switch (context) {
231 // case Expression::kUninitialized:
232 // UNREACHABLE();
233 // case Expression::kEffect:
234 // __ pop();
235 // break;
236 // case Expression::kValue:
237 // __ str(source, MemOperand(sp));
238 // break;
239 // case Expression::kTest:
240 // ASSERT(!source.is(sp));
241 // __ pop();
242 // TestAndBranch(source, true_label_, false_label_);
243 // break;
244 // case Expression::kValueTest: {
245 // Label discard;
246 // __ str(source, MemOperand(sp));
247 // TestAndBranch(source, true_label_, &discard);
248 // __ bind(&discard);
249 // __ pop();
250 // __ jmp(false_label_);
251 // break;
252 // }
253 // case Expression::kTestValue: {
254 // Label discard;
255 // __ str(source, MemOperand(sp));
256 // TestAndBranch(source, &discard, false_label_);
257 // __ bind(&discard);
258 // __ pop();
259 // __ jmp(true_label_);
260 // break;
261 // }
262 // }
263 }
264
265
266 void FastCodeGenerator::TestAndBranch(Register source,
267 Label* true_label,
268 Label* false_label) {
269 UNIMPLEMENTED();
270 // ASSERT_NE(NULL, true_label);
271 // ASSERT_NE(NULL, false_label);
272 // // Call the runtime to find the boolean value of the source and then
273 // // translate it into control flow to the pair of labels.
274 // __ push(source);
275 // __ CallRuntime(Runtime::kToBool, 1);
276 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
277 // __ cmp(r0, ip);
278 // __ b(eq, true_label);
279 // __ jmp(false_label);
280 }
281
282
283 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
284 UNIMPLEMENTED();
285 // // Call the runtime to declare the globals.
286 // // The context is the first argument.
287 // __ mov(r1, Operand(pairs));
288 // __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0)));
289 // __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit());
290 // __ CallRuntime(Runtime::kDeclareGlobals, 3);
291 // // Return value is ignored.
292 }
293
294
295 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
296 UNIMPLEMENTED();
297 // Comment cmnt(masm_, "[ ReturnStatement");
298 // Expression* expr = stmt->expression();
299 // // Complete the statement based on the type of the subexpression.
300 // if (expr->AsLiteral() != NULL) {
301 // __ mov(r0, Operand(expr->AsLiteral()->handle()));
302 // } else {
303 // ASSERT_EQ(Expression::kValue, expr->context());
304 // Visit(expr);
305 // __ pop(r0);
306 // }
307 // EmitReturnSequence(stmt->statement_pos());
308 }
309
310
311 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
312 UNIMPLEMENTED();
313 // Comment cmnt(masm_, "[ FunctionLiteral");
314 //
315 // // Build the function boilerplate and instantiate it.
316 // Handle<JSFunction> boilerplate =
317 // Compiler::BuildBoilerplate(expr, script_, this);
318 // if (HasStackOverflow()) return;
319 //
320 // ASSERT(boilerplate->IsBoilerplate());
321 //
322 // // Create a new closure.
323 // __ mov(r0, Operand(boilerplate));
324 // __ stm(db_w, sp, cp.bit() | r0.bit());
325 // __ CallRuntime(Runtime::kNewClosure, 2);
326 // Move(expr->context(), r0);
327 }
328
329
330 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
331 UNIMPLEMENTED();
332 // Comment cmnt(masm_, "[ VariableProxy");
333 // Expression* rewrite = expr->var()->rewrite();
334 // if (rewrite == NULL) {
335 // Comment cmnt(masm_, "Global variable");
336 // // Use inline caching. Variable name is passed in r2 and the global
337 // // object on the stack.
338 // __ ldr(ip, CodeGenerator::GlobalObject());
339 // __ push(ip);
340 // __ mov(r2, Operand(expr->name()));
341 // Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
342 // __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
343 // DropAndMove(expr->context(), r0);
344 // } else {
345 // Comment cmnt(masm_, "Stack slot");
346 // Move(expr->context(), rewrite->AsSlot());
347 // }
348 }
349
350
351 void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
352 UNIMPLEMENTED();
353 // Comment cmnt(masm_, "[ RegExpLiteral");
354 // Label done;
355 // // Registers will be used as follows:
356 // // r4 = JS function, literals array
357 // // r3 = literal index
358 // // r2 = RegExp pattern
359 // // r1 = RegExp flags
360 // // r0 = temp + return value (RegExp literal)
361 // __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
362 // __ ldr(r4, FieldMemOperand(r0, JSFunction::kLiteralsOffset));
363 // int literal_offset =
364 // FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
365 // __ ldr(r0, FieldMemOperand(r4, literal_offset));
366 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
367 // __ cmp(r0, ip);
368 // __ b(ne, &done);
369 // __ mov(r3, Operand(Smi::FromInt(expr->literal_index())));
370 // __ mov(r2, Operand(expr->pattern()));
371 // __ mov(r1, Operand(expr->flags()));
372 // __ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit());
373 // __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4);
374 // __ bind(&done);
375 // Move(expr->context(), r0);
376 }
377
378
379 void FastCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
380 UNIMPLEMENTED();
381 // Comment cmnt(masm_, "[ ObjectLiteral");
382 // Label boilerplate_exists;
383 // __ ldr(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
384 // // r2 = literal array (0).
385 // __ ldr(r2, FieldMemOperand(r2, JSFunction::kLiteralsOffset));
386 // int literal_offset =
387 // FixedArray::kHeaderSize + expr->literal_index() * kPointerSize;
388 // __ ldr(r0, FieldMemOperand(r2, literal_offset));
389 // // Check whether we need to materialize the object literal boilerplate.
390 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
391 // __ cmp(r0, Operand(ip));
392 // __ b(ne, &boilerplate_exists);
393 // // Create boilerplate if it does not exist.
394 // // r1 = literal index (1).
395 // __ mov(r1, Operand(Smi::FromInt(expr->literal_index())));
396 // // r0 = constant properties (2).
397 // __ mov(r0, Operand(expr->constant_properties()));
398 // __ stm(db_w, sp, r2.bit() | r1.bit() | r0.bit());
399 // __ CallRuntime(Runtime::kCreateObjectLiteralBoilerplate, 3);
400 // __ bind(&boilerplate_exists);
401 // // r0 contains boilerplate.
402 // // Clone boilerplate.
403 // __ push(r0);
404 // if (expr->depth() > 1) {
405 // __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1);
406 // } else {
407 // __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1);
408 // }
409 //
410 // // If result_saved == true: the result is saved on top of the stack.
411 // // If result_saved == false: the result is in r0.
412 // bool result_saved = false;
413 //
414 // for (int i = 0; i < expr->properties()->length(); i++) {
415 // ObjectLiteral::Property* property = expr->properties()->at(i);
416 // if (property->IsCompileTimeValue()) continue;
417 //
418 // Literal* key = property->key();
419 // Expression* value = property->value();
420 // if (!result_saved) {
421 // __ push(r0); // Save result on stack
422 // result_saved = true;
423 // }
424 // switch (property->kind()) {
425 // case ObjectLiteral::Property::CONSTANT:
426 // UNREACHABLE();
427 //
428 // case ObjectLiteral::Property::MATERIALIZED_LITERAL: // Fall through.
429 // ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
430 // case ObjectLiteral::Property::COMPUTED:
431 // if (key->handle()->IsSymbol()) {
432 // Visit(value);
433 // ASSERT_EQ(Expression::kValue, value->context());
434 // __ pop(r0);
435 // __ mov(r2, Operand(key->handle()));
436 // Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
437 // __ Call(ic, RelocInfo::CODE_TARGET);
438 // // StoreIC leaves the receiver on the stack.
439 // break;
440 // }
441 // // Fall through.
442 //
443 // case ObjectLiteral::Property::PROTOTYPE:
444 // __ push(r0);
445 // Visit(key);
446 // ASSERT_EQ(Expression::kValue, key->context());
447 // Visit(value);
448 // ASSERT_EQ(Expression::kValue, value->context());
449 // __ CallRuntime(Runtime::kSetProperty, 3);
450 // __ ldr(r0, MemOperand(sp)); // Restore result into r0
451 // break;
452 //
453 // case ObjectLiteral::Property::GETTER: // Fall through.
454 // case ObjectLiteral::Property::SETTER:
455 // __ push(r0);
456 // Visit(key);
457 // ASSERT_EQ(Expression::kValue, key->context());
458 // __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ?
459 // Smi::FromInt(1) :
460 // Smi::FromInt(0)));
461 // __ push(r1);
462 // Visit(value);
463 // ASSERT_EQ(Expression::kValue, value->context());
464 // __ CallRuntime(Runtime::kDefineAccessor, 4);
465 // __ ldr(r0, MemOperand(sp)); // Restore result into r0
466 // break;
467 // }
468 // }
469 // switch (expr->context()) {
470 // case Expression::kUninitialized:
471 // UNREACHABLE();
472 // case Expression::kEffect:
473 // if (result_saved) __ pop();
474 // break;
475 // case Expression::kValue:
476 // if (!result_saved) __ push(r0);
477 // break;
478 // case Expression::kTest:
479 // if (result_saved) __ pop(r0);
480 // TestAndBranch(r0, true_label_, false_label_);
481 // break;
482 // case Expression::kValueTest: {
483 // Label discard;
484 // if (!result_saved) __ push(r0);
485 // TestAndBranch(r0, true_label_, &discard);
486 // __ bind(&discard);
487 // __ pop();
488 // __ jmp(false_label_);
489 // break;
490 // }
491 // case Expression::kTestValue: {
492 // Label discard;
493 // if (!result_saved) __ push(r0);
494 // TestAndBranch(r0, &discard, false_label_);
495 // __ bind(&discard);
496 // __ pop();
497 // __ jmp(true_label_);
498 // break;
499 // }
500 // }
501 }
502
503
504 void FastCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
505 UNIMPLEMENTED();
506 // Comment cmnt(masm_, "[ ArrayLiteral");
507 // Label make_clone;
508 //
509 // // Fetch the function's literals array.
510 // __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
511 // __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
512 // // Check if the literal's boilerplate has been instantiated.
513 // int offset =
514 // FixedArray::kHeaderSize + (expr->literal_index() * kPointerSize);
515 // __ ldr(r0, FieldMemOperand(r3, offset));
516 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
517 // __ cmp(r0, ip);
518 // __ b(&make_clone, ne);
519 //
520 // // Instantiate the boilerplate.
521 // __ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
522 // __ mov(r1, Operand(expr->literals()));
523 // __ stm(db_w, sp, r3.bit() | r2.bit() | r1.bit());
524 // __ CallRuntime(Runtime::kCreateArrayLiteralBoilerplate, 3);
525 //
526 // __ bind(&make_clone);
527 // // Clone the boilerplate.
528 // __ push(r0);
529 // if (expr->depth() > 1) {
530 // __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1);
531 // } else {
532 // __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1);
533 // }
534 //
535 // bool result_saved = false; // Is the result saved to the stack?
536 //
537 // // Emit code to evaluate all the non-constant subexpressions and to store
538 // // them into the newly cloned array.
539 // ZoneList<Expression*>* subexprs = expr->values();
540 // for (int i = 0, len = subexprs->length(); i < len; i++) {
541 // Expression* subexpr = subexprs->at(i);
542 // // If the subexpression is a literal or a simple materialized literal it
543 // // is already set in the cloned array.
544 // if (subexpr->AsLiteral() != NULL ||
545 // CompileTimeValue::IsCompileTimeValue(subexpr)) {
546 // continue;
547 // }
548 //
549 // if (!result_saved) {
550 // __ push(r0);
551 // result_saved = true;
552 // }
553 // Visit(subexpr);
554 // ASSERT_EQ(Expression::kValue, subexpr->context());
555 //
556 // // Store the subexpression value in the array's elements.
557 // __ pop(r0); // Subexpression value.
558 // __ ldr(r1, MemOperand(sp)); // Copy of array literal.
559 // __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset));
560 // int offset = FixedArray::kHeaderSize + (i * kPointerSize);
561 // __ str(r0, FieldMemOperand(r1, offset));
562 //
563 // // Update the write barrier for the array store with r0 as the scratch
564 // // register.
565 // __ mov(r2, Operand(offset));
566 // __ RecordWrite(r1, r2, r0);
567 // }
568 //
569 // switch (expr->context()) {
570 // case Expression::kUninitialized:
571 // UNREACHABLE();
572 // case Expression::kEffect:
573 // if (result_saved) __ pop();
574 // break;
575 // case Expression::kValue:
576 // if (!result_saved) __ push(r0);
577 // break;
578 // case Expression::kTest:
579 // if (result_saved) __ pop(r0);
580 // TestAndBranch(r0, true_label_, false_label_);
581 // break;
582 // case Expression::kValueTest: {
583 // Label discard;
584 // if (!result_saved) __ push(r0);
585 // TestAndBranch(r0, true_label_, &discard);
586 // __ bind(&discard);
587 // __ pop();
588 // __ jmp(false_label_);
589 // break;
590 // }
591 // case Expression::kTestValue: {
592 // Label discard;
593 // if (!result_saved) __ push(r0);
594 // TestAndBranch(r0, &discard, false_label_);
595 // __ bind(&discard);
596 // __ pop();
597 // __ jmp(true_label_);
598 // break;
599 // }
600 // }
601 }
602
603
604 void FastCodeGenerator::EmitVariableAssignment(Assignment* expr) {
605 UNIMPLEMENTED();
606 // Variable* var = expr->target()->AsVariableProxy()->AsVariable();
607 // ASSERT(var != NULL);
608 //
609 // if (var->is_global()) {
610 // // Assignment to a global variable. Use inline caching for the
611 // // assignment. Right-hand-side value is passed in r0, variable name in
612 // // r2, and the global object on the stack.
613 // __ pop(r0);
614 // __ mov(r2, Operand(var->name()));
615 // __ ldr(ip, CodeGenerator::GlobalObject());
616 // __ push(ip);
617 // Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
618 // __ Call(ic, RelocInfo::CODE_TARGET);
619 // // Overwrite the global object on the stack with the result if needed.
620 // DropAndMove(expr->context(), r0);
621 //
622 // } else {
623 // switch (expr->context()) {
624 // case Expression::kUninitialized:
625 // UNREACHABLE();
626 // case Expression::kEffect:
627 // // Perform assignment and discard value.
628 // __ pop(r0);
629 // __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
630 // break;
631 // case Expression::kValue:
632 // // Perform assignment and preserve value.
633 // __ ldr(r0, MemOperand(sp));
634 // __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
635 // break;
636 // case Expression::kTest:
637 // // Perform assignment and test (and discard) value.
638 // __ pop(r0);
639 // __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
640 // TestAndBranch(r0, true_label_, false_label_);
641 // break;
642 // case Expression::kValueTest: {
643 // Label discard;
644 // __ ldr(r0, MemOperand(sp));
645 // __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
646 // TestAndBranch(r0, true_label_, &discard);
647 // __ bind(&discard);
648 // __ pop();
649 // __ jmp(false_label_);
650 // break;
651 // }
652 // case Expression::kTestValue: {
653 // Label discard;
654 // __ ldr(r0, MemOperand(sp));
655 // __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
656 // TestAndBranch(r0, &discard, false_label_);
657 // __ bind(&discard);
658 // __ pop();
659 // __ jmp(true_label_);
660 // break;
661 // }
662 // }
663 // }
664 }
665
666
667 void FastCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
668 UNIMPLEMENTED();
669 // // Assignment to a property, using a named store IC.
670 // Property* prop = expr->target()->AsProperty();
671 // ASSERT(prop != NULL);
672 // ASSERT(prop->key()->AsLiteral() != NULL);
673 //
674 // // If the assignment starts a block of assignments to the same object,
675 // // change to slow case to avoid the quadratic behavior of repeatedly
676 // // adding fast properties.
677 // if (expr->starts_initialization_block()) {
678 // __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is under value.
679 // __ push(ip);
680 // __ CallRuntime(Runtime::kToSlowProperties, 1);
681 // }
682 //
683 // __ pop(r0);
684 // __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
685 // Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
686 // __ Call(ic, RelocInfo::CODE_TARGET);
687 //
688 // // If the assignment ends an initialization block, revert to fast case.
689 // if (expr->ends_initialization_block()) {
690 // __ push(r0); // Result of assignment, saved even if not needed.
691 // __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is under value.
692 // __ push(ip);
693 // __ CallRuntime(Runtime::kToFastProperties, 1);
694 // __ pop(r0);
695 // }
696 //
697 // DropAndMove(expr->context(), r0);
698 }
699
700
701 void FastCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
702 UNIMPLEMENTED();
703 // // Assignment to a property, using a keyed store IC.
704 //
705 // // If the assignment starts a block of assignments to the same object,
706 // // change to slow case to avoid the quadratic behavior of repeatedly
707 // // adding fast properties.
708 // if (expr->starts_initialization_block()) {
709 // // Reciever is under the key and value.
710 // __ ldr(ip, MemOperand(sp, 2 * kPointerSize));
711 // __ push(ip);
712 // __ CallRuntime(Runtime::kToSlowProperties, 1);
713 // }
714 //
715 // __ pop(r0);
716 // Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
717 // __ Call(ic, RelocInfo::CODE_TARGET);
718 //
719 // // If the assignment ends an initialization block, revert to fast case.
720 // if (expr->ends_initialization_block()) {
721 // __ push(r0); // Result of assignment, saved even if not needed.
722 // // Reciever is under the key and value.
723 // __ ldr(ip, MemOperand(sp, 2 * kPointerSize));
724 // __ push(ip);
725 // __ CallRuntime(Runtime::kToFastProperties, 1);
726 // __ pop(r0);
727 // }
728 //
729 // // Receiver and key are still on stack.
730 // __ add(sp, sp, Operand(2 * kPointerSize));
731 // Move(expr->context(), r0);
732 }
733
734
735 void FastCodeGenerator::VisitProperty(Property* expr) {
736 UNIMPLEMENTED();
737 // Comment cmnt(masm_, "[ Property");
738 // Expression* key = expr->key();
739 // uint32_t dummy;
740 //
741 // // Record the source position for the property load.
742 // SetSourcePosition(expr->position());
743 //
744 // // Evaluate receiver.
745 // Visit(expr->obj());
746 //
747 // if (key->AsLiteral() != NULL && key->AsLiteral()->handle()->IsSymbol() &&
748 // !String::cast(*(key->AsLiteral()->handle()))->AsArrayIndex(&dummy)) {
749 // // Do a NAMED property load.
750 // // The IC expects the property name in ecx and the receiver on the stack.
751 // __ mov(r2, Operand(key->AsLiteral()->handle()));
752 // Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
753 // __ Call(ic, RelocInfo::CODE_TARGET);
754 // } else {
755 // // Do a KEYED property load.
756 // Visit(expr->key());
757 // Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
758 // __ Call(ic, RelocInfo::CODE_TARGET);
759 // // Drop key and receiver left on the stack by IC.
760 // __ pop();
761 // }
762 // DropAndMove(expr->context(), r0);
763 }
764
765 void FastCodeGenerator::EmitCallWithIC(Call* expr, RelocInfo::Mode reloc_info) {
766 UNIMPLEMENTED();
767 // // Code common for calls using the IC.
768 // ZoneList<Expression*>* args = expr->arguments();
769 // int arg_count = args->length();
770 // for (int i = 0; i < arg_count; i++) {
771 // Visit(args->at(i));
772 // ASSERT_EQ(Expression::kValue, args->at(i)->context());
773 // }
774 // // Record source position for debugger.
775 // SetSourcePosition(expr->position());
776 // // Call the IC initialization code.
777 // Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count,
778 // NOT_IN_LOOP);
779 // __ Call(ic, reloc_info);
780 // // Restore context register.
781 // __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
782 // // Discard the function left on TOS.
783 // DropAndMove(expr->context(), r0);
784 }
785
786
787 void FastCodeGenerator::EmitCallWithStub(Call* expr) {
788 UNIMPLEMENTED();
789 // // Code common for calls using the call stub.
790 // ZoneList<Expression*>* args = expr->arguments();
791 // int arg_count = args->length();
792 // for (int i = 0; i < arg_count; i++) {
793 // Visit(args->at(i));
794 // }
795 // // Record source position for debugger.
796 // SetSourcePosition(expr->position());
797 // CallFunctionStub stub(arg_count, NOT_IN_LOOP);
798 // __ CallStub(&stub);
799 // // Restore context register.
800 // __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
801 // // Discard the function left on TOS.
802 // DropAndMove(expr->context(), r0);
803 }
804
805
806 void FastCodeGenerator::VisitCall(Call* expr) {
807 UNIMPLEMENTED();
808 // Comment cmnt(masm_, "[ Call");
809 // Expression* fun = expr->expression();
810 // Variable* var = fun->AsVariableProxy()->AsVariable();
811 //
812 // if (var != NULL && var->is_possibly_eval()) {
813 // // Call to the identifier 'eval'.
814 // UNREACHABLE();
815 // } else if (var != NULL && !var->is_this() && var->is_global()) {
816 // // Call to a global variable.
817 // __ mov(r1, Operand(var->name()));
818 // // Push global object as receiver for the call IC lookup.
819 // __ ldr(r0, CodeGenerator::GlobalObject());
820 // __ stm(db_w, sp, r1.bit() | r0.bit());
821 // EmitCallWithIC(expr, RelocInfo::CODE_TARGET_CONTEXT);
822 // } else if (var != NULL && var->slot() != NULL &&
823 // var->slot()->type() == Slot::LOOKUP) {
824 // // Call to a lookup slot.
825 // UNREACHABLE();
826 // } else if (fun->AsProperty() != NULL) {
827 // // Call to an object property.
828 // Property* prop = fun->AsProperty();
829 // Literal* key = prop->key()->AsLiteral();
830 // if (key != NULL && key->handle()->IsSymbol()) {
831 // // Call to a named property, use call IC.
832 // __ mov(r0, Operand(key->handle()));
833 // __ push(r0);
834 // Visit(prop->obj());
835 // EmitCallWithIC(expr, RelocInfo::CODE_TARGET);
836 // } else {
837 // // Call to a keyed property, use keyed load IC followed by function
838 // // call.
839 // Visit(prop->obj());
840 // Visit(prop->key());
841 // // Record source code position for IC call.
842 // SetSourcePosition(prop->position());
843 // Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
844 // __ Call(ic, RelocInfo::CODE_TARGET);
845 // // Load receiver object into r1.
846 // if (prop->is_synthetic()) {
847 // __ ldr(r1, CodeGenerator::GlobalObject());
848 // } else {
849 // __ ldr(r1, MemOperand(sp, kPointerSize));
850 // }
851 // // Overwrite (object, key) with (function, receiver).
852 // __ str(r0, MemOperand(sp, kPointerSize));
853 // __ str(r1, MemOperand(sp));
854 // EmitCallWithStub(expr);
855 // }
856 // } else {
857 // // Call to some other expression. If the expression is an anonymous
858 // // function literal not called in a loop, mark it as one that should
859 // // also use the fast code generator.
860 // FunctionLiteral* lit = fun->AsFunctionLiteral();
861 // if (lit != NULL &&
862 // lit->name()->Equals(Heap::empty_string()) &&
863 // loop_depth() == 0) {
864 // lit->set_try_fast_codegen(true);
865 // }
866 // Visit(fun);
867 // // Load global receiver object.
868 // __ ldr(r1, CodeGenerator::GlobalObject());
869 // __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
870 // __ push(r1);
871 // // Emit function call.
872 // EmitCallWithStub(expr);
873 // }
874 }
875
876
877 void FastCodeGenerator::VisitCallNew(CallNew* expr) {
878 UNIMPLEMENTED();
879 // Comment cmnt(masm_, "[ CallNew");
880 // // According to ECMA-262, section 11.2.2, page 44, the function
881 // // expression in new calls must be evaluated before the
882 // // arguments.
883 // // Push function on the stack.
884 // Visit(expr->expression());
885 // ASSERT_EQ(Expression::kValue, expr->expression()->context());
886 //
887 // // Push global object (receiver).
888 // __ ldr(r0, CodeGenerator::GlobalObject());
889 // __ push(r0);
890 // // Push the arguments ("left-to-right") on the stack.
891 // ZoneList<Expression*>* args = expr->arguments();
892 // int arg_count = args->length();
893 // for (int i = 0; i < arg_count; i++) {
894 // Visit(args->at(i));
895 // ASSERT_EQ(Expression::kValue, args->at(i)->context());
896 // // If location is value, it is already on the stack,
897 // // so nothing to do here.
898 // }
899 //
900 // // Call the construct call builtin that handles allocation and
901 // // constructor invocation.
902 // SetSourcePosition(expr->position());
903 //
904 // // Load function, arg_count into r1 and r0.
905 // __ mov(r0, Operand(arg_count));
906 // // Function is in esp[arg_count + 1].
907 // __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
908 //
909 // Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall)) ;
910 // __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
911 //
912 // // Replace function on TOS with result in r0, or pop it.
913 // DropAndMove(expr->context(), r0);
914 }
915
916
917 void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
918 UNIMPLEMENTED();
919 // Comment cmnt(masm_, "[ CallRuntime");
920 // ZoneList<Expression*>* args = expr->arguments();
921 // Runtime::Function* function = expr->function();
922 //
923 // ASSERT(function != NULL);
924 //
925 // // Push the arguments ("left-to-right").
926 // int arg_count = args->length();
927 // for (int i = 0; i < arg_count; i++) {
928 // Visit(args->at(i));
929 // ASSERT_EQ(Expression::kValue, args->at(i)->context());
930 // }
931 //
932 // __ CallRuntime(function, arg_count);
933 // Move(expr->context(), r0);
934 }
935
936
937 void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
938 UNIMPLEMENTED();
939 // Comment cmnt(masm_, "[ UnaryOperation");
940 // switch (expr->op()) {
941 // case Token::VOID:
942 // Visit(expr->expression());
943 // ASSERT_EQ(Expression::kEffect, expr->expression()->context());
944 // switch (expr->context()) {
945 // case Expression::kUninitialized:
946 // UNREACHABLE();
947 // break;
948 // case Expression::kEffect:
949 // break;
950 // case Expression::kValue:
951 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
952 // __ push(ip);
953 // break;
954 // case Expression::kTestValue:
955 // // Value is false so it's needed.
956 // __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
957 // __ push(ip);
958 // case Expression::kTest: // Fall through.
959 // case Expression::kValueTest:
960 // __ jmp(false_label_);
961 // break;
962 // }
963 // break;
964 //
965 // case Token::NOT: {
966 // ASSERT_EQ(Expression::kTest, expr->expression()->context());
967 //
968 // Label push_true;
969 // Label push_false;
970 // Label done;
971 // Label* saved_true = true_label_;
972 // Label* saved_false = false_label_;
973 // switch (expr->context()) {
974 // case Expression::kUninitialized:
975 // UNREACHABLE();
976 // break;
977 //
978 // case Expression::kValue:
979 // true_label_ = &push_false;
980 // false_label_ = &push_true;
981 // Visit(expr->expression());
982 // __ bind(&push_true);
983 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
984 // __ push(ip);
985 // __ jmp(&done);
986 // __ bind(&push_false);
987 // __ LoadRoot(ip, Heap::kFalseValueRootIndex);
988 // __ push(ip);
989 // __ bind(&done);
990 // break;
991 //
992 // case Expression::kEffect:
993 // true_label_ = &done;
994 // false_label_ = &done;
995 // Visit(expr->expression());
996 // __ bind(&done);
997 // break;
998 //
999 // case Expression::kTest:
1000 // true_label_ = saved_false;
1001 // false_label_ = saved_true;
1002 // Visit(expr->expression());
1003 // break;
1004 //
1005 // case Expression::kValueTest:
1006 // true_label_ = saved_false;
1007 // false_label_ = &push_true;
1008 // Visit(expr->expression());
1009 // __ bind(&push_true);
1010 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1011 // __ push(ip);
1012 // __ jmp(saved_true);
1013 // break;
1014 //
1015 // case Expression::kTestValue:
1016 // true_label_ = &push_false;
1017 // false_label_ = saved_true;
1018 // Visit(expr->expression());
1019 // __ bind(&push_false);
1020 // __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1021 // __ push(ip);
1022 // __ jmp(saved_false);
1023 // break;
1024 // }
1025 // true_label_ = saved_true;
1026 // false_label_ = saved_false;
1027 // break;
1028 // }
1029 //
1030 // default:
1031 // UNREACHABLE();
1032 // }
1033 }
1034
1035
1036 void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
1037 UNIMPLEMENTED();
1038 // Comment cmnt(masm_, "[ CountOperation");
1039 // VariableProxy* proxy = expr->expression()->AsVariableProxy();
1040 // ASSERT(proxy->AsVariable() != NULL);
1041 // ASSERT(proxy->AsVariable()->is_global());
1042 //
1043 // Visit(proxy);
1044 // __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS);
1045 //
1046 // switch (expr->context()) {
1047 // case Expression::kUninitialized:
1048 // UNREACHABLE();
1049 // case Expression::kValue: // Fall through
1050 // case Expression::kTest: // Fall through
1051 // case Expression::kTestValue: // Fall through
1052 // case Expression::kValueTest:
1053 // // Duplicate the result on the stack.
1054 // __ push(r0);
1055 // break;
1056 // case Expression::kEffect:
1057 // // Do not save result.
1058 // break;
1059 // }
1060 // // Call runtime for +1/-1.
1061 // __ push(r0);
1062 // __ mov(ip, Operand(Smi::FromInt(1)));
1063 // __ push(ip);
1064 // if (expr->op() == Token::INC) {
1065 // __ CallRuntime(Runtime::kNumberAdd, 2);
1066 // } else {
1067 // __ CallRuntime(Runtime::kNumberSub, 2);
1068 // }
1069 // // Call Store IC.
1070 // __ mov(r2, Operand(proxy->AsVariable()->name()));
1071 // __ ldr(ip, CodeGenerator::GlobalObject());
1072 // __ push(ip);
1073 // Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1074 // __ Call(ic, RelocInfo::CODE_TARGET);
1075 // // Restore up stack after store IC.
1076 // __ add(sp, sp, Operand(kPointerSize));
1077 //
1078 // switch (expr->context()) {
1079 // case Expression::kUninitialized:
1080 // UNREACHABLE();
1081 // case Expression::kEffect: // Fall through
1082 // case Expression::kValue:
1083 // // Do nothing. Result in either on the stack for value context
1084 // // or discarded for effect context.
1085 // break;
1086 // case Expression::kTest:
1087 // __ pop(r0);
1088 // TestAndBranch(r0, true_label_, false_label_);
1089 // break;
1090 // case Expression::kValueTest: {
1091 // Label discard;
1092 // __ ldr(r0, MemOperand(sp));
1093 // TestAndBranch(r0, true_label_, &discard);
1094 // __ bind(&discard);
1095 // __ add(sp, sp, Operand(kPointerSize));
1096 // __ b(false_label_);
1097 // break;
1098 // }
1099 // case Expression::kTestValue: {
1100 // Label discard;
1101 // __ ldr(r0, MemOperand(sp));
1102 // TestAndBranch(r0, &discard, false_label_);
1103 // __ bind(&discard);
1104 // __ add(sp, sp, Operand(kPointerSize));
1105 // __ b(true_label_);
1106 // break;
1107 // }
1108 // }
1109 }
1110
1111
1112 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
1113 UNIMPLEMENTED();
1114 // Comment cmnt(masm_, "[ BinaryOperation");
1115 // switch (expr->op()) {
1116 // case Token::COMMA:
1117 // ASSERT_EQ(Expression::kEffect, expr->left()->context());
1118 // ASSERT_EQ(expr->context(), expr->right()->context());
1119 // Visit(expr->left());
1120 // Visit(expr->right());
1121 // break;
1122 //
1123 // case Token::OR:
1124 // case Token::AND:
1125 // EmitLogicalOperation(expr);
1126 // break;
1127 //
1128 // case Token::ADD:
1129 // case Token::SUB:
1130 // case Token::DIV:
1131 // case Token::MOD:
1132 // case Token::MUL:
1133 // case Token::BIT_OR:
1134 // case Token::BIT_AND:
1135 // case Token::BIT_XOR:
1136 // case Token::SHL:
1137 // case Token::SHR:
1138 // case Token::SAR: {
1139 // ASSERT_EQ(Expression::kValue, expr->left()->context());
1140 // ASSERT_EQ(Expression::kValue, expr->right()->context());
1141 //
1142 // Visit(expr->left());
1143 // Visit(expr->right());
1144 // __ pop(r0);
1145 // __ pop(r1);
1146 // GenericBinaryOpStub stub(expr->op(),
1147 // NO_OVERWRITE);
1148 // __ CallStub(&stub);
1149 // Move(expr->context(), r0);
1150 //
1151 // break;
1152 // }
1153 // default:
1154 // UNREACHABLE();
1155 // }
1156 }
1157
1158
1159 void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
1160 UNIMPLEMENTED();
1161 // Comment cmnt(masm_, "[ CompareOperation");
1162 // ASSERT_EQ(Expression::kValue, expr->left()->context());
1163 // ASSERT_EQ(Expression::kValue, expr->right()->context());
1164 // Visit(expr->left());
1165 // Visit(expr->right());
1166 //
1167 // // Convert current context to test context: Pre-test code.
1168 // Label push_true;
1169 // Label push_false;
1170 // Label done;
1171 // Label* saved_true = true_label_;
1172 // Label* saved_false = false_label_;
1173 // switch (expr->context()) {
1174 // case Expression::kUninitialized:
1175 // UNREACHABLE();
1176 // break;
1177 //
1178 // case Expression::kValue:
1179 // true_label_ = &push_true;
1180 // false_label_ = &push_false;
1181 // break;
1182 //
1183 // case Expression::kEffect:
1184 // true_label_ = &done;
1185 // false_label_ = &done;
1186 // break;
1187 //
1188 // case Expression::kTest:
1189 // break;
1190 //
1191 // case Expression::kValueTest:
1192 // true_label_ = &push_true;
1193 // break;
1194 //
1195 // case Expression::kTestValue:
1196 // false_label_ = &push_false;
1197 // break;
1198 // }
1199 // // Convert current context to test context: End pre-test code.
1200 //
1201 // switch (expr->op()) {
1202 // case Token::IN: {
1203 // __ InvokeBuiltin(Builtins::IN, CALL_JS);
1204 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1205 // __ cmp(r0, ip);
1206 // __ b(eq, true_label_);
1207 // __ jmp(false_label_);
1208 // break;
1209 // }
1210 //
1211 // case Token::INSTANCEOF: {
1212 // InstanceofStub stub;
1213 // __ CallStub(&stub);
1214 // __ tst(r0, r0);
1215 // __ b(eq, true_label_); // The stub returns 0 for true.
1216 // __ jmp(false_label_);
1217 // break;
1218 // }
1219 //
1220 // default: {
1221 // Condition cc = eq;
1222 // bool strict = false;
1223 // switch (expr->op()) {
1224 // case Token::EQ_STRICT:
1225 // strict = true;
1226 // // Fall through
1227 // case Token::EQ:
1228 // cc = eq;
1229 // __ pop(r0);
1230 // __ pop(r1);
1231 // break;
1232 // case Token::LT:
1233 // cc = lt;
1234 // __ pop(r0);
1235 // __ pop(r1);
1236 // break;
1237 // case Token::GT:
1238 // // Reverse left and right sizes to obtain ECMA-262 conversion order.
1239 // cc = lt;
1240 // __ pop(r1);
1241 // __ pop(r0);
1242 // break;
1243 // case Token::LTE:
1244 // // Reverse left and right sizes to obtain ECMA-262 conversion order.
1245 // cc = ge;
1246 // __ pop(r1);
1247 // __ pop(r0);
1248 // break;
1249 // case Token::GTE:
1250 // cc = ge;
1251 // __ pop(r0);
1252 // __ pop(r1);
1253 // break;
1254 // case Token::IN:
1255 // case Token::INSTANCEOF:
1256 // default:
1257 // UNREACHABLE();
1258 // }
1259 //
1260 // // The comparison stub expects the smi vs. smi case to be handled
1261 // // before it is called.
1262 // Label slow_case;
1263 // __ orr(r2, r0, Operand(r1));
1264 // __ tst(r2, Operand(kSmiTagMask));
1265 // __ b(ne, &slow_case);
1266 // __ cmp(r1, r0);
1267 // __ b(cc, true_label_);
1268 // __ jmp(false_label_);
1269 //
1270 // __ bind(&slow_case);
1271 // CompareStub stub(cc, strict);
1272 // __ CallStub(&stub);
1273 // __ tst(r0, r0);
1274 // __ b(cc, true_label_);
1275 // __ jmp(false_label_);
1276 // }
1277 // }
1278 //
1279 // // Convert current context to test context: Post-test code.
1280 // switch (expr->context()) {
1281 // case Expression::kUninitialized:
1282 // UNREACHABLE();
1283 // break;
1284 //
1285 // case Expression::kValue:
1286 // __ bind(&push_true);
1287 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1288 // __ push(ip);
1289 // __ jmp(&done);
1290 // __ bind(&push_false);
1291 // __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1292 // __ push(ip);
1293 // __ bind(&done);
1294 // break;
1295 //
1296 // case Expression::kEffect:
1297 // __ bind(&done);
1298 // break;
1299 //
1300 // case Expression::kTest:
1301 // break;
1302 //
1303 // case Expression::kValueTest:
1304 // __ bind(&push_true);
1305 // __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1306 // __ push(ip);
1307 // __ jmp(saved_true);
1308 // break;
1309 //
1310 // case Expression::kTestValue:
1311 // __ bind(&push_false);
1312 // __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1313 // __ push(ip);
1314 // __ jmp(saved_false);
1315 // break;
1316 // }
1317 // true_label_ = saved_true;
1318 // false_label_ = saved_false;
1319 // // Convert current context to test context: End post-test code.
1320 }
1321
1322
1323 #undef __
1324
1325
1326 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698