| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 case Token::SUB: | 732 case Token::SUB: |
| 733 case Token::DIV: | 733 case Token::DIV: |
| 734 case Token::MOD: | 734 case Token::MOD: |
| 735 case Token::MUL: | 735 case Token::MUL: |
| 736 case Token::BIT_OR: | 736 case Token::BIT_OR: |
| 737 case Token::BIT_AND: | 737 case Token::BIT_AND: |
| 738 case Token::BIT_XOR: | 738 case Token::BIT_XOR: |
| 739 case Token::SHL: | 739 case Token::SHL: |
| 740 case Token::SHR: | 740 case Token::SHR: |
| 741 case Token::SAR: { | 741 case Token::SAR: { |
| 742 // Figure out if either of the operands is a constant. | 742 // Load both operands. |
| 743 ConstantOperand constant = ShouldInlineSmiCase(op) | 743 VisitForStackValue(left); |
| 744 ? GetConstantOperand(op, left, right) | 744 VisitForAccumulatorValue(right); |
| 745 : kNoConstants; | |
| 746 | |
| 747 // Load only the operands that we need to materialize. | |
| 748 if (constant == kNoConstants) { | |
| 749 VisitForStackValue(left); | |
| 750 VisitForAccumulatorValue(right); | |
| 751 } else if (constant == kRightConstant) { | |
| 752 VisitForAccumulatorValue(left); | |
| 753 } else { | |
| 754 ASSERT(constant == kLeftConstant); | |
| 755 VisitForAccumulatorValue(right); | |
| 756 } | |
| 757 | 745 |
| 758 SetSourcePosition(expr->position()); | 746 SetSourcePosition(expr->position()); |
| 759 if (ShouldInlineSmiCase(op)) { | 747 if (ShouldInlineSmiCase(op)) { |
| 760 EmitInlineSmiBinaryOp(expr, op, mode, left, right, constant); | 748 EmitInlineSmiBinaryOp(expr, op, mode, left, right); |
| 761 } else { | 749 } else { |
| 762 EmitBinaryOp(op, mode); | 750 EmitBinaryOp(op, mode); |
| 763 } | 751 } |
| 764 break; | 752 break; |
| 765 } | 753 } |
| 766 | 754 |
| 767 default: | 755 default: |
| 768 UNREACHABLE(); | 756 UNREACHABLE(); |
| 769 } | 757 } |
| 770 } | 758 } |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 __ Drop(stack_depth); | 1373 __ Drop(stack_depth); |
| 1386 __ PopTryHandler(); | 1374 __ PopTryHandler(); |
| 1387 return 0; | 1375 return 0; |
| 1388 } | 1376 } |
| 1389 | 1377 |
| 1390 | 1378 |
| 1391 #undef __ | 1379 #undef __ |
| 1392 | 1380 |
| 1393 | 1381 |
| 1394 } } // namespace v8::internal | 1382 } } // namespace v8::internal |
| OLD | NEW |