Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 JSCallReduction r(node); 176 JSCallReduction r(node);
177 if (r.InputsMatchOne(Type::NumberOrUndefined())) { 177 if (r.InputsMatchOne(Type::NumberOrUndefined())) {
178 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) 178 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a)
179 Node* value = 179 Node* value =
180 graph()->NewNode(machine()->TruncateFloat64ToFloat32(), r.left()); 180 graph()->NewNode(machine()->TruncateFloat64ToFloat32(), r.left());
181 return Replace(value); 181 return Replace(value);
182 } 182 }
183 return NoChange(); 183 return NoChange();
184 } 184 }
185 185
186 // ES6 section 20.2.2.20 Math.log ( x )
187 Reduction JSBuiltinReducer::ReduceMathLog(Node* node) {
188 JSCallReduction r(node);
189 if (r.InputsMatchOne(Type::Number())) {
190 // Math.log(a:number) -> NumberLog(a)
191 Node* value = graph()->NewNode(simplified()->NumberLog(), r.left());
192 return Replace(value);
193 }
194 return NoChange();
195 }
196
186 // ES6 section 20.2.2.28 Math.round ( x ) 197 // ES6 section 20.2.2.28 Math.round ( x )
187 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { 198 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) {
188 JSCallReduction r(node); 199 JSCallReduction r(node);
189 if (r.InputsMatchOne(Type::Number())) { 200 if (r.InputsMatchOne(Type::Number())) {
190 // Math.round(a:number) -> NumberRound(a) 201 // Math.round(a:number) -> NumberRound(a)
191 Node* value = graph()->NewNode(simplified()->NumberRound(), r.left()); 202 Node* value = graph()->NewNode(simplified()->NumberRound(), r.left());
192 return Replace(value); 203 return Replace(value);
193 } 204 }
194 return NoChange(); 205 return NoChange();
195 } 206 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 break; 257 break;
247 case kMathCeil: 258 case kMathCeil:
248 reduction = ReduceMathCeil(node); 259 reduction = ReduceMathCeil(node);
249 break; 260 break;
250 case kMathFloor: 261 case kMathFloor:
251 reduction = ReduceMathFloor(node); 262 reduction = ReduceMathFloor(node);
252 break; 263 break;
253 case kMathFround: 264 case kMathFround:
254 reduction = ReduceMathFround(node); 265 reduction = ReduceMathFround(node);
255 break; 266 break;
267 case kMathLog:
268 reduction = ReduceMathLog(node);
269 break;
256 case kMathRound: 270 case kMathRound:
257 reduction = ReduceMathRound(node); 271 reduction = ReduceMathRound(node);
258 break; 272 break;
259 case kMathSqrt: 273 case kMathSqrt:
260 reduction = ReduceMathSqrt(node); 274 reduction = ReduceMathSqrt(node);
261 break; 275 break;
262 case kMathTrunc: 276 case kMathTrunc:
263 reduction = ReduceMathTrunc(node); 277 reduction = ReduceMathTrunc(node);
264 break; 278 break;
265 case kStringFromCharCode: 279 case kStringFromCharCode:
(...skipping 27 matching lines...) Expand all
293 } 307 }
294 308
295 309
296 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { 310 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const {
297 return jsgraph()->simplified(); 311 return jsgraph()->simplified();
298 } 312 }
299 313
300 } // namespace compiler 314 } // namespace compiler
301 } // namespace internal 315 } // namespace internal
302 } // namespace v8 316 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698