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/typer.h" | 5 #include "src/compiler/typer.h" |
6 | 6 |
7 #include "src/base/flags.h" | 7 #include "src/base/flags.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 Reduction UpdateType(Node* node, Type* current) { | 255 Reduction UpdateType(Node* node, Type* current) { |
256 if (NodeProperties::IsTyped(node)) { | 256 if (NodeProperties::IsTyped(node)) { |
257 // Widen the type of a previously typed node. | 257 // Widen the type of a previously typed node. |
258 Type* previous = NodeProperties::GetType(node); | 258 Type* previous = NodeProperties::GetType(node); |
259 if (node->opcode() == IrOpcode::kPhi) { | 259 if (node->opcode() == IrOpcode::kPhi) { |
260 // Speed up termination in the presence of range types: | 260 // Speed up termination in the presence of range types: |
261 current = Weaken(node, current, previous); | 261 current = Weaken(node, current, previous); |
262 } | 262 } |
263 | 263 |
264 DCHECK(previous->Is(current)); | 264 CHECK(previous->Is(current)); |
265 | 265 |
266 NodeProperties::SetType(node, current); | 266 NodeProperties::SetType(node, current); |
267 if (!(previous->Is(current) && current->Is(previous))) { | 267 if (!current->Is(previous)) { |
268 // If something changed, revisit all uses. | 268 // If something changed, revisit all uses. |
269 return Changed(node); | 269 return Changed(node); |
270 } | 270 } |
271 return NoChange(); | 271 return NoChange(); |
272 } else { | 272 } else { |
273 // No previous type, simply update the type. | 273 // No previous type, simply update the type. |
274 NodeProperties::SetType(node, current); | 274 NodeProperties::SetType(node, current); |
275 return Changed(node); | 275 return Changed(node); |
276 } | 276 } |
277 } | 277 } |
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 } | 2106 } |
2107 if (Type::IsInteger(*value)) { | 2107 if (Type::IsInteger(*value)) { |
2108 return Type::Range(value->Number(), value->Number(), zone()); | 2108 return Type::Range(value->Number(), value->Number(), zone()); |
2109 } | 2109 } |
2110 return Type::Constant(value, zone()); | 2110 return Type::Constant(value, zone()); |
2111 } | 2111 } |
2112 | 2112 |
2113 } // namespace compiler | 2113 } // namespace compiler |
2114 } // namespace internal | 2114 } // namespace internal |
2115 } // namespace v8 | 2115 } // namespace v8 |
OLD | NEW |