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

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

Issue 22152003: Never hchange nan-hole to hole or hole to nan-hole. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also change in header Created 7 years, 4 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-mark-deoptimize.cc ('k') | src/ia32/lithium-codegen-ia32.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 95 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-mark-deoptimize.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698