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

Side by Side Diff: src/hydrogen.cc

Issue 8277031: Give uses within a loop a greater weight when doing representation inference. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 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
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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 1645
1646 Representation HInferRepresentation::TryChange(HValue* value) { 1646 Representation HInferRepresentation::TryChange(HValue* value) {
1647 // Array of use counts for each representation. 1647 // Array of use counts for each representation.
1648 int use_count[Representation::kNumRepresentations] = { 0 }; 1648 int use_count[Representation::kNumRepresentations] = { 0 };
1649 1649
1650 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { 1650 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) {
1651 HValue* use = it.value(); 1651 HValue* use = it.value();
1652 Representation rep = use->RequiredInputRepresentation(it.index()); 1652 Representation rep = use->RequiredInputRepresentation(it.index());
1653 if (rep.IsNone()) continue; 1653 if (rep.IsNone()) continue;
1654 if (use->IsPhi()) HPhi::cast(use)->AddIndirectUsesTo(&use_count[0]); 1654 if (use->IsPhi()) HPhi::cast(use)->AddIndirectUsesTo(&use_count[0]);
1655 ++use_count[rep.kind()]; 1655 use_count[rep.kind()] += use->LoopWeight();
1656 } 1656 }
1657 int tagged_count = use_count[Representation::kTagged]; 1657 int tagged_count = use_count[Representation::kTagged];
1658 int double_count = use_count[Representation::kDouble]; 1658 int double_count = use_count[Representation::kDouble];
1659 int int32_count = use_count[Representation::kInteger32]; 1659 int int32_count = use_count[Representation::kInteger32];
1660 int non_tagged_count = double_count + int32_count; 1660 int non_tagged_count = double_count + int32_count;
1661 1661
1662 // If a non-loop phi has tagged uses, don't convert it to untagged. 1662 // If a non-loop phi has tagged uses, don't convert it to untagged.
1663 if (value->IsPhi() && !value->block()->IsLoopHeader() && tagged_count > 0) { 1663 if (value->IsPhi() && !value->block()->IsLoopHeader() && tagged_count > 0) {
1664 return Representation::None(); 1664 return Representation::None();
1665 } 1665 }
(...skipping 5321 matching lines...) Expand 10 before | Expand all | Expand 10 after
6987 } 6987 }
6988 } 6988 }
6989 6989
6990 #ifdef DEBUG 6990 #ifdef DEBUG
6991 if (graph_ != NULL) graph_->Verify(false); // No full verify. 6991 if (graph_ != NULL) graph_->Verify(false); // No full verify.
6992 if (allocator_ != NULL) allocator_->Verify(); 6992 if (allocator_ != NULL) allocator_->Verify();
6993 #endif 6993 #endif
6994 } 6994 }
6995 6995
6996 } } // namespace v8::internal 6996 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698