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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 16240003: Improve smi support in crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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-instructions.h ('k') | src/lithium-allocator.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 return Representation::None(); 118 return Representation::None();
119 } 119 }
120 120
121 121
122 void HValue::UpdateRepresentation(Representation new_rep, 122 void HValue::UpdateRepresentation(Representation new_rep,
123 HInferRepresentation* h_infer, 123 HInferRepresentation* h_infer,
124 const char* reason) { 124 const char* reason) {
125 Representation r = representation(); 125 Representation r = representation();
126 if (new_rep.is_more_general_than(r)) { 126 if (new_rep.is_more_general_than(r)) {
127 // When an HConstant is marked "not convertible to integer", then 127 if (FLAG_trace_representation) {
128 // never try to represent it as an integer. 128 PrintF("Changing #%d %s representation %s -> %s based on %s\n",
129 if (new_rep.IsInteger32() && !IsConvertibleToInteger()) { 129 id(), Mnemonic(), r.Mnemonic(), new_rep.Mnemonic(), reason);
130 new_rep = Representation::Tagged();
131 if (FLAG_trace_representation) {
132 PrintF("Changing #%d %s representation %s -> %s because it's NCTI"
133 " (%s want i)\n",
134 id(), Mnemonic(), r.Mnemonic(), new_rep.Mnemonic(), reason);
135 }
136 } else {
137 if (FLAG_trace_representation) {
138 PrintF("Changing #%d %s representation %s -> %s based on %s\n",
139 id(), Mnemonic(), r.Mnemonic(), new_rep.Mnemonic(), reason);
140 }
141 } 130 }
142 ChangeRepresentation(new_rep); 131 ChangeRepresentation(new_rep);
143 AddDependantsToWorklist(h_infer); 132 AddDependantsToWorklist(h_infer);
144 } 133 }
145 } 134 }
146 135
147 136
148 void HValue::AddDependantsToWorklist(HInferRepresentation* h_infer) { 137 void HValue::AddDependantsToWorklist(HInferRepresentation* h_infer) {
149 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 138 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
150 h_infer->AddToWorklist(it.value()); 139 h_infer->AddToWorklist(it.value());
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 stream->Add(" "); 1908 stream->Add(" ");
1920 value->PrintNameTo(stream); 1909 value->PrintNameTo(stream);
1921 stream->Add(" "); 1910 stream->Add(" ");
1922 } 1911 }
1923 stream->Add(" uses:%d_%ds_%di_%dd_%dt", 1912 stream->Add(" uses:%d_%ds_%di_%dd_%dt",
1924 UseCount(), 1913 UseCount(),
1925 smi_non_phi_uses() + smi_indirect_uses(), 1914 smi_non_phi_uses() + smi_indirect_uses(),
1926 int32_non_phi_uses() + int32_indirect_uses(), 1915 int32_non_phi_uses() + int32_indirect_uses(),
1927 double_non_phi_uses() + double_indirect_uses(), 1916 double_non_phi_uses() + double_indirect_uses(),
1928 tagged_non_phi_uses() + tagged_indirect_uses()); 1917 tagged_non_phi_uses() + tagged_indirect_uses());
1929 if (!IsConvertibleToInteger()) stream->Add("_ncti");
1930 PrintRangeTo(stream); 1918 PrintRangeTo(stream);
1931 PrintTypeTo(stream); 1919 PrintTypeTo(stream);
1932 stream->Add("]"); 1920 stream->Add("]");
1933 } 1921 }
1934 1922
1935 1923
1936 void HPhi::AddInput(HValue* value) { 1924 void HPhi::AddInput(HValue* value) {
1937 inputs_.Add(NULL, value->block()->zone()); 1925 inputs_.Add(NULL, value->block()->zone());
1938 SetOperandAt(OperandCount() - 1, value); 1926 SetOperandAt(OperandCount() - 1, value);
1939 // Mark phis that may have 'arguments' directly or indirectly as an operand. 1927 // Mark phis that may have 'arguments' directly or indirectly as an operand.
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3558 Representation new_rep = RepresentationFromInputs(); 3546 Representation new_rep = RepresentationFromInputs();
3559 UpdateRepresentation(new_rep, h_infer, "inputs"); 3547 UpdateRepresentation(new_rep, h_infer, "inputs");
3560 new_rep = RepresentationFromUses(); 3548 new_rep = RepresentationFromUses();
3561 UpdateRepresentation(new_rep, h_infer, "uses"); 3549 UpdateRepresentation(new_rep, h_infer, "uses");
3562 new_rep = RepresentationFromUseRequirements(); 3550 new_rep = RepresentationFromUseRequirements();
3563 UpdateRepresentation(new_rep, h_infer, "use requirements"); 3551 UpdateRepresentation(new_rep, h_infer, "use requirements");
3564 } 3552 }
3565 3553
3566 3554
3567 Representation HPhi::RepresentationFromInputs() { 3555 Representation HPhi::RepresentationFromInputs() {
3568 bool double_occurred = false; 3556 Representation r = Representation::None();
3569 bool int32_occurred = false;
3570 bool smi_occurred = false;
3571 for (int i = 0; i < OperandCount(); ++i) { 3557 for (int i = 0; i < OperandCount(); ++i) {
3572 HValue* value = OperandAt(i); 3558 r = r.generalize(OperandAt(i)->KnownOptimalRepresentation());
3573 if (value->IsUnknownOSRValue()) {
3574 HPhi* hint_value = HUnknownOSRValue::cast(value)->incoming_value();
3575 if (hint_value != NULL) {
3576 Representation hint = hint_value->representation();
3577 if (hint.IsTagged()) return hint;
3578 if (hint.IsDouble()) double_occurred = true;
3579 if (hint.IsInteger32()) int32_occurred = true;
3580 if (hint.IsSmi()) smi_occurred = true;
3581 }
3582 continue;
3583 }
3584 if (value->representation().IsDouble()) double_occurred = true;
3585 if (value->representation().IsInteger32()) int32_occurred = true;
3586 if (value->representation().IsSmi()) smi_occurred = true;
3587 if (value->representation().IsTagged()) {
3588 if (value->IsConstant()) {
3589 HConstant* constant = HConstant::cast(value);
3590 if (constant->IsConvertibleToInteger()) {
3591 int32_occurred = true;
3592 } else if (constant->HasNumberValue()) {
3593 double_occurred = true;
3594 } else {
3595 return Representation::Tagged();
3596 }
3597 } else {
3598 if (value->IsPhi() && !IsConvertibleToInteger()) {
3599 return Representation::Tagged();
3600 }
3601 }
3602 }
3603 } 3559 }
3604 3560
3605 if (double_occurred) return Representation::Double(); 3561 return r;
3606 if (int32_occurred) return Representation::Integer32();
3607 if (smi_occurred) return Representation::Smi();
3608
3609 return Representation::None();
3610 } 3562 }
3611 3563
3612 3564
3613 Representation HPhi::RepresentationFromUseRequirements() { 3565 Representation HPhi::RepresentationFromUseRequirements() {
3614 Representation all_uses_require = Representation::None(); 3566 Representation all_uses_require = Representation::None();
3615 bool all_uses_require_the_same = true; 3567 bool all_uses_require_the_same = true;
3616 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 3568 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
3617 // We check for observed_input_representation elsewhere. 3569 // We check for observed_input_representation elsewhere.
3618 Representation use_rep = 3570 Representation use_rep =
3619 it.value()->RequiredInputRepresentation(it.index()); 3571 it.value()->RequiredInputRepresentation(it.index());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 case kBackingStore: 3757 case kBackingStore:
3806 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3758 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3807 stream->Add("[backing-store]"); 3759 stream->Add("[backing-store]");
3808 break; 3760 break;
3809 } 3761 }
3810 3762
3811 stream->Add("@%d", offset()); 3763 stream->Add("@%d", offset());
3812 } 3764 }
3813 3765
3814 } } // namespace v8::internal 3766 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698