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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! Created 3 years, 8 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/operation-typer.cc ('k') | src/compiler/simplified-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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 #undef DECLARE_CASE 447 #undef DECLARE_CASE
448 448
449 #define DECLARE_CASE(Name) \ 449 #define DECLARE_CASE(Name) \
450 case IrOpcode::k##Name: { \ 450 case IrOpcode::k##Name: { \
451 new_type = op_typer_.Name(FeedbackTypeOf(node->InputAt(0))); \ 451 new_type = op_typer_.Name(FeedbackTypeOf(node->InputAt(0))); \
452 break; \ 452 break; \
453 } 453 }
454 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) 454 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE)
455 #undef DECLARE_CASE 455 #undef DECLARE_CASE
456 456
457 #define DECLARE_CASE(Name) \
458 case IrOpcode::k##Name: { \
459 new_type = \
460 Type::Intersect(op_typer_.Name(FeedbackTypeOf(node->InputAt(0))), \
461 info->restriction_type(), graph_zone()); \
462 break; \
463 }
464 SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE)
465 #undef DECLARE_CASE
466
457 case IrOpcode::kPlainPrimitiveToNumber: 467 case IrOpcode::kPlainPrimitiveToNumber:
458 new_type = op_typer_.ToNumber(FeedbackTypeOf(node->InputAt(0))); 468 new_type = op_typer_.ToNumber(FeedbackTypeOf(node->InputAt(0)));
459 break; 469 break;
460 470
461 case IrOpcode::kPhi: { 471 case IrOpcode::kPhi: {
462 new_type = TypePhi(node); 472 new_type = TypePhi(node);
463 if (type != nullptr) { 473 if (type != nullptr) {
464 new_type = Weaken(node, type, new_type); 474 new_type = Weaken(node, type, new_type);
465 } 475 }
466 break; 476 break;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if (BothInputsAre(node, Type::NumberOrOddball())) { 848 if (BothInputsAre(node, Type::NumberOrOddball())) {
839 return VisitBinop(node, UseInfo::TruncatingWord32(), 849 return VisitBinop(node, UseInfo::TruncatingWord32(),
840 MachineRepresentation::kWord32); 850 MachineRepresentation::kWord32);
841 } 851 }
842 NumberOperationHint hint = NumberOperationHintOf(node->op()); 852 NumberOperationHint hint = NumberOperationHintOf(node->op());
843 return VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), 853 return VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
844 MachineRepresentation::kWord32); 854 MachineRepresentation::kWord32);
845 } 855 }
846 856
847 // Helper for unops of the I -> O variety. 857 // Helper for unops of the I -> O variety.
848 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { 858 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output,
859 Type* restriction_type = Type::Any()) {
849 DCHECK_EQ(1, node->op()->ValueInputCount()); 860 DCHECK_EQ(1, node->op()->ValueInputCount());
850 ProcessInput(node, 0, input_use); 861 ProcessInput(node, 0, input_use);
851 ProcessRemainingInputs(node, 1); 862 ProcessRemainingInputs(node, 1);
852 SetOutput(node, output); 863 SetOutput(node, output, restriction_type);
853 } 864 }
854 865
855 // Helper for leaf nodes. 866 // Helper for leaf nodes.
856 void VisitLeaf(Node* node, MachineRepresentation output) { 867 void VisitLeaf(Node* node, MachineRepresentation output) {
857 DCHECK_EQ(0, node->InputCount()); 868 DCHECK_EQ(0, node->InputCount());
858 SetOutput(node, output); 869 SetOutput(node, output);
859 } 870 }
860 871
861 // Helpers for specific types of binops. 872 // Helpers for specific types of binops.
862 void VisitFloat64Binop(Node* node) { 873 void VisitFloat64Binop(Node* node) {
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 if (lower()) { 2590 if (lower()) {
2580 NodeProperties::ChangeOp(node, 2591 NodeProperties::ChangeOp(node,
2581 simplified()->PlainPrimitiveToFloat64()); 2592 simplified()->PlainPrimitiveToFloat64());
2582 } 2593 }
2583 } 2594 }
2584 } else { 2595 } else {
2585 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 2596 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2586 } 2597 }
2587 return; 2598 return;
2588 } 2599 }
2600 case IrOpcode::kSpeculativeToNumber: {
2601 NumberOperationHint const hint = NumberOperationHintOf(node->op());
2602 switch (hint) {
2603 case NumberOperationHint::kSigned32:
2604 case NumberOperationHint::kSignedSmall:
2605 VisitUnop(node, CheckedUseInfoAsWord32FromHint(hint),
2606 MachineRepresentation::kWord32, Type::Signed32());
2607 break;
2608 case NumberOperationHint::kNumber:
2609 case NumberOperationHint::kNumberOrOddball:
2610 VisitUnop(node, CheckedUseInfoAsFloat64FromHint(hint),
2611 MachineRepresentation::kFloat64);
2612 break;
2613 }
2614 if (lower()) DeferReplacement(node, node->InputAt(0));
2615 return;
2616 }
2589 case IrOpcode::kObjectIsDetectableCallable: { 2617 case IrOpcode::kObjectIsDetectableCallable: {
2590 VisitObjectIs(node, Type::DetectableCallable(), lowering); 2618 VisitObjectIs(node, Type::DetectableCallable(), lowering);
2591 return; 2619 return;
2592 } 2620 }
2593 case IrOpcode::kObjectIsNaN: { 2621 case IrOpcode::kObjectIsNaN: {
2594 Type* const input_type = GetUpperBound(node->InputAt(0)); 2622 Type* const input_type = GetUpperBound(node->InputAt(0));
2595 if (input_type->Is(Type::NaN())) { 2623 if (input_type->Is(Type::NaN())) {
2596 VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit); 2624 VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit);
2597 if (lower()) { 2625 if (lower()) {
2598 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1)); 2626 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1));
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3659 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3632 Operator::kNoProperties); 3660 Operator::kNoProperties);
3633 to_number_operator_.set(common()->Call(desc)); 3661 to_number_operator_.set(common()->Call(desc));
3634 } 3662 }
3635 return to_number_operator_.get(); 3663 return to_number_operator_.get();
3636 } 3664 }
3637 3665
3638 } // namespace compiler 3666 } // namespace compiler
3639 } // namespace internal 3667 } // namespace internal
3640 } // namespace v8 3668 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698