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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 for (int i = 0; i < arg_count; i++) { | 716 for (int i = 0; i < arg_count; i++) { |
717 Visit(args->at(i)); | 717 Visit(args->at(i)); |
718 ASSERT_EQ(Expression::kValue, args->at(i)->context()); | 718 ASSERT_EQ(Expression::kValue, args->at(i)->context()); |
719 } | 719 } |
720 | 720 |
721 __ CallRuntime(function, arg_count); | 721 __ CallRuntime(function, arg_count); |
722 Move(expr->context(), r0); | 722 Move(expr->context(), r0); |
723 } | 723 } |
724 | 724 |
725 | 725 |
| 726 void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 727 Comment cmnt(masm_, "[ UnaryOperation"); |
| 728 |
| 729 switch (expr->op()) { |
| 730 case Token::VOID: |
| 731 Visit(expr->expression()); |
| 732 ASSERT_EQ(Expression::kEffect, expr->expression()->context()); |
| 733 switch (expr->context()) { |
| 734 case Expression::kUninitialized: |
| 735 UNREACHABLE(); |
| 736 break; |
| 737 case Expression::kValue: |
| 738 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 739 __ push(ip); |
| 740 break; |
| 741 case Expression::kEffect: |
| 742 break; |
| 743 } |
| 744 break; |
| 745 |
| 746 default: |
| 747 UNREACHABLE(); |
| 748 } |
| 749 } |
| 750 |
| 751 |
726 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { | 752 void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
727 switch (expr->op()) { | 753 switch (expr->op()) { |
728 case Token::COMMA: | 754 case Token::COMMA: |
729 ASSERT_EQ(Expression::kEffect, expr->left()->context()); | 755 ASSERT_EQ(Expression::kEffect, expr->left()->context()); |
730 ASSERT_EQ(expr->context(), expr->right()->context()); | 756 ASSERT_EQ(expr->context(), expr->right()->context()); |
731 Visit(expr->left()); | 757 Visit(expr->left()); |
732 Visit(expr->right()); | 758 Visit(expr->right()); |
733 break; | 759 break; |
734 | 760 |
735 case Token::OR: | 761 case Token::OR: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // Discard the left-hand value if present on the stack. | 836 // Discard the left-hand value if present on the stack. |
811 if (context == Expression::kValue) __ pop(); | 837 if (context == Expression::kValue) __ pop(); |
812 // Save or discard the right-hand value as needed. | 838 // Save or discard the right-hand value as needed. |
813 Visit(right); | 839 Visit(right); |
814 ASSERT_EQ(context, right->context()); | 840 ASSERT_EQ(context, right->context()); |
815 | 841 |
816 __ bind(&done); | 842 __ bind(&done); |
817 } | 843 } |
818 | 844 |
819 } } // namespace v8::internal | 845 } } // namespace v8::internal |
OLD | NEW |