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/js-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (r.InputsMatchOne(Type::Number())) { | 100 if (r.InputsMatchOne(Type::Number())) { |
101 // Math.max(a:number) -> a | 101 // Math.max(a:number) -> a |
102 return Replace(r.left()); | 102 return Replace(r.left()); |
103 } | 103 } |
104 if (r.InputsMatchAll(Type::Integral32())) { | 104 if (r.InputsMatchAll(Type::Integral32())) { |
105 // Math.max(a:int32, b:int32, ...) | 105 // Math.max(a:int32, b:int32, ...) |
106 Node* value = r.GetJSCallInput(0); | 106 Node* value = r.GetJSCallInput(0); |
107 for (int i = 1; i < r.GetJSCallArity(); i++) { | 107 for (int i = 1; i < r.GetJSCallArity(); i++) { |
108 Node* const input = r.GetJSCallInput(i); | 108 Node* const input = r.GetJSCallInput(i); |
109 value = graph()->NewNode( | 109 value = graph()->NewNode( |
110 common()->Select(kMachNone), | 110 common()->Select(MachineRepresentation::kNone), |
111 graph()->NewNode(simplified()->NumberLessThan(), input, value), value, | 111 graph()->NewNode(simplified()->NumberLessThan(), input, value), value, |
112 input); | 112 input); |
113 } | 113 } |
114 return Replace(value); | 114 return Replace(value); |
115 } | 115 } |
116 return NoChange(); | 116 return NoChange(); |
117 } | 117 } |
118 | 118 |
119 | 119 |
120 // ES6 draft 08-24-14, section 20.2.2.19. | 120 // ES6 draft 08-24-14, section 20.2.2.19. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { | 189 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { |
190 return jsgraph()->simplified(); | 190 return jsgraph()->simplified(); |
191 } | 191 } |
192 | 192 |
193 } // namespace compiler | 193 } // namespace compiler |
194 } // namespace internal | 194 } // namespace internal |
195 } // namespace v8 | 195 } // namespace v8 |
OLD | NEW |