OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 // Call the runtime to declare the globals. | 514 // Call the runtime to declare the globals. |
515 // The context is the first argument. | 515 // The context is the first argument. |
516 __ mov(r1, Operand(pairs)); | 516 __ mov(r1, Operand(pairs)); |
517 __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0))); | 517 __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0))); |
518 __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit()); | 518 __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit()); |
519 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 519 __ CallRuntime(Runtime::kDeclareGlobals, 3); |
520 // Return value is ignored. | 520 // Return value is ignored. |
521 } | 521 } |
522 | 522 |
523 | 523 |
524 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | |
525 Comment cmnt(masm_, "[ ReturnStatement"); | |
526 Expression* expr = stmt->expression(); | |
527 // Complete the statement based on the type of the subexpression. | |
528 if (expr->AsLiteral() != NULL) { | |
529 __ mov(r0, Operand(expr->AsLiteral()->handle())); | |
530 } else { | |
531 ASSERT_EQ(Expression::kValue, expr->context()); | |
532 Visit(expr); | |
533 __ pop(r0); | |
534 } | |
535 EmitReturnSequence(stmt->statement_pos()); | |
536 } | |
537 | |
538 | |
539 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { | 524 void FastCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
540 Comment cmnt(masm_, "[ FunctionLiteral"); | 525 Comment cmnt(masm_, "[ FunctionLiteral"); |
541 | 526 |
542 // Build the function boilerplate and instantiate it. | 527 // Build the function boilerplate and instantiate it. |
543 Handle<JSFunction> boilerplate = | 528 Handle<JSFunction> boilerplate = |
544 Compiler::BuildBoilerplate(expr, script_, this); | 529 Compiler::BuildBoilerplate(expr, script_, this); |
545 if (HasStackOverflow()) return; | 530 if (HasStackOverflow()) return; |
546 | 531 |
547 ASSERT(boilerplate->IsBoilerplate()); | 532 ASSERT(boilerplate->IsBoilerplate()); |
548 | 533 |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 false_label_ = saved_false; | 1646 false_label_ = saved_false; |
1662 // Convert current context to test context: End post-test code. | 1647 // Convert current context to test context: End post-test code. |
1663 } | 1648 } |
1664 | 1649 |
1665 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1650 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
1666 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1651 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1667 Move(expr->context(), r0); | 1652 Move(expr->context(), r0); |
1668 } | 1653 } |
1669 | 1654 |
1670 | 1655 |
| 1656 Register FastCodeGenerator::result_register() { return r0; } |
| 1657 |
1671 #undef __ | 1658 #undef __ |
1672 | 1659 |
1673 | 1660 |
1674 } } // namespace v8::internal | 1661 } } // namespace v8::internal |
OLD | NEW |