OLD | NEW |
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/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 VisitCompare(selector, opcode, g.Use(right), g.UseImmediate(left), cont); | 834 VisitCompare(selector, opcode, g.Use(right), g.UseImmediate(left), cont); |
835 } else { | 835 } else { |
836 VisitCompare(selector, opcode, left, right, cont, | 836 VisitCompare(selector, opcode, left, right, cont, |
837 node->op()->HasProperty(Operator::kCommutative)); | 837 node->op()->HasProperty(Operator::kCommutative)); |
838 } | 838 } |
839 } | 839 } |
840 | 840 |
841 | 841 |
842 void VisitWordCompare(InstructionSelector* selector, Node* node, | 842 void VisitWordCompare(InstructionSelector* selector, Node* node, |
843 FlagsContinuation* cont) { | 843 FlagsContinuation* cont) { |
| 844 IA32OperandGenerator g(selector); |
| 845 Int32BinopMatcher m(node); |
| 846 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) { |
| 847 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node()); |
| 848 ExternalReference js_stack_limit = |
| 849 ExternalReference::address_of_stack_limit(selector->isolate()); |
| 850 if (mleft.object().Is(js_stack_limit) && mleft.index().Is(0)) { |
| 851 // Compare(Load(js_stack_limit), LoadStackPointer) |
| 852 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); |
| 853 InstructionCode opcode = cont->Encode(kIA32StackCheck); |
| 854 if (cont->IsBranch()) { |
| 855 selector->Emit(opcode, g.NoOutput(), g.Label(cont->true_block()), |
| 856 g.Label(cont->false_block()))->MarkAsControl(); |
| 857 } else { |
| 858 DCHECK(cont->IsSet()); |
| 859 selector->Emit(opcode, g.DefineAsRegister(cont->result())); |
| 860 } |
| 861 return; |
| 862 } |
| 863 } |
844 VisitWordCompare(selector, node, kIA32Cmp, cont); | 864 VisitWordCompare(selector, node, kIA32Cmp, cont); |
845 } | 865 } |
846 | 866 |
847 | 867 |
848 // Shared routine for word comparison with zero. | 868 // Shared routine for word comparison with zero. |
849 void VisitWordCompareZero(InstructionSelector* selector, Node* user, | 869 void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
850 Node* value, FlagsContinuation* cont) { | 870 Node* value, FlagsContinuation* cont) { |
851 // Try to combine the branch with a comparison. | 871 // Try to combine the branch with a comparison. |
852 while (selector->CanCover(user, value)) { | 872 while (selector->CanCover(user, value)) { |
853 switch (value->opcode()) { | 873 switch (value->opcode()) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 flags |= MachineOperatorBuilder::kFloat64Floor | | 1134 flags |= MachineOperatorBuilder::kFloat64Floor | |
1115 MachineOperatorBuilder::kFloat64Ceil | | 1135 MachineOperatorBuilder::kFloat64Ceil | |
1116 MachineOperatorBuilder::kFloat64RoundTruncate; | 1136 MachineOperatorBuilder::kFloat64RoundTruncate; |
1117 } | 1137 } |
1118 return flags; | 1138 return flags; |
1119 } | 1139 } |
1120 | 1140 |
1121 } // namespace compiler | 1141 } // namespace compiler |
1122 } // namespace internal | 1142 } // namespace internal |
1123 } // namespace v8 | 1143 } // namespace v8 |
OLD | NEW |