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

Side by Side Diff: src/hydrogen-representation-changes.cc

Issue 148573005: A64: Synchronize with r16249. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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-osr.cc ('k') | src/i18n.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 29 matching lines...) Expand all
40 } else { 40 } else {
41 next = HInstruction::cast(use_value); 41 next = HInstruction::cast(use_value);
42 } 42 }
43 // For constants we try to make the representation change at compile 43 // For constants we try to make the representation change at compile
44 // time. When a representation change is not possible without loss of 44 // time. When a representation change is not possible without loss of
45 // information we treat constants like normal instructions and insert the 45 // information we treat constants like normal instructions and insert the
46 // change instructions for them. 46 // change instructions for them.
47 HInstruction* new_value = NULL; 47 HInstruction* new_value = NULL;
48 bool is_truncating_to_smi = use_value->CheckFlag(HValue::kTruncatingToSmi); 48 bool is_truncating_to_smi = use_value->CheckFlag(HValue::kTruncatingToSmi);
49 bool is_truncating_to_int = use_value->CheckFlag(HValue::kTruncatingToInt32); 49 bool is_truncating_to_int = use_value->CheckFlag(HValue::kTruncatingToInt32);
50 bool allow_undefined_as_nan =
51 use_value->CheckFlag(HValue::kAllowUndefinedAsNaN);
52 if (value->IsConstant()) { 50 if (value->IsConstant()) {
53 HConstant* constant = HConstant::cast(value); 51 HConstant* constant = HConstant::cast(value);
54 // Try to create a new copy of the constant with the new representation. 52 // Try to create a new copy of the constant with the new representation.
55 if (is_truncating_to_int && to.IsInteger32()) { 53 if (is_truncating_to_int && to.IsInteger32()) {
56 Maybe<HConstant*> res = constant->CopyToTruncatedInt32(graph()->zone()); 54 Maybe<HConstant*> res = constant->CopyToTruncatedInt32(graph()->zone());
57 if (res.has_value) new_value = res.value; 55 if (res.has_value) new_value = res.value;
58 } else { 56 } else {
59 new_value = constant->CopyToRepresentation(to, graph()->zone()); 57 new_value = constant->CopyToRepresentation(to, graph()->zone());
60 } 58 }
61 } 59 }
62 60
63 if (new_value == NULL) { 61 if (new_value == NULL) {
64 new_value = new(graph()->zone()) HChange(value, to, 62 new_value = new(graph()->zone()) HChange(
65 is_truncating_to_smi, 63 value, to, is_truncating_to_smi, is_truncating_to_int);
66 is_truncating_to_int,
67 allow_undefined_as_nan);
68 } 64 }
69 65
70 new_value->InsertBefore(next); 66 new_value->InsertBefore(next);
71 use_value->SetOperandAt(use_index, new_value); 67 use_value->SetOperandAt(use_index, new_value);
72 } 68 }
73 69
74 70
75 void HRepresentationChangesPhase::InsertRepresentationChangesForValue( 71 void HRepresentationChangesPhase::InsertRepresentationChangesForValue(
76 HValue* value) { 72 HValue* value) {
77 Representation r = value->representation(); 73 Representation r = value->representation();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { 116 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) {
121 // If a Phi is used as a non-truncating int32 or as a double, 117 // If a Phi is used as a non-truncating int32 or as a double,
122 // clear its "truncating" flag. 118 // clear its "truncating" flag.
123 HValue* use = it.value(); 119 HValue* use = it.value();
124 Representation input_representation = 120 Representation input_representation =
125 use->RequiredInputRepresentation(it.index()); 121 use->RequiredInputRepresentation(it.index());
126 if ((phi->representation().IsInteger32() && 122 if ((phi->representation().IsInteger32() &&
127 !(input_representation.IsInteger32() && 123 !(input_representation.IsInteger32() &&
128 use->CheckFlag(HValue::kTruncatingToInt32))) || 124 use->CheckFlag(HValue::kTruncatingToInt32))) ||
129 (phi->representation().IsSmi() && 125 (phi->representation().IsSmi() &&
130 !(input_representation.IsSmi() || 126 !(input_representation.IsSmi() &&
131 use->CheckFlag(HValue::kTruncatingToSmi)))) { 127 use->CheckFlag(HValue::kTruncatingToSmi)))) {
132 if (FLAG_trace_representation) { 128 if (FLAG_trace_representation) {
133 PrintF("#%d Phi is not truncating because of #%d %s\n", 129 PrintF("#%d Phi is not truncating because of #%d %s\n",
134 phi->id(), it.value()->id(), it.value()->Mnemonic()); 130 phi->id(), it.value()->id(), it.value()->Mnemonic());
135 } 131 }
136 phi->ClearFlag(HValue::kTruncatingToInt32); 132 phi->ClearFlag(HValue::kTruncatingToInt32);
137 phi->ClearFlag(HValue::kTruncatingToSmi); 133 phi->ClearFlag(HValue::kTruncatingToSmi);
138 worklist.Add(phi, zone()); 134 worklist.Add(phi, zone());
139 break; 135 break;
140 } 136 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Process normal instructions. 169 // Process normal instructions.
174 for (HInstruction* current = block->first(); current != NULL; ) { 170 for (HInstruction* current = block->first(); current != NULL; ) {
175 HInstruction* next = current->next(); 171 HInstruction* next = current->next();
176 InsertRepresentationChangesForValue(current); 172 InsertRepresentationChangesForValue(current);
177 current = next; 173 current = next;
178 } 174 }
179 } 175 }
180 } 176 }
181 177
182 } } // namespace v8::internal 178 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-osr.cc ('k') | src/i18n.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698