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-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Relax the control uses of {node} by immediately replacing them with the | 31 // Relax the control uses of {node} by immediately replacing them with the |
32 // control input to {node}. | 32 // control input to {node}. |
33 // TODO(titzer): move into a GraphEditor? | 33 // TODO(titzer): move into a GraphEditor? |
34 static void RelaxControls(Node* node) { | 34 static void RelaxControls(Node* node) { |
35 NodeProperties::ReplaceWithValue(node, node, node); | 35 NodeProperties::ReplaceWithValue(node, node, node); |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone) | 39 JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone) |
40 : jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) { | 40 : jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) { |
41 zero_range_ = Type::Range(0.0, 1.0, graph()->zone()); | 41 zero_range_ = Type::Range(0.0, 0.0, graph()->zone()); |
42 one_range_ = Type::Range(1.0, 1.0, graph()->zone()); | 42 one_range_ = Type::Range(1.0, 1.0, graph()->zone()); |
43 zero_thirtyone_range_ = Type::Range(0.0, 31.0, graph()->zone()); | 43 zero_thirtyone_range_ = Type::Range(0.0, 31.0, graph()->zone()); |
44 // TODO(jarin): Can we have a correctification of the stupid type system? | 44 for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) { |
45 // These stupid work-arounds are just stupid! | 45 double min = kMinInt / (1 << k); |
46 shifted_int32_ranges_[0] = Type::Signed32(); | 46 double max = kMaxInt / (1 << k); |
47 if (SmiValuesAre31Bits()) { | 47 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); |
48 shifted_int32_ranges_[1] = Type::SignedSmall(); | |
49 for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) { | |
50 double min = kMinInt / (1 << k); | |
51 double max = kMaxInt / (1 << k); | |
52 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); | |
53 } | |
54 } else { | |
55 for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) { | |
56 double min = kMinInt / (1 << k); | |
57 double max = kMaxInt / (1 << k); | |
58 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); | |
59 } | |
60 } | 48 } |
61 } | 49 } |
62 | 50 |
63 | 51 |
64 Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) { | 52 Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) { |
65 NodeProperties::ReplaceWithValue(old, node, node); | 53 NodeProperties::ReplaceWithValue(old, node, node); |
66 return Changed(node); | 54 return Changed(node); |
67 } | 55 } |
68 | 56 |
69 | 57 |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 } | 1018 } |
1031 | 1019 |
1032 | 1020 |
1033 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1021 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1034 return jsgraph()->machine(); | 1022 return jsgraph()->machine(); |
1035 } | 1023 } |
1036 | 1024 |
1037 } // namespace compiler | 1025 } // namespace compiler |
1038 } // namespace internal | 1026 } // namespace internal |
1039 } // namespace v8 | 1027 } // namespace v8 |
OLD | NEW |