OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/load-elimination.h" | 5 #include "src/compiler/load-elimination.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | |
8 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
9 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
11 #include "src/types.h" | 10 #include "src/types.h" |
12 | 11 |
13 namespace v8 { | 12 namespace v8 { |
14 namespace internal { | 13 namespace internal { |
15 namespace compiler { | 14 namespace compiler { |
16 | 15 |
17 LoadElimination::~LoadElimination() {} | 16 LoadElimination::~LoadElimination() {} |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Type* stored_value_type = NodeProperties::GetType(value); | 49 Type* stored_value_type = NodeProperties::GetType(value); |
51 Type* load_type = NodeProperties::GetType(node); | 50 Type* load_type = NodeProperties::GetType(node); |
52 // Make sure the replacement's type is a subtype of the node's | 51 // Make sure the replacement's type is a subtype of the node's |
53 // type. Otherwise we could confuse optimizations that were | 52 // type. Otherwise we could confuse optimizations that were |
54 // based on the original type. | 53 // based on the original type. |
55 if (stored_value_type->Is(load_type)) { | 54 if (stored_value_type->Is(load_type)) { |
56 ReplaceWithValue(node, value); | 55 ReplaceWithValue(node, value); |
57 return Replace(value); | 56 return Replace(value); |
58 } else { | 57 } else { |
59 Node* renamed = graph()->NewNode( | 58 Node* renamed = graph()->NewNode( |
60 common()->Guard(Type::Intersect(stored_value_type, load_type, | 59 simplified()->TypeGuard(Type::Intersect( |
61 graph()->zone())), | 60 stored_value_type, load_type, graph()->zone())), |
62 value, NodeProperties::GetControlInput(node)); | 61 value, NodeProperties::GetControlInput(node)); |
63 ReplaceWithValue(node, renamed); | 62 ReplaceWithValue(node, renamed); |
64 return Replace(renamed); | 63 return Replace(renamed); |
65 } | 64 } |
66 } | 65 } |
67 // TODO(turbofan): Alias analysis to the rescue? | 66 // TODO(turbofan): Alias analysis to the rescue? |
68 return NoChange(); | 67 return NoChange(); |
69 } | 68 } |
70 break; | 69 break; |
71 } | 70 } |
(...skipping 24 matching lines...) Expand all Loading... |
96 } | 95 } |
97 } | 96 } |
98 } | 97 } |
99 UNREACHABLE(); | 98 UNREACHABLE(); |
100 return NoChange(); | 99 return NoChange(); |
101 } | 100 } |
102 | 101 |
103 } // namespace compiler | 102 } // namespace compiler |
104 } // namespace internal | 103 } // namespace internal |
105 } // namespace v8 | 104 } // namespace v8 |
OLD | NEW |