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

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

Issue 2103733003: [turbofan] Introduce Float64Pow and NumberPow operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE on ARM64 bug fix. Created 4 years, 5 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
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 value = graph()->NewNode( 332 value = graph()->NewNode(
333 common()->Select(MachineRepresentation::kNone), 333 common()->Select(MachineRepresentation::kNone),
334 graph()->NewNode(simplified()->NumberLessThan(), input, value), input, 334 graph()->NewNode(simplified()->NumberLessThan(), input, value), input,
335 value); 335 value);
336 } 336 }
337 return Replace(value); 337 return Replace(value);
338 } 338 }
339 return NoChange(); 339 return NoChange();
340 } 340 }
341 341
342 // ES6 section 20.2.2.26 Math.pow ( x, y )
343 Reduction JSBuiltinReducer::ReduceMathPow(Node* node) {
344 JSCallReduction r(node);
345 if (r.InputsMatchTwo(Type::PlainPrimitive(), Type::PlainPrimitive())) {
346 // Math.pow(a:plain-primitive,
347 // b:plain-primitive) -> NumberPow(ToNumber(a), ToNumber(b))
348 Node* left = ToNumber(r.left());
349 Node* right = ToNumber(r.right());
350 Node* value = graph()->NewNode(simplified()->NumberPow(), left, right);
351 return Replace(value);
352 }
353 return NoChange();
354 }
355
342 // ES6 section 20.2.2.28 Math.round ( x ) 356 // ES6 section 20.2.2.28 Math.round ( x )
343 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) { 357 Reduction JSBuiltinReducer::ReduceMathRound(Node* node) {
344 JSCallReduction r(node); 358 JSCallReduction r(node);
345 if (r.InputsMatchOne(Type::PlainPrimitive())) { 359 if (r.InputsMatchOne(Type::PlainPrimitive())) {
346 // Math.round(a:plain-primitive) -> NumberRound(ToNumber(a)) 360 // Math.round(a:plain-primitive) -> NumberRound(ToNumber(a))
347 Node* input = ToNumber(r.GetJSCallInput(0)); 361 Node* input = ToNumber(r.GetJSCallInput(0));
348 Node* value = graph()->NewNode(simplified()->NumberRound(), input); 362 Node* value = graph()->NewNode(simplified()->NumberRound(), input);
349 return Replace(value); 363 return Replace(value);
350 } 364 }
351 return NoChange(); 365 return NoChange();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 break; 448 break;
435 case kMathAtan: 449 case kMathAtan:
436 reduction = ReduceMathAtan(node); 450 reduction = ReduceMathAtan(node);
437 break; 451 break;
438 case kMathAtan2: 452 case kMathAtan2:
439 reduction = ReduceMathAtan2(node); 453 reduction = ReduceMathAtan2(node);
440 break; 454 break;
441 case kMathAtanh: 455 case kMathAtanh:
442 reduction = ReduceMathAtanh(node); 456 reduction = ReduceMathAtanh(node);
443 break; 457 break;
458 case kMathCbrt:
459 reduction = ReduceMathCbrt(node);
460 break;
461 case kMathCeil:
462 reduction = ReduceMathCeil(node);
463 break;
444 case kMathClz32: 464 case kMathClz32:
445 reduction = ReduceMathClz32(node); 465 reduction = ReduceMathClz32(node);
446 break; 466 break;
447 case kMathCeil:
448 reduction = ReduceMathCeil(node);
449 break;
450 case kMathCos: 467 case kMathCos:
451 reduction = ReduceMathCos(node); 468 reduction = ReduceMathCos(node);
452 break; 469 break;
453 case kMathExp: 470 case kMathExp:
454 reduction = ReduceMathExp(node); 471 reduction = ReduceMathExp(node);
455 break; 472 break;
456 case kMathExpm1: 473 case kMathExpm1:
457 reduction = ReduceMathExpm1(node); 474 reduction = ReduceMathExpm1(node);
458 break; 475 break;
459 case kMathFloor: 476 case kMathFloor:
(...skipping 16 matching lines...) Expand all
476 break; 493 break;
477 case kMathLog2: 494 case kMathLog2:
478 reduction = ReduceMathLog2(node); 495 reduction = ReduceMathLog2(node);
479 break; 496 break;
480 case kMathMax: 497 case kMathMax:
481 reduction = ReduceMathMax(node); 498 reduction = ReduceMathMax(node);
482 break; 499 break;
483 case kMathMin: 500 case kMathMin:
484 reduction = ReduceMathMin(node); 501 reduction = ReduceMathMin(node);
485 break; 502 break;
486 case kMathCbrt: 503 case kMathPow:
487 reduction = ReduceMathCbrt(node); 504 reduction = ReduceMathPow(node);
488 break; 505 break;
489 case kMathRound: 506 case kMathRound:
490 reduction = ReduceMathRound(node); 507 reduction = ReduceMathRound(node);
491 break; 508 break;
492 case kMathSin: 509 case kMathSin:
493 reduction = ReduceMathSin(node); 510 reduction = ReduceMathSin(node);
494 break; 511 break;
495 case kMathSqrt: 512 case kMathSqrt:
496 reduction = ReduceMathSqrt(node); 513 reduction = ReduceMathSqrt(node);
497 break; 514 break;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 556 }
540 557
541 558
542 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { 559 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const {
543 return jsgraph()->simplified(); 560 return jsgraph()->simplified();
544 } 561 }
545 562
546 } // namespace compiler 563 } // namespace compiler
547 } // namespace internal 564 } // namespace internal
548 } // namespace v8 565 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698