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

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

Issue 10874047: MIPS: Allow uint32 value on optimized frames if they are consumed by safe operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on r12414 Created 8 years, 3 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-mips.h ('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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 LOperand* right = NULL; 697 LOperand* right = NULL;
698 int constant_value = 0; 698 int constant_value = 0;
699 if (right_value->IsConstant()) { 699 if (right_value->IsConstant()) {
700 HConstant* constant = HConstant::cast(right_value); 700 HConstant* constant = HConstant::cast(right_value);
701 right = chunk_->DefineConstantOperand(constant); 701 right = chunk_->DefineConstantOperand(constant);
702 constant_value = constant->Integer32Value() & 0x1f; 702 constant_value = constant->Integer32Value() & 0x1f;
703 } else { 703 } else {
704 right = UseRegisterAtStart(right_value); 704 right = UseRegisterAtStart(right_value);
705 } 705 }
706 706
707 // Shift operations can only deoptimize if we do a logical shift
708 // by 0 and the result cannot be truncated to int32.
709 bool may_deopt = (op == Token::SHR && constant_value == 0);
710 bool does_deopt = false; 707 bool does_deopt = false;
711 if (may_deopt) { 708
712 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 709 if (FLAG_opt_safe_uint32_operations) {
713 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) { 710 does_deopt = !instr->CheckFlag(HInstruction::kUint32);
714 does_deopt = true; 711 } else {
715 break; 712 // Shift operations can only deoptimize if we do a logical shift
713 // by 0 and the result cannot be truncated to int32.
714 bool may_deopt = (op == Token::SHR && constant_value == 0);
715 if (may_deopt) {
716 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
717 if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
718 does_deopt = true;
719 break;
720 }
716 } 721 }
717 } 722 }
718 } 723 }
719 724
720 LInstruction* result = 725 LInstruction* result =
721 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); 726 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt));
722 return does_deopt ? AssignEnvironment(result) : result; 727 return does_deopt ? AssignEnvironment(result) : result;
723 } 728 }
724 729
725 730
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 LOperand* value = UseRegister(instr->value()); 1577 LOperand* value = UseRegister(instr->value());
1573 LOperand* temp1 = TempRegister(); 1578 LOperand* temp1 = TempRegister();
1574 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; 1579 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL;
1575 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); 1580 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2);
1576 return AssignEnvironment(DefineAsRegister(res)); 1581 return AssignEnvironment(DefineAsRegister(res));
1577 } 1582 }
1578 } else if (from.IsInteger32()) { 1583 } else if (from.IsInteger32()) {
1579 if (to.IsTagged()) { 1584 if (to.IsTagged()) {
1580 HValue* val = instr->value(); 1585 HValue* val = instr->value();
1581 LOperand* value = UseRegisterAtStart(val); 1586 LOperand* value = UseRegisterAtStart(val);
1582 if (val->HasRange() && val->range()->IsInSmiRange()) { 1587 if (val->CheckFlag(HInstruction::kUint32)) {
1588 LNumberTagU* result = new(zone()) LNumberTagU(value);
1589 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1590 } else if (val->HasRange() && val->range()->IsInSmiRange()) {
1583 return DefineAsRegister(new(zone()) LSmiTag(value)); 1591 return DefineAsRegister(new(zone()) LSmiTag(value));
1584 } else { 1592 } else {
1585 LNumberTagI* result = new(zone()) LNumberTagI(value); 1593 LNumberTagI* result = new(zone()) LNumberTagI(value);
1586 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1594 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1587 } 1595 }
1588 } else { 1596 } else {
1589 ASSERT(to.IsDouble()); 1597 ASSERT(to.IsDouble());
1590 LOperand* value = Use(instr->value()); 1598 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1591 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); 1599 return DefineAsRegister(
1600 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
1601 } else {
1602 return DefineAsRegister(
1603 new(zone()) LInteger32ToDouble(Use(instr->value())));
1604 }
1592 } 1605 }
1593 } 1606 }
1594 UNREACHABLE(); 1607 UNREACHABLE();
1595 return NULL; 1608 return NULL;
1596 } 1609 }
1597 1610
1598 1611
1599 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1612 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1600 LOperand* value = UseRegisterAtStart(instr->value()); 1613 LOperand* value = UseRegisterAtStart(instr->value());
1601 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); 1614 return AssignEnvironment(new(zone()) LCheckNonSmi(value));
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 2245
2233 2246
2234 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2247 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2235 LOperand* object = UseRegister(instr->object()); 2248 LOperand* object = UseRegister(instr->object());
2236 LOperand* index = UseRegister(instr->index()); 2249 LOperand* index = UseRegister(instr->index());
2237 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2250 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2238 } 2251 }
2239 2252
2240 2253
2241 } } // namespace v8::internal 2254 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698