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

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

Issue 1722193002: [compiler] Drop the CompareNilIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 4 years, 9 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/change-lowering.h ('k') | src/compiler/js-typed-lowering.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/compiler/change-lowering.h" 5 #include "src/compiler/change-lowering.h"
6 6
7 #include "src/address-map.h" 7 #include "src/address-map.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 case IrOpcode::kStoreElement: 48 case IrOpcode::kStoreElement:
49 return StoreElement(node); 49 return StoreElement(node);
50 case IrOpcode::kAllocate: 50 case IrOpcode::kAllocate:
51 return Allocate(node); 51 return Allocate(node);
52 case IrOpcode::kObjectIsReceiver: 52 case IrOpcode::kObjectIsReceiver:
53 return ObjectIsReceiver(node); 53 return ObjectIsReceiver(node);
54 case IrOpcode::kObjectIsSmi: 54 case IrOpcode::kObjectIsSmi:
55 return ObjectIsSmi(node); 55 return ObjectIsSmi(node);
56 case IrOpcode::kObjectIsNumber: 56 case IrOpcode::kObjectIsNumber:
57 return ObjectIsNumber(node); 57 return ObjectIsNumber(node);
58 case IrOpcode::kObjectIsUndetectable:
59 return ObjectIsUndetectable(node);
58 default: 60 default:
59 return NoChange(); 61 return NoChange();
60 } 62 }
61 UNREACHABLE(); 63 UNREACHABLE();
62 return NoChange(); 64 return NoChange();
63 } 65 }
64 66
65 67
66 Node* ChangeLowering::HeapNumberValueIndexConstant() { 68 Node* ChangeLowering::HeapNumberValueIndexConstant() {
67 return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag); 69 return jsgraph()->IntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag);
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 jsgraph()->IntPtrConstant(kSmiTag)); 598 jsgraph()->IntPtrConstant(kSmiTag));
597 } 599 }
598 600
599 Node* ChangeLowering::LoadHeapObjectMap(Node* object, Node* control) { 601 Node* ChangeLowering::LoadHeapObjectMap(Node* object, Node* control) {
600 return graph()->NewNode( 602 return graph()->NewNode(
601 machine()->Load(MachineType::AnyTagged()), object, 603 machine()->Load(MachineType::AnyTagged()), object,
602 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), 604 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag),
603 graph()->start(), control); 605 graph()->start(), control);
604 } 606 }
605 607
608 Node* ChangeLowering::LoadMapBitField(Node* map) {
609 return graph()->NewNode(
610 machine()->Load(MachineType::Uint8()), map,
611 jsgraph()->IntPtrConstant(Map::kBitFieldOffset - kHeapObjectTag),
612 graph()->start(), graph()->start());
613 }
614
606 Node* ChangeLowering::LoadMapInstanceType(Node* map) { 615 Node* ChangeLowering::LoadMapInstanceType(Node* map) {
607 return graph()->NewNode( 616 return graph()->NewNode(
608 machine()->Load(MachineType::Uint8()), map, 617 machine()->Load(MachineType::Uint8()), map,
609 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag), 618 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag),
610 graph()->start(), graph()->start()); 619 graph()->start(), graph()->start());
611 } 620 }
612 621
613 Reduction ChangeLowering::ObjectIsNumber(Node* node) { 622 Reduction ChangeLowering::ObjectIsNumber(Node* node) {
614 Node* input = NodeProperties::GetValueInput(node, 0); 623 Node* input = NodeProperties::GetValueInput(node, 0);
615 // TODO(bmeurer): Optimize somewhat based on input type. 624 // TODO(bmeurer): Optimize somewhat based on input type.
(...skipping 27 matching lines...) Expand all
643 jsgraph()->Uint32Constant(FIRST_JS_RECEIVER_TYPE), 652 jsgraph()->Uint32Constant(FIRST_JS_RECEIVER_TYPE),
644 LoadMapInstanceType(LoadHeapObjectMap(input, if_false))); 653 LoadMapInstanceType(LoadHeapObjectMap(input, if_false)));
645 Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false); 654 Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
646 node->ReplaceInput(0, vtrue); 655 node->ReplaceInput(0, vtrue);
647 node->AppendInput(graph()->zone(), vfalse); 656 node->AppendInput(graph()->zone(), vfalse);
648 node->AppendInput(graph()->zone(), control); 657 node->AppendInput(graph()->zone(), control);
649 NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2)); 658 NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
650 return Changed(node); 659 return Changed(node);
651 } 660 }
652 661
662 Reduction ChangeLowering::ObjectIsUndetectable(Node* node) {
663 Node* input = NodeProperties::GetValueInput(node, 0);
664 // TODO(bmeurer): Optimize somewhat based on input type.
665 Node* check = IsSmi(input);
666 Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start());
667 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
668 Node* vtrue = jsgraph()->Int32Constant(0);
669 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
670 Node* vfalse = graph()->NewNode(
671 machine()->Word32Equal(),
672 graph()->NewNode(
673 machine()->Word32Equal(),
674 graph()->NewNode(machine()->Word32And(),
675 jsgraph()->Uint32Constant(1 << Map::kIsUndetectable),
676 LoadMapBitField(LoadHeapObjectMap(input, if_false))),
677 jsgraph()->Int32Constant(0)),
678 jsgraph()->Int32Constant(0));
679 Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
680 node->ReplaceInput(0, vtrue);
681 node->AppendInput(graph()->zone(), vfalse);
682 node->AppendInput(graph()->zone(), control);
683 NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
684 return Changed(node);
685 }
686
653 Reduction ChangeLowering::ObjectIsSmi(Node* node) { 687 Reduction ChangeLowering::ObjectIsSmi(Node* node) {
654 node->ReplaceInput(0, 688 node->ReplaceInput(0,
655 graph()->NewNode(machine()->WordAnd(), node->InputAt(0), 689 graph()->NewNode(machine()->WordAnd(), node->InputAt(0),
656 jsgraph()->IntPtrConstant(kSmiTagMask))); 690 jsgraph()->IntPtrConstant(kSmiTagMask)));
657 node->AppendInput(graph()->zone(), jsgraph()->IntPtrConstant(kSmiTag)); 691 node->AppendInput(graph()->zone(), jsgraph()->IntPtrConstant(kSmiTag));
658 NodeProperties::ChangeOp(node, machine()->WordEqual()); 692 NodeProperties::ChangeOp(node, machine()->WordEqual());
659 return Changed(node); 693 return Changed(node);
660 } 694 }
661 695
662 Isolate* ChangeLowering::isolate() const { return jsgraph()->isolate(); } 696 Isolate* ChangeLowering::isolate() const { return jsgraph()->isolate(); }
663 697
664 698
665 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } 699 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); }
666 700
667 701
668 CommonOperatorBuilder* ChangeLowering::common() const { 702 CommonOperatorBuilder* ChangeLowering::common() const {
669 return jsgraph()->common(); 703 return jsgraph()->common();
670 } 704 }
671 705
672 706
673 MachineOperatorBuilder* ChangeLowering::machine() const { 707 MachineOperatorBuilder* ChangeLowering::machine() const {
674 return jsgraph()->machine(); 708 return jsgraph()->machine();
675 } 709 }
676 710
677 } // namespace compiler 711 } // namespace compiler
678 } // namespace internal 712 } // namespace internal
679 } // namespace v8 713 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698