OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 8252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8263 case Token::BIT_AND: | 8263 case Token::BIT_AND: |
8264 case Token::BIT_OR: | 8264 case Token::BIT_OR: |
8265 instr = HBitwise::NewHBitwise(zone(), expr->op(), context, left, right); | 8265 instr = HBitwise::NewHBitwise(zone(), expr->op(), context, left, right); |
8266 break; | 8266 break; |
8267 case Token::SAR: | 8267 case Token::SAR: |
8268 instr = HSar::NewHSar(zone(), context, left, right); | 8268 instr = HSar::NewHSar(zone(), context, left, right); |
8269 break; | 8269 break; |
8270 case Token::SHR: | 8270 case Token::SHR: |
8271 instr = HShr::NewHShr(zone(), context, left, right); | 8271 instr = HShr::NewHShr(zone(), context, left, right); |
8272 if (FLAG_opt_safe_uint32_operations && instr->IsShr()) { | 8272 if (FLAG_opt_safe_uint32_operations && instr->IsShr()) { |
8273 graph()->RecordUint32Instruction(instr); | 8273 bool can_be_shift_by_zero = true; |
| 8274 if (right->IsConstant()) { |
| 8275 HConstant* right_const = HConstant::cast(right); |
| 8276 if (right_const->HasInteger32Value() && |
| 8277 (right_const->Integer32Value() & 0x1f) != 0) { |
| 8278 can_be_shift_by_zero = false; |
| 8279 } |
| 8280 } |
| 8281 |
| 8282 if (can_be_shift_by_zero) graph()->RecordUint32Instruction(instr); |
8274 } | 8283 } |
8275 break; | 8284 break; |
8276 case Token::SHL: | 8285 case Token::SHL: |
8277 instr = HShl::NewHShl(zone(), context, left, right); | 8286 instr = HShl::NewHShl(zone(), context, left, right); |
8278 break; | 8287 break; |
8279 default: | 8288 default: |
8280 UNREACHABLE(); | 8289 UNREACHABLE(); |
8281 } | 8290 } |
8282 | 8291 |
8283 // If we hit an uninitialized binary op stub we will get type info | 8292 // If we hit an uninitialized binary op stub we will get type info |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9935 } | 9944 } |
9936 } | 9945 } |
9937 | 9946 |
9938 #ifdef DEBUG | 9947 #ifdef DEBUG |
9939 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9948 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9940 if (allocator_ != NULL) allocator_->Verify(); | 9949 if (allocator_ != NULL) allocator_->Verify(); |
9941 #endif | 9950 #endif |
9942 } | 9951 } |
9943 | 9952 |
9944 } } // namespace v8::internal | 9953 } } // namespace v8::internal |
OLD | NEW |