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

Side by Side Diff: src/ia32/lithium-ia32.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 | « src/arm/lithium-arm.cc ('k') | src/mips/lithium-mips.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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 LOperand* right = NULL; 765 LOperand* right = NULL;
766 int constant_value = 0; 766 int constant_value = 0;
767 bool does_deopt = false; 767 bool does_deopt = false;
768 if (right_value->IsConstant()) { 768 if (right_value->IsConstant()) {
769 HConstant* constant = HConstant::cast(right_value); 769 HConstant* constant = HConstant::cast(right_value);
770 right = chunk_->DefineConstantOperand(constant); 770 right = chunk_->DefineConstantOperand(constant);
771 constant_value = constant->Integer32Value() & 0x1f; 771 constant_value = constant->Integer32Value() & 0x1f;
772 // Left shifts can deoptimize if we shift by > 0 and the result cannot be 772 // Left shifts can deoptimize if we shift by > 0 and the result cannot be
773 // truncated to smi. 773 // truncated to smi.
774 if (instr->representation().IsSmi() && constant_value > 0) { 774 if (instr->representation().IsSmi() && constant_value > 0) {
775 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 775 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToSmi);
776 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
777 does_deopt = true;
778 break;
779 }
780 }
781 } 776 }
782 } else { 777 } else {
783 right = UseFixed(right_value, ecx); 778 right = UseFixed(right_value, ecx);
784 } 779 }
785 780
786 // Shift operations can only deoptimize if we do a logical shift by 0 and 781 // Shift operations can only deoptimize if we do a logical shift by 0 and
787 // the result cannot be truncated to int32. 782 // the result cannot be truncated to int32.
788 if (op == Token::SHR && constant_value == 0) { 783 if (op == Token::SHR && constant_value == 0) {
789 if (FLAG_opt_safe_uint32_operations) { 784 if (FLAG_opt_safe_uint32_operations) {
790 does_deopt = !instr->CheckFlag(HInstruction::kUint32); 785 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
791 } else { 786 } else {
792 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 787 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32);
793 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
794 does_deopt = true;
795 break;
796 }
797 }
798 } 788 }
799 } 789 }
800 790
801 LInstruction* result = 791 LInstruction* result =
802 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt)); 792 DefineSameAsFirst(new(zone()) LShiftI(op, left, right, does_deopt));
803 return does_deopt ? AssignEnvironment(result) : result; 793 return does_deopt ? AssignEnvironment(result) : result;
804 } 794 }
805 795
806 796
807 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, 797 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2723 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2734 LOperand* object = UseRegister(instr->object()); 2724 LOperand* object = UseRegister(instr->object());
2735 LOperand* index = UseTempRegister(instr->index()); 2725 LOperand* index = UseTempRegister(instr->index());
2736 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2726 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2737 } 2727 }
2738 2728
2739 2729
2740 } } // namespace v8::internal 2730 } } // namespace v8::internal
2741 2731
2742 #endif // V8_TARGET_ARCH_IA32 2732 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698