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

Side by Side Diff: src/hydrogen.cc

Issue 6615012: Mark HChange that convert to int32 with truncation with the appropiate flag.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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/hydrogen.h ('k') | src/hydrogen-instructions.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 PropagateMinusZeroChecks(div->right(), visited); 1656 PropagateMinusZeroChecks(div->right(), visited);
1657 } 1657 }
1658 1658
1659 current = current->EnsureAndPropagateNotMinusZero(visited); 1659 current = current->EnsureAndPropagateNotMinusZero(visited);
1660 } 1660 }
1661 } 1661 }
1662 1662
1663 1663
1664 void HGraph::InsertRepresentationChangeForUse(HValue* value, 1664 void HGraph::InsertRepresentationChangeForUse(HValue* value,
1665 HValue* use, 1665 HValue* use,
1666 Representation to, 1666 Representation to) {
1667 bool is_truncating) {
1668 // Insert the representation change right before its use. For phi-uses we 1667 // Insert the representation change right before its use. For phi-uses we
1669 // insert at the end of the corresponding predecessor. 1668 // insert at the end of the corresponding predecessor.
1670 HInstruction* next = NULL; 1669 HInstruction* next = NULL;
1671 if (use->IsPhi()) { 1670 if (use->IsPhi()) {
1672 int index = 0; 1671 int index = 0;
1673 while (use->OperandAt(index) != value) ++index; 1672 while (use->OperandAt(index) != value) ++index;
1674 next = use->block()->predecessors()->at(index)->end(); 1673 next = use->block()->predecessors()->at(index)->end();
1675 } else { 1674 } else {
1676 next = HInstruction::cast(use); 1675 next = HInstruction::cast(use);
1677 } 1676 }
1678 1677
1679 // For constants we try to make the representation change at compile 1678 // For constants we try to make the representation change at compile
1680 // time. When a representation change is not possible without loss of 1679 // time. When a representation change is not possible without loss of
1681 // information we treat constants like normal instructions and insert the 1680 // information we treat constants like normal instructions and insert the
1682 // change instructions for them. 1681 // change instructions for them.
1683 HInstruction* new_value = NULL; 1682 HInstruction* new_value = NULL;
1683 bool is_truncating = use->CheckFlag(HValue::kTruncatingToInt32);
1684 if (value->IsConstant()) { 1684 if (value->IsConstant()) {
1685 HConstant* constant = HConstant::cast(value); 1685 HConstant* constant = HConstant::cast(value);
1686 // Try to create a new copy of the constant with the new representation. 1686 // Try to create a new copy of the constant with the new representation.
1687 new_value = is_truncating 1687 new_value = is_truncating
1688 ? constant->CopyToTruncatedInt32() 1688 ? constant->CopyToTruncatedInt32()
1689 : constant->CopyToRepresentation(to); 1689 : constant->CopyToRepresentation(to);
1690 } 1690 }
1691 1691
1692 if (new_value == NULL) { 1692 if (new_value == NULL) {
1693 new_value = new HChange(value, value->representation(), to); 1693 new_value = new HChange(value, value->representation(), to, is_truncating);
1694 } 1694 }
1695 1695
1696 new_value->InsertBefore(next); 1696 new_value->InsertBefore(next);
1697 value->ReplaceFirstAtUse(use, new_value, to); 1697 value->ReplaceFirstAtUse(use, new_value, to);
1698 } 1698 }
1699 1699
1700 1700
1701 int CompareConversionUses(HValue* a, 1701 int CompareConversionUses(HValue* a,
1702 HValue* b, 1702 HValue* b,
1703 Representation a_rep, 1703 Representation a_rep,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 current->id(), 1758 current->id(),
1759 use->id()); 1759 use->id());
1760 } 1760 }
1761 to_convert.InsertAt(index, use); 1761 to_convert.InsertAt(index, use);
1762 to_convert_reps.InsertAt(index, req); 1762 to_convert_reps.InsertAt(index, req);
1763 } 1763 }
1764 1764
1765 for (int i = 0; i < to_convert.length(); ++i) { 1765 for (int i = 0; i < to_convert.length(); ++i) {
1766 HValue* use = to_convert[i]; 1766 HValue* use = to_convert[i];
1767 Representation r_to = to_convert_reps[i]; 1767 Representation r_to = to_convert_reps[i];
1768 bool is_truncating = use->CheckFlag(HValue::kTruncatingToInt32); 1768 InsertRepresentationChangeForUse(current, use, r_to);
1769 InsertRepresentationChangeForUse(current, use, r_to, is_truncating);
1770 } 1769 }
1771 1770
1772 if (current->uses()->is_empty()) { 1771 if (current->uses()->is_empty()) {
1773 ASSERT(current->IsConstant()); 1772 ASSERT(current->IsConstant());
1774 current->Delete(); 1773 current->Delete();
1775 } 1774 }
1776 } 1775 }
1777 1776
1778 1777
1779 void HGraph::InsertRepresentationChanges() { 1778 void HGraph::InsertRepresentationChanges() {
(...skipping 4227 matching lines...) Expand 10 before | Expand all | Expand 10 after
6007 } 6006 }
6008 } 6007 }
6009 6008
6010 #ifdef DEBUG 6009 #ifdef DEBUG
6011 if (graph_ != NULL) graph_->Verify(); 6010 if (graph_ != NULL) graph_->Verify();
6012 if (allocator_ != NULL) allocator_->Verify(); 6011 if (allocator_ != NULL) allocator_->Verify();
6013 #endif 6012 #endif
6014 } 6013 }
6015 6014
6016 } } // namespace v8::internal 6015 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698