Index: src/compiler/ia32/instruction-selector-ia32.cc |
diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc |
index 54184302c565db287a13f5e7f80e1ea46cc433fb..5797becfcb1fdf509d6ac158418d487ddb5e4495 100644 |
--- a/src/compiler/ia32/instruction-selector-ia32.cc |
+++ b/src/compiler/ia32/instruction-selector-ia32.cc |
@@ -841,6 +841,26 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, |
void VisitWordCompare(InstructionSelector* selector, Node* node, |
FlagsContinuation* cont) { |
+ IA32OperandGenerator g(selector); |
+ Int32BinopMatcher m(node); |
+ if (m.left().IsLoad() && m.right().IsLoadStackPointer()) { |
+ LoadMatcher<ExternalReferenceMatcher> mleft(m.left().node()); |
+ ExternalReference js_stack_limit = |
+ ExternalReference::address_of_stack_limit(selector->isolate()); |
+ if (mleft.object().Is(js_stack_limit) && mleft.index().Is(0)) { |
+ // Compare(Load(js_stack_limit), LoadStackPointer) |
+ if (!node->op()->HasProperty(Operator::kCommutative)) cont->Commute(); |
+ InstructionCode opcode = cont->Encode(kIA32StackCheck); |
+ if (cont->IsBranch()) { |
+ selector->Emit(opcode, g.NoOutput(), g.Label(cont->true_block()), |
+ g.Label(cont->false_block()))->MarkAsControl(); |
+ } else { |
+ DCHECK(cont->IsSet()); |
+ selector->Emit(opcode, g.DefineAsRegister(cont->result())); |
+ } |
+ return; |
+ } |
+ } |
VisitWordCompare(selector, node, kIA32Cmp, cont); |
} |