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

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

Issue 1898653003: [turbofan] Optimize typeof in abstract/strict equality comparison. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/change-lowering.h ('k') | src/compiler/js-typed-lowering.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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 case IrOpcode::kLoadField: 42 case IrOpcode::kLoadField:
43 return LoadField(node); 43 return LoadField(node);
44 case IrOpcode::kStoreField: 44 case IrOpcode::kStoreField:
45 return StoreField(node); 45 return StoreField(node);
46 case IrOpcode::kLoadElement: 46 case IrOpcode::kLoadElement:
47 return LoadElement(node); 47 return LoadElement(node);
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::kObjectIsCallable:
53 return ObjectIsCallable(node);
52 case IrOpcode::kObjectIsNumber: 54 case IrOpcode::kObjectIsNumber:
53 return ObjectIsNumber(node); 55 return ObjectIsNumber(node);
54 case IrOpcode::kObjectIsReceiver: 56 case IrOpcode::kObjectIsReceiver:
55 return ObjectIsReceiver(node); 57 return ObjectIsReceiver(node);
56 case IrOpcode::kObjectIsSmi: 58 case IrOpcode::kObjectIsSmi:
57 return ObjectIsSmi(node); 59 return ObjectIsSmi(node);
58 case IrOpcode::kObjectIsString: 60 case IrOpcode::kObjectIsString:
59 return ObjectIsString(node); 61 return ObjectIsString(node);
60 case IrOpcode::kObjectIsUndetectable: 62 case IrOpcode::kObjectIsUndetectable:
61 return ObjectIsUndetectable(node); 63 return ObjectIsUndetectable(node);
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 graph()->start(), graph()->start()); 647 graph()->start(), graph()->start());
646 } 648 }
647 649
648 Node* ChangeLowering::LoadMapInstanceType(Node* map) { 650 Node* ChangeLowering::LoadMapInstanceType(Node* map) {
649 return graph()->NewNode( 651 return graph()->NewNode(
650 machine()->Load(MachineType::Uint8()), map, 652 machine()->Load(MachineType::Uint8()), map,
651 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag), 653 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag),
652 graph()->start(), graph()->start()); 654 graph()->start(), graph()->start());
653 } 655 }
654 656
657 Reduction ChangeLowering::ObjectIsCallable(Node* node) {
658 Node* input = NodeProperties::GetValueInput(node, 0);
659 // TODO(bmeurer): Optimize somewhat based on input type.
660 Node* check = IsSmi(input);
661 Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start());
662 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
663 Node* vtrue = jsgraph()->Int32Constant(0);
664 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
665 Node* vfalse = graph()->NewNode(
666 machine()->Word32Equal(),
667 jsgraph()->Uint32Constant(1 << Map::kIsCallable),
668 graph()->NewNode(machine()->Word32And(),
669 LoadMapBitField(LoadHeapObjectMap(input, if_false)),
670 jsgraph()->Uint32Constant((1 << Map::kIsCallable) |
671 (1 << Map::kIsUndetectable))));
672 Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
673 node->ReplaceInput(0, vtrue);
674 node->AppendInput(graph()->zone(), vfalse);
675 node->AppendInput(graph()->zone(), control);
676 NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
677 return Changed(node);
678 }
679
655 Reduction ChangeLowering::ObjectIsNumber(Node* node) { 680 Reduction ChangeLowering::ObjectIsNumber(Node* node) {
656 Node* input = NodeProperties::GetValueInput(node, 0); 681 Node* input = NodeProperties::GetValueInput(node, 0);
657 // TODO(bmeurer): Optimize somewhat based on input type. 682 // TODO(bmeurer): Optimize somewhat based on input type.
658 Node* check = IsSmi(input); 683 Node* check = IsSmi(input);
659 Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start()); 684 Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start());
660 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 685 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
661 Node* vtrue = jsgraph()->Int32Constant(1); 686 Node* vtrue = jsgraph()->Int32Constant(1);
662 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 687 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
663 Node* vfalse = graph()->NewNode( 688 Node* vfalse = graph()->NewNode(
664 machine()->WordEqual(), LoadHeapObjectMap(input, if_false), 689 machine()->WordEqual(), LoadHeapObjectMap(input, if_false),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 781 }
757 782
758 783
759 MachineOperatorBuilder* ChangeLowering::machine() const { 784 MachineOperatorBuilder* ChangeLowering::machine() const {
760 return jsgraph()->machine(); 785 return jsgraph()->machine();
761 } 786 }
762 787
763 } // namespace compiler 788 } // namespace compiler
764 } // namespace internal 789 } // namespace internal
765 } // namespace v8 790 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/js-typed-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698