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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2121153003: [turbofan] Remove eager frame state from divisions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/compiler/operator-properties.cc » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); 479 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
480 node->InsertInput(graph()->zone(), 0, 480 node->InsertInput(graph()->zone(), 0,
481 jsgraph()->HeapConstant(callable.code())); 481 jsgraph()->HeapConstant(callable.code()));
482 NodeProperties::ChangeOp(node, common()->Call(desc)); 482 NodeProperties::ChangeOp(node, common()->Call(desc));
483 return Changed(node); 483 return Changed(node);
484 } 484 }
485 return NoChange(); 485 return NoChange();
486 } 486 }
487 487
488 488
489 Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
490 if (flags() & kDisableBinaryOpReduction) return NoChange();
491 JSBinopReduction r(this, node);
492 if (r.BothInputsAre(Type::Number())) {
493 // JSModulus(x:number, x:number) => NumberModulus(x, y)
494 return r.ChangeToPureOperator(simplified()->NumberModulus(),
495 Type::Number());
496 }
497 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
498 if (feedback != BinaryOperationHints::kAny) {
499 return r.ChangeToSpeculativeOperator(
500 simplified()->SpeculativeNumberModulus(feedback), Type::Number());
501 }
502 return NoChange();
503 }
504
505 Reduction JSTypedLowering::ReduceJSSubtract(Node* node) { 489 Reduction JSTypedLowering::ReduceJSSubtract(Node* node) {
506 if (flags() & kDisableBinaryOpReduction) return NoChange(); 490 if (flags() & kDisableBinaryOpReduction) return NoChange();
507 JSBinopReduction r(this, node); 491 JSBinopReduction r(this, node);
508 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 492 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
509 if (feedback == BinaryOperationHints::kNumberOrUndefined && 493 if (feedback == BinaryOperationHints::kNumberOrUndefined &&
510 r.BothInputsAre(Type::PlainPrimitive())) { 494 r.BothInputsAre(Type::PlainPrimitive())) {
511 // JSSubtract(x:plain-primitive, y:plain-primitive) 495 // JSSubtract(x:plain-primitive, y:plain-primitive)
512 // => NumberSubtract(ToNumber(x), ToNumber(y)) 496 // => NumberSubtract(ToNumber(x), ToNumber(y))
513 r.ConvertInputsToNumber(); 497 r.ConvertInputsToNumber();
514 return r.ChangeToPureOperator(simplified()->NumberSubtract(), 498 return r.ChangeToPureOperator(simplified()->NumberSubtract(),
(...skipping 12 matching lines...) Expand all
527 return r.ChangeToPureOperator(simplified()->NumberSubtract(), 511 return r.ChangeToPureOperator(simplified()->NumberSubtract(),
528 Type::Number()); 512 Type::Number());
529 } 513 }
530 514
531 return NoChange(); 515 return NoChange();
532 } 516 }
533 517
534 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) { 518 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) {
535 if (flags() & kDisableBinaryOpReduction) return NoChange(); 519 if (flags() & kDisableBinaryOpReduction) return NoChange();
536 JSBinopReduction r(this, node); 520 JSBinopReduction r(this, node);
537
538 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 521 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
539 if (feedback != BinaryOperationHints::kAny) { 522 if (feedback != BinaryOperationHints::kAny) {
540 return r.ChangeToSpeculativeOperator( 523 return r.ChangeToSpeculativeOperator(
541 simplified()->SpeculativeNumberMultiply(feedback), Type::Number()); 524 simplified()->SpeculativeNumberMultiply(feedback), Type::Number());
542 } 525 }
543 526
544 // If deoptimization is enabled we rely on type feedback. 527 // If deoptimization is enabled we rely on type feedback.
545 if (r.BothInputsAre(Type::PlainPrimitive()) || 528 if (r.BothInputsAre(Type::PlainPrimitive()) ||
546 !(flags() & kDeoptimizationEnabled)) { 529 !(flags() & kDeoptimizationEnabled)) {
547 r.ConvertInputsToNumber(); 530 r.ConvertInputsToNumber();
548 return r.ChangeToPureOperator(simplified()->NumberMultiply(), 531 return r.ChangeToPureOperator(simplified()->NumberMultiply(),
549 Type::Number()); 532 Type::Number());
550 } 533 }
551 534
552 return NoChange(); 535 return NoChange();
553 } 536 }
554 537
555 Reduction JSTypedLowering::ReduceJSDivide(Node* node) { 538 Reduction JSTypedLowering::ReduceJSDivide(Node* node) {
556 if (flags() & kDisableBinaryOpReduction) return NoChange(); 539 if (flags() & kDisableBinaryOpReduction) return NoChange();
557 JSBinopReduction r(this, node); 540 JSBinopReduction r(this, node);
558 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 541 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
559 if (feedback != BinaryOperationHints::kAny) { 542 if (feedback != BinaryOperationHints::kAny) {
560 return r.ChangeToSpeculativeOperator( 543 return r.ChangeToSpeculativeOperator(
561 simplified()->SpeculativeNumberDivide(feedback), Type::Number()); 544 simplified()->SpeculativeNumberDivide(feedback), Type::Number());
562 } 545 }
563 r.ConvertInputsToNumber(); 546
564 return r.ChangeToPureOperator(simplified()->NumberDivide(), Type::Number()); 547 // If deoptimization is enabled we rely on type feedback.
548 if (r.BothInputsAre(Type::PlainPrimitive()) ||
549 !(flags() & kDeoptimizationEnabled)) {
550 r.ConvertInputsToNumber();
551 return r.ChangeToPureOperator(simplified()->NumberDivide(), Type::Number());
552 }
553
554 return NoChange();
565 } 555 }
566 556
557 Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
558 if (flags() & kDisableBinaryOpReduction) return NoChange();
559 JSBinopReduction r(this, node);
560 if (r.BothInputsAre(Type::Number())) {
561 // JSModulus(x:number, x:number) => NumberModulus(x, y)
562 return r.ChangeToPureOperator(simplified()->NumberModulus(),
563 Type::Number());
564 }
565 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
566 if (feedback != BinaryOperationHints::kAny) {
567 return r.ChangeToSpeculativeOperator(
568 simplified()->SpeculativeNumberModulus(feedback), Type::Number());
569 }
570 return NoChange();
571 }
567 572
568 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { 573 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
569 if (flags() & kDisableBinaryOpReduction) return NoChange(); 574 if (flags() & kDisableBinaryOpReduction) return NoChange();
570 575
571 JSBinopReduction r(this, node); 576 JSBinopReduction r(this, node);
572 r.ConvertInputsToNumber(); 577 r.ConvertInputsToNumber();
573 r.ConvertInputsToUI32(kSigned, kSigned); 578 r.ConvertInputsToUI32(kSigned, kSigned);
574 return r.ChangeToPureOperator(intOp, Type::Integral32()); 579 return r.ChangeToPureOperator(intOp, Type::Integral32());
575 } 580 }
576 581
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 } 2054 }
2050 2055
2051 2056
2052 CompilationDependencies* JSTypedLowering::dependencies() const { 2057 CompilationDependencies* JSTypedLowering::dependencies() const {
2053 return dependencies_; 2058 return dependencies_;
2054 } 2059 }
2055 2060
2056 } // namespace compiler 2061 } // namespace compiler
2057 } // namespace internal 2062 } // namespace internal
2058 } // namespace v8 2063 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/operator-properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698