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

Side by Side Diff: src/compiler/x87/instruction-selector-x87.cc

Issue 1242303005: [turbofan]: Elide extra move when accessing stack or frame register (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: src/compiler/code-generator.cc Created 5 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 | « src/compiler/x64/code-generator-x64.cc ('k') | src/frames.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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 VisitCompare(selector, opcode, g.Use(right), g.UseImmediate(left), cont); 1059 VisitCompare(selector, opcode, g.Use(right), g.UseImmediate(left), cont);
1060 } else { 1060 } else {
1061 VisitCompare(selector, opcode, left, right, cont, 1061 VisitCompare(selector, opcode, left, right, cont,
1062 node->op()->HasProperty(Operator::kCommutative)); 1062 node->op()->HasProperty(Operator::kCommutative));
1063 } 1063 }
1064 } 1064 }
1065 1065
1066 1066
1067 void VisitWordCompare(InstructionSelector* selector, Node* node, 1067 void VisitWordCompare(InstructionSelector* selector, Node* node,
1068 FlagsContinuation* cont) { 1068 FlagsContinuation* cont) {
1069 X87OperandGenerator g(selector);
1070 Int32BinopMatcher m(node);
1071 if (m.left().IsLoad() && m.right().IsLoadStackPointer()) {
1072 LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node());
1073 ExternalReference js_stack_limit =
1074 ExternalReference::address_of_stack_limit(selector->isolate());
1075 if (mleft.object().Is(js_stack_limit) && mleft.index().Is(0)) {
1076 // Compare(Load(js_stack_limit), LoadStackPointer)
1077 if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute();
1078 InstructionCode opcode = cont->Encode(kX87StackCheck);
1079 if (cont->IsBranch()) {
1080 selector->Emit(opcode, g.NoOutput(), g.Label(cont->true_block()),
1081 g.Label(cont->false_block()));
1082 } else {
1083 DCHECK(cont->IsSet());
1084 selector->Emit(opcode, g.DefineAsRegister(cont->result()));
1085 }
1086 return;
1087 }
1088 }
1089 VisitWordCompare(selector, node, kX87Cmp, cont); 1069 VisitWordCompare(selector, node, kX87Cmp, cont);
1090 } 1070 }
1091 1071
1092 1072
1093 // Shared routine for word comparison with zero. 1073 // Shared routine for word comparison with zero.
1094 void VisitWordCompareZero(InstructionSelector* selector, Node* user, 1074 void VisitWordCompareZero(InstructionSelector* selector, Node* user,
1095 Node* value, FlagsContinuation* cont) { 1075 Node* value, FlagsContinuation* cont) {
1096 // Try to combine the branch with a comparison. 1076 // Try to combine the branch with a comparison.
1097 while (selector->CanCover(user, value)) { 1077 while (selector->CanCover(user, value)) {
1098 switch (value->opcode()) { 1078 switch (value->opcode()) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 MachineOperatorBuilder::kFloat32Min | 1327 MachineOperatorBuilder::kFloat32Min |
1348 MachineOperatorBuilder::kFloat64Max | 1328 MachineOperatorBuilder::kFloat64Max |
1349 MachineOperatorBuilder::kFloat64Min | 1329 MachineOperatorBuilder::kFloat64Min |
1350 MachineOperatorBuilder::kWord32ShiftIsSafe; 1330 MachineOperatorBuilder::kWord32ShiftIsSafe;
1351 return flags; 1331 return flags;
1352 } 1332 }
1353 1333
1354 } // namespace compiler 1334 } // namespace compiler
1355 } // namespace internal 1335 } // namespace internal
1356 } // namespace v8 1336 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/code-generator-x64.cc ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698