Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: src/arm/lithium-arm.cc

Issue 22862009: Use CheckUsesForFlag to check flag in uses list (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 LOperand* right = NULL; 711 LOperand* right = NULL;
712 int constant_value = 0; 712 int constant_value = 0;
713 bool does_deopt = false; 713 bool does_deopt = false;
714 if (right_value->IsConstant()) { 714 if (right_value->IsConstant()) {
715 HConstant* constant = HConstant::cast(right_value); 715 HConstant* constant = HConstant::cast(right_value);
716 right = chunk_->DefineConstantOperand(constant); 716 right = chunk_->DefineConstantOperand(constant);
717 constant_value = constant->Integer32Value() & 0x1f; 717 constant_value = constant->Integer32Value() & 0x1f;
718 // Left shifts can deoptimize if we shift by > 0 and the result cannot be 718 // Left shifts can deoptimize if we shift by > 0 and the result cannot be
719 // truncated to smi. 719 // truncated to smi.
720 if (instr->representation().IsSmi() && constant_value > 0) { 720 if (instr->representation().IsSmi() && constant_value > 0) {
721 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 721 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
722 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
723 does_deopt = true;
724 break;
725 }
726 }
727 } 722 }
728 } else { 723 } else {
729 right = UseRegisterAtStart(right_value); 724 right = UseRegisterAtStart(right_value);
730 } 725 }
731 726
732 // Shift operations can only deoptimize if we do a logical shift 727 // Shift operations can only deoptimize if we do a logical shift
733 // by 0 and the result cannot be truncated to int32. 728 // by 0 and the result cannot be truncated to int32.
734 if (op == Token::SHR && constant_value == 0) { 729 if (op == Token::SHR && constant_value == 0) {
735 if (FLAG_opt_safe_uint32_operations) { 730 if (FLAG_opt_safe_uint32_operations) {
736 does_deopt = !instr->CheckFlag(HInstruction::kUint32); 731 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
737 } else { 732 } else {
738 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 733 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
739 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
740 does_deopt = true;
741 break;
742 }
743 }
744 } 734 }
745 } 735 }
746 736
747 LInstruction* result = 737 LInstruction* result =
748 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); 738 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt));
749 return does_deopt ? AssignEnvironment(result) : result; 739 return does_deopt ? AssignEnvironment(result) : result;
750 } 740 }
751 741
752 742
753 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, 743 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 2589
2600 2590
2601 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2591 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2602 LOperand* object = UseRegister(instr->object()); 2592 LOperand* object = UseRegister(instr->object());
2603 LOperand* index = UseRegister(instr->index()); 2593 LOperand* index = UseRegister(instr->index());
2604 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2594 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2605 } 2595 }
2606 2596
2607 2597
2608 } } // namespace v8::internal 2598 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698