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-inl.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // with the effect input to {node}. | 23 // with the effect input to {node}. |
24 // TODO(turbofan): replace the effect input to {node} with {graph->start()}. | 24 // TODO(turbofan): replace the effect input to {node} with {graph->start()}. |
25 // TODO(titzer): move into a GraphEditor? | 25 // TODO(titzer): move into a GraphEditor? |
26 static void RelaxEffects(Node* node) { | 26 static void RelaxEffects(Node* node) { |
27 NodeProperties::ReplaceWithValue(node, node, NULL); | 27 NodeProperties::ReplaceWithValue(node, node, NULL); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone) | 31 JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone) |
32 : jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) { | 32 : jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) { |
33 Handle<Object> zero = factory()->NewNumber(0.0); | 33 zero_range_ = Type::Range(0.0, 1.0, graph()->zone()); |
34 Handle<Object> one = factory()->NewNumber(1.0); | 34 one_range_ = Type::Range(1.0, 1.0, graph()->zone()); |
35 zero_range_ = Type::Range(zero, zero, graph()->zone()); | 35 zero_thirtyone_range_ = Type::Range(0.0, 31.0, graph()->zone()); |
36 one_range_ = Type::Range(one, one, graph()->zone()); | |
37 Handle<Object> thirtyone = factory()->NewNumber(31.0); | |
38 zero_thirtyone_range_ = Type::Range(zero, thirtyone, graph()->zone()); | |
39 // TODO(jarin): Can we have a correctification of the stupid type system? | 36 // TODO(jarin): Can we have a correctification of the stupid type system? |
40 // These stupid work-arounds are just stupid! | 37 // These stupid work-arounds are just stupid! |
41 shifted_int32_ranges_[0] = Type::Signed32(); | 38 shifted_int32_ranges_[0] = Type::Signed32(); |
42 if (SmiValuesAre31Bits()) { | 39 if (SmiValuesAre31Bits()) { |
43 shifted_int32_ranges_[1] = Type::SignedSmall(); | 40 shifted_int32_ranges_[1] = Type::SignedSmall(); |
44 for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) { | 41 for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) { |
45 Handle<Object> min = factory()->NewNumber(kMinInt / (1 << k)); | 42 double min = kMinInt / (1 << k); |
46 Handle<Object> max = factory()->NewNumber(kMaxInt / (1 << k)); | 43 double max = kMaxInt / (1 << k); |
47 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); | 44 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); |
48 } | 45 } |
49 } else { | 46 } else { |
50 for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) { | 47 for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) { |
51 Handle<Object> min = factory()->NewNumber(kMinInt / (1 << k)); | 48 double min = kMinInt / (1 << k); |
52 Handle<Object> max = factory()->NewNumber(kMaxInt / (1 << k)); | 49 double max = kMaxInt / (1 << k); |
53 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); | 50 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); |
54 } | 51 } |
55 } | 52 } |
56 } | 53 } |
57 | 54 |
58 | 55 |
59 Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) { | 56 Reduction JSTypedLowering::ReplaceEagerly(Node* old, Node* node) { |
60 NodeProperties::ReplaceWithValue(old, node, node); | 57 NodeProperties::ReplaceWithValue(old, node, node); |
61 return Changed(node); | 58 return Changed(node); |
62 } | 59 } |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } | 1009 } |
1013 | 1010 |
1014 | 1011 |
1015 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1012 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1016 return jsgraph()->machine(); | 1013 return jsgraph()->machine(); |
1017 } | 1014 } |
1018 | 1015 |
1019 } // namespace compiler | 1016 } // namespace compiler |
1020 } // namespace internal | 1017 } // namespace internal |
1021 } // namespace v8 | 1018 } // namespace v8 |
OLD | NEW |