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

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

Issue 20808004: MIPS: Add Smi support to Shl (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nit. 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | no next file » | 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 706 }
707 707
708 708
709 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { 709 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
710 return AssignEnvironment(new(zone()) LDeoptimize); 710 return AssignEnvironment(new(zone()) LDeoptimize);
711 } 711 }
712 712
713 713
714 LInstruction* LChunkBuilder::DoShift(Token::Value op, 714 LInstruction* LChunkBuilder::DoShift(Token::Value op,
715 HBitwiseBinaryOperation* instr) { 715 HBitwiseBinaryOperation* instr) {
716 if (instr->representation().IsSmiOrTagged()) { 716 if (instr->representation().IsTagged()) {
717 ASSERT(instr->left()->representation().IsSmiOrTagged()); 717 ASSERT(instr->left()->representation().IsTagged());
718 ASSERT(instr->right()->representation().IsSmiOrTagged()); 718 ASSERT(instr->right()->representation().IsTagged());
719 719
720 LOperand* left = UseFixed(instr->left(), a1); 720 LOperand* left = UseFixed(instr->left(), a1);
721 LOperand* right = UseFixed(instr->right(), a0); 721 LOperand* right = UseFixed(instr->right(), a0);
722 LArithmeticT* result = new(zone()) LArithmeticT(op, left, right); 722 LArithmeticT* result = new(zone()) LArithmeticT(op, left, right);
723 return MarkAsCall(DefineFixed(result, v0), instr); 723 return MarkAsCall(DefineFixed(result, v0), instr);
724 } 724 }
725 725
726 ASSERT(instr->representation().IsInteger32()); 726 ASSERT(instr->representation().IsSmiOrInteger32());
727 ASSERT(instr->left()->representation().IsInteger32()); 727 ASSERT(instr->left()->representation().Equals(instr->representation()));
728 ASSERT(instr->right()->representation().IsInteger32()); 728 ASSERT(instr->right()->representation().Equals(instr->representation()));
729 LOperand* left = UseRegisterAtStart(instr->left()); 729 LOperand* left = UseRegisterAtStart(instr->left());
730 730
731 HValue* right_value = instr->right(); 731 HValue* right_value = instr->right();
732 LOperand* right = NULL; 732 LOperand* right = NULL;
733 int constant_value = 0; 733 int constant_value = 0;
734 bool does_deopt = false;
734 if (right_value->IsConstant()) { 735 if (right_value->IsConstant()) {
735 HConstant* constant = HConstant::cast(right_value); 736 HConstant* constant = HConstant::cast(right_value);
736 right = chunk_->DefineConstantOperand(constant); 737 right = chunk_->DefineConstantOperand(constant);
737 constant_value = constant->Integer32Value() & 0x1f; 738 constant_value = constant->Integer32Value() & 0x1f;
739 // Left shifts can deoptimize if we shift by > 0 and the result cannot be
740 // truncated to smi.
741 if (instr->representation().IsSmi() && constant_value > 0) {
742 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
743 if (!it.value()->CheckFlag(HValue::kTruncatingToSmi)) {
744 does_deopt = true;
745 break;
746 }
747 }
748 }
738 } else { 749 } else {
739 right = UseRegisterAtStart(right_value); 750 right = UseRegisterAtStart(right_value);
740 } 751 }
741 752
742 // Shift operations can only deoptimize if we do a logical shift 753 // Shift operations can deoptimize if we do a logical shift
743 // by 0 and the result cannot be truncated to int32. 754 // by 0 and the result cannot be truncated to int32.
744 bool does_deopt = false;
745 if (op == Token::SHR && constant_value == 0) { 755 if (op == Token::SHR && constant_value == 0) {
746 if (FLAG_opt_safe_uint32_operations) { 756 if (FLAG_opt_safe_uint32_operations) {
747 does_deopt = !instr->CheckFlag(HInstruction::kUint32); 757 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
748 } else { 758 } else {
749 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 759 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
750 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { 760 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
751 does_deopt = true; 761 does_deopt = true;
752 break; 762 break;
753 } 763 }
754 } 764 }
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 2569
2560 2570
2561 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2571 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2562 LOperand* object = UseRegister(instr->object()); 2572 LOperand* object = UseRegister(instr->object());
2563 LOperand* index = UseRegister(instr->index()); 2573 LOperand* index = UseRegister(instr->index());
2564 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2574 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2565 } 2575 }
2566 2576
2567 2577
2568 } } // namespace v8::internal 2578 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698