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