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

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

Issue 958053003: Removed funky Maybe constructor and made fields private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/i18n.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen-representation-changes.h" 5 #include "src/hydrogen-representation-changes.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 9
10 void HRepresentationChangesPhase::InsertRepresentationChangeForUse( 10 void HRepresentationChangesPhase::InsertRepresentationChangeForUse(
(...skipping 11 matching lines...) Expand all
22 // information we treat constants like normal instructions and insert the 22 // information we treat constants like normal instructions and insert the
23 // change instructions for them. 23 // change instructions for them.
24 HInstruction* new_value = NULL; 24 HInstruction* new_value = NULL;
25 bool is_truncating_to_smi = use_value->CheckFlag(HValue::kTruncatingToSmi); 25 bool is_truncating_to_smi = use_value->CheckFlag(HValue::kTruncatingToSmi);
26 bool is_truncating_to_int = use_value->CheckFlag(HValue::kTruncatingToInt32); 26 bool is_truncating_to_int = use_value->CheckFlag(HValue::kTruncatingToInt32);
27 if (value->IsConstant()) { 27 if (value->IsConstant()) {
28 HConstant* constant = HConstant::cast(value); 28 HConstant* constant = HConstant::cast(value);
29 // Try to create a new copy of the constant with the new representation. 29 // Try to create a new copy of the constant with the new representation.
30 if (is_truncating_to_int && to.IsInteger32()) { 30 if (is_truncating_to_int && to.IsInteger32()) {
31 Maybe<HConstant*> res = constant->CopyToTruncatedInt32(graph()->zone()); 31 Maybe<HConstant*> res = constant->CopyToTruncatedInt32(graph()->zone());
32 if (res.has_value) new_value = res.value; 32 if (res.IsJust()) new_value = res.FromJust();
33 } else { 33 } else {
34 new_value = constant->CopyToRepresentation(to, graph()->zone()); 34 new_value = constant->CopyToRepresentation(to, graph()->zone());
35 } 35 }
36 } 36 }
37 37
38 if (new_value == NULL) { 38 if (new_value == NULL) {
39 new_value = new(graph()->zone()) HChange( 39 new_value = new(graph()->zone()) HChange(
40 value, to, is_truncating_to_smi, is_truncating_to_int); 40 value, to, is_truncating_to_smi, is_truncating_to_int);
41 if (!use_value->operand_position(use_index).IsUnknown()) { 41 if (!use_value->operand_position(use_index).IsUnknown()) {
42 new_value->set_position(use_value->operand_position(use_index)); 42 new_value->set_position(use_value->operand_position(use_index));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Process normal instructions. 204 // Process normal instructions.
205 for (HInstruction* current = block->first(); current != NULL; ) { 205 for (HInstruction* current = block->first(); current != NULL; ) {
206 HInstruction* next = current->next(); 206 HInstruction* next = current->next();
207 InsertRepresentationChangesForValue(current); 207 InsertRepresentationChangesForValue(current);
208 current = next; 208 current = next;
209 } 209 }
210 } 210 }
211 } 211 }
212 212
213 } } // namespace v8::internal 213 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698