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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Math.imul(a:int32, b:int32) -> Int32Mul(a, b) | 125 // Math.imul(a:int32, b:int32) -> Int32Mul(a, b) |
126 Node* value = graph()->NewNode(machine()->Int32Mul(), r.left(), r.right()); | 126 Node* value = graph()->NewNode(machine()->Int32Mul(), r.left(), r.right()); |
127 return Replace(value); | 127 return Replace(value); |
128 } | 128 } |
129 return NoChange(); | 129 return NoChange(); |
130 } | 130 } |
131 | 131 |
132 // ES6 draft 08-24-14, section 20.2.2.16. | 132 // ES6 draft 08-24-14, section 20.2.2.16. |
133 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { | 133 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { |
134 JSCallReduction r(node); | 134 JSCallReduction r(node); |
135 if (r.InputsMatchOne(Type::Number()) && | 135 if (r.InputsMatchOne(Type::Number())) { |
136 machine()->Float64RoundDown().IsSupported()) { | 136 // Math.floor(a:number) -> NumberFloor(a) |
137 // Math.floor(a:number) -> Float64RoundDown(a) | 137 Node* value = graph()->NewNode(simplified()->NumberFloor(), r.left()); |
138 Node* value = | |
139 graph()->NewNode(machine()->Float64RoundDown().op(), r.left()); | |
140 return Replace(value); | 138 return Replace(value); |
141 } | 139 } |
142 return NoChange(); | 140 return NoChange(); |
143 } | 141 } |
144 | 142 |
145 // ES6 draft 08-24-14, section 20.2.2.17. | 143 // ES6 draft 08-24-14, section 20.2.2.17. |
146 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { | 144 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { |
147 JSCallReduction r(node); | 145 JSCallReduction r(node); |
148 if (r.InputsMatchOne(Type::Number())) { | 146 if (r.InputsMatchOne(Type::Number())) { |
149 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) | 147 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 242 } |
245 | 243 |
246 | 244 |
247 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { | 245 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { |
248 return jsgraph()->simplified(); | 246 return jsgraph()->simplified(); |
249 } | 247 } |
250 | 248 |
251 } // namespace compiler | 249 } // namespace compiler |
252 } // namespace internal | 250 } // namespace internal |
253 } // namespace v8 | 251 } // namespace v8 |
OLD | NEW |