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 5603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5614 HInstruction* instr = NULL; | 5614 HInstruction* instr = NULL; |
5615 switch (expr->op()) { | 5615 switch (expr->op()) { |
5616 case Token::ADD: | 5616 case Token::ADD: |
5617 if (info.IsString()) { | 5617 if (info.IsString()) { |
5618 AddInstruction(new(zone()) HCheckNonSmi(left)); | 5618 AddInstruction(new(zone()) HCheckNonSmi(left)); |
5619 AddInstruction(HCheckInstanceType::NewIsString(left)); | 5619 AddInstruction(HCheckInstanceType::NewIsString(left)); |
5620 AddInstruction(new(zone()) HCheckNonSmi(right)); | 5620 AddInstruction(new(zone()) HCheckNonSmi(right)); |
5621 AddInstruction(HCheckInstanceType::NewIsString(right)); | 5621 AddInstruction(HCheckInstanceType::NewIsString(right)); |
5622 instr = new(zone()) HStringAdd(context, left, right); | 5622 instr = new(zone()) HStringAdd(context, left, right); |
5623 } else { | 5623 } else { |
5624 instr = new(zone()) HAdd(context, left, right); | 5624 instr = HAdd::NewHAdd(zone(), context, left, right); |
5625 } | 5625 } |
5626 break; | 5626 break; |
5627 case Token::SUB: | 5627 case Token::SUB: |
5628 instr = new(zone()) HSub(context, left, right); | 5628 instr = HSub::NewHSub(zone(), context, left, right); |
5629 break; | 5629 break; |
5630 case Token::MUL: | 5630 case Token::MUL: |
5631 instr = new(zone()) HMul(context, left, right); | 5631 instr = HMul::NewHMul(zone(), context, left, right); |
5632 break; | 5632 break; |
5633 case Token::MOD: | 5633 case Token::MOD: |
5634 instr = new(zone()) HMod(context, left, right); | 5634 instr = HMod::NewHMod(zone(), context, left, right); |
5635 break; | 5635 break; |
5636 case Token::DIV: | 5636 case Token::DIV: |
5637 instr = new(zone()) HDiv(context, left, right); | 5637 instr = HDiv::NewHDiv(zone(), context, left, right); |
5638 break; | 5638 break; |
5639 case Token::BIT_XOR: | 5639 case Token::BIT_XOR: |
5640 case Token::BIT_AND: | 5640 case Token::BIT_AND: |
5641 case Token::BIT_OR: | 5641 case Token::BIT_OR: |
5642 instr = new(zone()) HBitwise(expr->op(), context, left, right); | 5642 instr = HBitwise::NewHBitwise(zone(), expr->op(), context, left, right); |
5643 break; | 5643 break; |
5644 case Token::SAR: | 5644 case Token::SAR: |
5645 instr = new(zone()) HSar(context, left, right); | 5645 instr = HSar::NewHSar(zone(), context, left, right); |
5646 break; | 5646 break; |
5647 case Token::SHR: | 5647 case Token::SHR: |
5648 instr = new(zone()) HShr(context, left, right); | 5648 instr = HShr::NewHShr(zone(), context, left, right); |
5649 break; | 5649 break; |
5650 case Token::SHL: | 5650 case Token::SHL: |
5651 instr = new(zone()) HShl(context, left, right); | 5651 instr = HShl::NewHShl(zone(), context, left, right); |
5652 break; | 5652 break; |
5653 default: | 5653 default: |
5654 UNREACHABLE(); | 5654 UNREACHABLE(); |
5655 } | 5655 } |
5656 | 5656 |
5657 // If we hit an uninitialized binary op stub we will get type info | 5657 // If we hit an uninitialized binary op stub we will get type info |
5658 // for a smi operation. If one of the operands is a constant string | 5658 // for a smi operation. If one of the operands is a constant string |
5659 // do not generate code assuming it is a smi operation. | 5659 // do not generate code assuming it is a smi operation. |
5660 if (info.IsSmi() && | 5660 if (info.IsSmi() && |
5661 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || | 5661 ((left->IsConstant() && HConstant::cast(left)->HasStringValue()) || |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7033 } | 7033 } |
7034 } | 7034 } |
7035 | 7035 |
7036 #ifdef DEBUG | 7036 #ifdef DEBUG |
7037 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7037 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7038 if (allocator_ != NULL) allocator_->Verify(); | 7038 if (allocator_ != NULL) allocator_->Verify(); |
7039 #endif | 7039 #endif |
7040 } | 7040 } |
7041 | 7041 |
7042 } } // namespace v8::internal | 7042 } } // namespace v8::internal |
OLD | NEW |