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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/node-aux-data-inl.h" | 8 #include "src/compiler/node-aux-data-inl.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties.h" |
| 11 #include "src/compiler/operator-properties.h" |
11 #include "src/types.h" | 12 #include "src/types.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 namespace compiler { | 16 namespace compiler { |
16 | 17 |
17 // TODO(turbofan): js-typed-lowering improvements possible | 18 // TODO(turbofan): js-typed-lowering improvements possible |
18 // - immediately put in type bounds for all new nodes | 19 // - immediately put in type bounds for all new nodes |
19 // - relax effects from generic but not-side-effecting operations | 20 // - relax effects from generic but not-side-effecting operations |
20 | 21 |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); | 848 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); |
848 node->RemoveInput(2); | 849 node->RemoveInput(2); |
849 DCHECK_EQ(4, node->InputCount()); | 850 DCHECK_EQ(4, node->InputCount()); |
850 return Changed(node); | 851 return Changed(node); |
851 } | 852 } |
852 | 853 |
853 | 854 |
854 Reduction JSTypedLowering::Reduce(Node* node) { | 855 Reduction JSTypedLowering::Reduce(Node* node) { |
855 // Check if the output type is a singleton. In that case we already know the | 856 // Check if the output type is a singleton. In that case we already know the |
856 // result value and can simply replace the node if it's eliminable. | 857 // result value and can simply replace the node if it's eliminable. |
857 if (!IrOpcode::IsConstantOpcode(node->opcode()) && | 858 if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) && |
858 NodeProperties::IsTyped(node) && | |
859 node->op()->HasProperty(Operator::kEliminatable)) { | 859 node->op()->HasProperty(Operator::kEliminatable)) { |
860 Type* upper = NodeProperties::GetBounds(node).upper; | 860 Type* upper = NodeProperties::GetBounds(node).upper; |
861 if (upper->IsConstant()) { | 861 if (upper->IsConstant()) { |
862 Node* replacement = jsgraph()->Constant(upper->AsConstant()->Value()); | 862 Node* replacement = jsgraph()->Constant(upper->AsConstant()->Value()); |
863 NodeProperties::ReplaceWithValue(node, replacement); | 863 NodeProperties::ReplaceWithValue(node, replacement); |
864 return Changed(replacement); | 864 return Changed(replacement); |
865 } else if (upper->Is(Type::MinusZero())) { | 865 } else if (upper->Is(Type::MinusZero())) { |
866 Node* replacement = jsgraph()->Constant(factory()->minus_zero_value()); | 866 Node* replacement = jsgraph()->Constant(factory()->minus_zero_value()); |
867 NodeProperties::ReplaceWithValue(node, replacement); | 867 NodeProperties::ReplaceWithValue(node, replacement); |
868 return Changed(replacement); | 868 return Changed(replacement); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 1009 } |
1010 | 1010 |
1011 | 1011 |
1012 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1012 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1013 return jsgraph()->machine(); | 1013 return jsgraph()->machine(); |
1014 } | 1014 } |
1015 | 1015 |
1016 } // namespace compiler | 1016 } // namespace compiler |
1017 } // namespace internal | 1017 } // namespace internal |
1018 } // namespace v8 | 1018 } // namespace v8 |
OLD | NEW |