OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 8699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8710 switch (op) { | 8710 switch (op) { |
8711 case Token::ADD: | 8711 case Token::ADD: |
8712 instr = AddUncasted<HAdd>(left, right); | 8712 instr = AddUncasted<HAdd>(left, right); |
8713 break; | 8713 break; |
8714 case Token::SUB: | 8714 case Token::SUB: |
8715 instr = AddUncasted<HSub>(left, right); | 8715 instr = AddUncasted<HSub>(left, right); |
8716 break; | 8716 break; |
8717 case Token::MUL: | 8717 case Token::MUL: |
8718 instr = AddUncasted<HMul>(left, right); | 8718 instr = AddUncasted<HMul>(left, right); |
8719 break; | 8719 break; |
8720 case Token::MOD: | 8720 case Token::MOD: { |
8721 instr = AddUncasted<HMod>(left, right, fixed_right_arg); | 8721 if (fixed_right_arg.has_value) { |
| 8722 if (right->IsConstant()) { |
| 8723 ASSERT_EQ(fixed_right_arg.value, |
| 8724 HConstant::cast(right)->Integer32Value()); |
| 8725 } else { |
| 8726 HConstant* fixed_right = Add<HConstant>( |
| 8727 static_cast<int>(fixed_right_arg.value)); |
| 8728 IfBuilder if_same(this); |
| 8729 if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ); |
| 8730 if_same.Then(); |
| 8731 if_same.ElseDeopt("Unexpected RHS of binary operation"); |
| 8732 right = fixed_right; |
| 8733 } |
| 8734 } |
| 8735 instr = AddUncasted<HMod>(left, right); |
8722 break; | 8736 break; |
| 8737 } |
8723 case Token::DIV: | 8738 case Token::DIV: |
8724 instr = AddUncasted<HDiv>(left, right); | 8739 instr = AddUncasted<HDiv>(left, right); |
8725 break; | 8740 break; |
8726 case Token::BIT_XOR: | 8741 case Token::BIT_XOR: |
8727 case Token::BIT_AND: | 8742 case Token::BIT_AND: |
8728 instr = AddUncasted<HBitwise>(op, left, right); | 8743 instr = AddUncasted<HBitwise>(op, left, right); |
8729 break; | 8744 break; |
8730 case Token::BIT_OR: { | 8745 case Token::BIT_OR: { |
8731 HValue* operand, *shift_amount; | 8746 HValue* operand, *shift_amount; |
8732 if (left_type->Is(Type::Signed32()) && | 8747 if (left_type->Is(Type::Signed32()) && |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10648 if (ShouldProduceTraceOutput()) { | 10663 if (ShouldProduceTraceOutput()) { |
10649 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10664 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10650 } | 10665 } |
10651 | 10666 |
10652 #ifdef DEBUG | 10667 #ifdef DEBUG |
10653 graph_->Verify(false); // No full verify. | 10668 graph_->Verify(false); // No full verify. |
10654 #endif | 10669 #endif |
10655 } | 10670 } |
10656 | 10671 |
10657 } } // namespace v8::internal | 10672 } } // namespace v8::internal |
OLD | NEW |