OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 5660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5671 HInstruction* instr = NULL; | 5671 HInstruction* instr = NULL; |
5672 switch (expr->op()) { | 5672 switch (expr->op()) { |
5673 case Token::ADD: | 5673 case Token::ADD: |
5674 if (info.IsString()) { | 5674 if (info.IsString()) { |
5675 AddInstruction(new(zone()) HCheckNonSmi(left)); | 5675 AddInstruction(new(zone()) HCheckNonSmi(left)); |
5676 AddInstruction(HCheckInstanceType::NewIsString(left)); | 5676 AddInstruction(HCheckInstanceType::NewIsString(left)); |
5677 AddInstruction(new(zone()) HCheckNonSmi(right)); | 5677 AddInstruction(new(zone()) HCheckNonSmi(right)); |
5678 AddInstruction(HCheckInstanceType::NewIsString(right)); | 5678 AddInstruction(HCheckInstanceType::NewIsString(right)); |
5679 instr = new(zone()) HStringAdd(context, left, right); | 5679 instr = new(zone()) HStringAdd(context, left, right); |
5680 } else { | 5680 } else { |
5681 instr = new(zone()) HAdd(context, left, right); | 5681 instr = HAdd::NewHAdd(zone(), context, left, right); |
5682 } | 5682 } |
5683 break; | 5683 break; |
5684 case Token::SUB: | 5684 case Token::SUB: |
5685 instr = new(zone()) HSub(context, left, right); | 5685 instr = HSub::NewHSub(zone(), context, left, right); |
5686 break; | 5686 break; |
5687 case Token::MUL: | 5687 case Token::MUL: |
5688 instr = new(zone()) HMul(context, left, right); | 5688 instr = HMul::NewHMul(zone(), context, left, right); |
5689 break; | 5689 break; |
5690 case Token::MOD: | 5690 case Token::MOD: |
5691 instr = new(zone()) HMod(context, left, right); | 5691 instr = HMod::NewHMod(zone(), context, left, right); |
5692 break; | 5692 break; |
5693 case Token::DIV: | 5693 case Token::DIV: |
5694 instr = new(zone()) HDiv(context, left, right); | 5694 instr = HDiv::NewHDiv(zone(), context, left, right); |
5695 break; | 5695 break; |
5696 case Token::BIT_XOR: | 5696 case Token::BIT_XOR: |
5697 case Token::BIT_AND: | 5697 case Token::BIT_AND: |
5698 case Token::BIT_OR: | 5698 case Token::BIT_OR: |
5699 instr = new(zone()) HBitwise(expr->op(), context, left, right); | 5699 instr = HBitwise::NewHBitwise(zone(), expr->op(), context, left, right); |
5700 break; | 5700 break; |
5701 case Token::SAR: | 5701 case Token::SAR: |
5702 instr = new(zone()) HSar(context, left, right); | 5702 instr = HSar::NewHSar(zone(), context, left, right); |
5703 break; | 5703 break; |
5704 case Token::SHR: | 5704 case Token::SHR: |
5705 instr = new(zone()) HShr(context, left, right); | 5705 instr = HShr::NewHShr(zone(), context, left, right); |
5706 break; | 5706 break; |
5707 case Token::SHL: | 5707 case Token::SHL: |
5708 instr = new(zone()) HShl(context, left, right); | 5708 instr = HShl::NewHShl(zone(), context, left, right); |
5709 break; | 5709 break; |
5710 default: | 5710 default: |
5711 UNREACHABLE(); | 5711 UNREACHABLE(); |
5712 } | 5712 } |
5713 | 5713 |
5714 // If we hit an uninitialized binary op stub we will get type info | 5714 // If we hit an uninitialized binary op stub we will get type info |
5715 // for a smi operation. If one of the operands is a constant string | 5715 // for a smi operation. If one of the operands is a constant string |
5716 // do not generate code assuming it is a smi operation. | 5716 // do not generate code assuming it is a smi operation. |
5717 if (info.IsSmi() && | 5717 if (info.IsSmi() && |
5718 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || | 5718 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7152 } | 7152 } |
7153 } | 7153 } |
7154 | 7154 |
7155 #ifdef DEBUG | 7155 #ifdef DEBUG |
7156 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7156 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7157 if (allocator_ != NULL) allocator_->Verify(); | 7157 if (allocator_ != NULL) allocator_->Verify(); |
7158 #endif | 7158 #endif |
7159 } | 7159 } |
7160 | 7160 |
7161 } } // namespace v8::internal | 7161 } } // namespace v8::internal |
OLD | NEW |