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

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

Issue 20323002: Add Smi support to Shl (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM / x64 Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 756
757 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { 757 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
758 return AssignEnvironment(new(zone()) LDeoptimize); 758 return AssignEnvironment(new(zone()) LDeoptimize);
759 } 759 }
760 760
761 761
762 LInstruction* LChunkBuilder::DoShift(Token::Value op, 762 LInstruction* LChunkBuilder::DoShift(Token::Value op,
763 HBitwiseBinaryOperation* instr) { 763 HBitwiseBinaryOperation* instr) {
764 if (instr->representation().IsSmiOrTagged()) { 764 if (instr->representation().IsTagged()) {
765 ASSERT(instr->left()->representation().IsSmiOrTagged()); 765 ASSERT(instr->left()->representation().IsSmiOrTagged());
766 ASSERT(instr->right()->representation().IsSmiOrTagged()); 766 ASSERT(instr->right()->representation().IsSmiOrTagged());
767 767
768 LOperand* context = UseFixed(instr->context(), esi); 768 LOperand* context = UseFixed(instr->context(), esi);
769 LOperand* left = UseFixed(instr->left(), edx); 769 LOperand* left = UseFixed(instr->left(), edx);
770 LOperand* right = UseFixed(instr->right(), eax); 770 LOperand* right = UseFixed(instr->right(), eax);
771 LArithmeticT* result = new(zone()) LArithmeticT(op, context, left, right); 771 LArithmeticT* result = new(zone()) LArithmeticT(op, context, left, right);
772 return MarkAsCall(DefineFixed(result, eax), instr); 772 return MarkAsCall(DefineFixed(result, eax), instr);
773 } 773 }
774 774
775 ASSERT(instr->representation().IsInteger32()); 775 ASSERT(instr->representation().IsSmiOrInteger32());
776 ASSERT(instr->left()->representation().IsInteger32()); 776 ASSERT(instr->left()->representation().Equals(instr->representation()));
777 ASSERT(instr->right()->representation().IsInteger32()); 777 ASSERT(instr->right()->representation().Equals(instr->representation()));
778 LOperand* left = UseRegisterAtStart(instr->left()); 778 LOperand* left = UseRegisterAtStart(instr->left());
779 779
780 HValue* right_value = instr->right(); 780 HValue* right_value = instr->right();
781 LOperand* right = NULL; 781 LOperand* right = NULL;
782 int constant_value = 0; 782 int constant_value = 0;
783 bool does_deopt = false;
783 if (right_value->IsConstant()) { 784 if (right_value->IsConstant()) {
784 HConstant* constant = HConstant::cast(right_value); 785 HConstant* constant = HConstant::cast(right_value);
785 right = chunk_->DefineConstantOperand(constant); 786 right = chunk_->DefineConstantOperand(constant);
786 constant_value = constant->Integer32Value() & 0x1f; 787 constant_value = constant->Integer32Value() & 0x1f;
788 // Left shifts can deoptimize if we shift by > 0 and the result cannot be
mvstanton 2013/07/26 13:34:48 What if instr representation is smi but right_valu
789 // truncated to smi.
790 if (instr->representation().IsSmi() && constant_value > 0) {
791 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
792 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
793 does_deopt = true;
794 break;
795 }
796 }
797 }
787 } else { 798 } else {
788 right = UseFixed(right_value, ecx); 799 right = UseFixed(right_value, ecx);
789 } 800 }
790 801
791 // Shift operations can only deoptimize if we do a logical shift by 0 and 802 // Shift operations can only deoptimize if we do a logical shift by 0 and
mvstanton 2013/07/26 13:34:48 Say "Right shift operations" here.
792 // the result cannot be truncated to int32. 803 // the result cannot be truncated to int32.
793 bool does_deopt = false;
794 if (op == Token::SHR && constant_value == 0) { 804 if (op == Token::SHR && constant_value == 0) {
795 if (FLAG_opt_safe_uint32_operations) { 805 if (FLAG_opt_safe_uint32_operations) {
796 does_deopt = !instr->CheckFlag(HInstruction::kUint32); 806 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
797 } else { 807 } else {
798 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 808 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
799 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { 809 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
800 does_deopt = true; 810 does_deopt = true;
801 break; 811 break;
802 } 812 }
803 } 813 }
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2775 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2766 LOperand* object = UseRegister(instr->object()); 2776 LOperand* object = UseRegister(instr->object());
2767 LOperand* index = UseTempRegister(instr->index()); 2777 LOperand* index = UseTempRegister(instr->index());
2768 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2778 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2769 } 2779 }
2770 2780
2771 2781
2772 } } // namespace v8::internal 2782 } } // namespace v8::internal
2773 2783
2774 #endif // V8_TARGET_ARCH_IA32 2784 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698