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/diamond.h" | 5 #include "src/compiler/diamond.h" |
6 #include "src/compiler/js-builtin-reducer.h" | 6 #include "src/compiler/js-builtin-reducer.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.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/simplified-operator.h" |
10 #include "src/objects-inl.h" | 11 #include "src/objects-inl.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 | 18 |
18 // Helper class to access JSCallFunction nodes that are potential candidates | 19 // Helper class to access JSCallFunction nodes that are potential candidates |
19 // for reduction when they have a BuiltinFunctionId associated with them. | 20 // for reduction when they have a BuiltinFunctionId associated with them. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Skip first (i.e. callee) and second (i.e. receiver) operand. | 81 // Skip first (i.e. callee) and second (i.e. receiver) operand. |
81 return NodeProperties::GetValueInput(node_, index + 2); | 82 return NodeProperties::GetValueInput(node_, index + 2); |
82 } | 83 } |
83 | 84 |
84 private: | 85 private: |
85 Node* node_; | 86 Node* node_; |
86 }; | 87 }; |
87 | 88 |
88 | 89 |
89 JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph) | 90 JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph) |
90 : AdvancedReducer(editor), | 91 : AdvancedReducer(editor), jsgraph_(jsgraph) {} |
91 jsgraph_(jsgraph), | |
92 simplified_(jsgraph->zone()) {} | |
93 | 92 |
94 | 93 |
95 // ECMA-262, section 15.8.2.11. | 94 // ECMA-262, section 15.8.2.11. |
96 Reduction JSBuiltinReducer::ReduceMathMax(Node* node) { | 95 Reduction JSBuiltinReducer::ReduceMathMax(Node* node) { |
97 JSCallReduction r(node); | 96 JSCallReduction r(node); |
98 if (r.InputsMatchZero()) { | 97 if (r.InputsMatchZero()) { |
99 // Math.max() -> -Infinity | 98 // Math.max() -> -Infinity |
100 return Replace(jsgraph()->Constant(-V8_INFINITY)); | 99 return Replace(jsgraph()->Constant(-V8_INFINITY)); |
101 } | 100 } |
102 if (r.InputsMatchOne(Type::Number())) { | 101 if (r.InputsMatchOne(Type::Number())) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 176 |
178 CommonOperatorBuilder* JSBuiltinReducer::common() const { | 177 CommonOperatorBuilder* JSBuiltinReducer::common() const { |
179 return jsgraph()->common(); | 178 return jsgraph()->common(); |
180 } | 179 } |
181 | 180 |
182 | 181 |
183 MachineOperatorBuilder* JSBuiltinReducer::machine() const { | 182 MachineOperatorBuilder* JSBuiltinReducer::machine() const { |
184 return jsgraph()->machine(); | 183 return jsgraph()->machine(); |
185 } | 184 } |
186 | 185 |
| 186 |
| 187 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { |
| 188 return jsgraph()->simplified(); |
| 189 } |
| 190 |
187 } // namespace compiler | 191 } // namespace compiler |
188 } // namespace internal | 192 } // namespace internal |
189 } // namespace v8 | 193 } // namespace v8 |
OLD | NEW |