Commit 1e2ca0ca authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[compiler] Use StackPointerGreaterThan in CSA stack checks

CSA's stack checks (in CodeStubAssembler::PerformStackCheck) were
previously carefully crafted to hit the stack check node pattern
matchers later on during instruction selection (see StackCheckMatcher).
This brittle mechanism is no longer needed now that stack checks use the
new StackPointerGreaterThan machine operator.

Bug: v8:9534
Change-Id: Idca169df1cadc6db237a8d36883ec1a79418f288
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1748728
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63163}
parent 961c0280
......@@ -13898,15 +13898,10 @@ void CodeStubAssembler::Print(const char* prefix, Node* tagged_value) {
void CodeStubAssembler::PerformStackCheck(TNode<Context> context) {
Label ok(this), stack_check_interrupt(this, Label::kDeferred);
// The instruction sequence below is carefully crafted to hit our pattern
// matcher for stack checks within instruction selection.
// See StackCheckMatcher::Matched and JSGenericLowering::LowerJSStackCheck.
TNode<UintPtrT> sp = UncheckedCast<UintPtrT>(LoadStackPointer());
TNode<UintPtrT> stack_limit = UncheckedCast<UintPtrT>(Load(
MachineType::Pointer(),
ExternalConstant(ExternalReference::address_of_stack_limit(isolate()))));
TNode<BoolT> sp_within_limit = UintPtrLessThan(stack_limit, sp);
TNode<BoolT> sp_within_limit = StackPointerGreaterThan(stack_limit);
Branch(sp_within_limit, &ok, &stack_check_interrupt);
......
......@@ -656,7 +656,8 @@ TNode<Float64T> Float64Add(TNode<Float64T> a, TNode<Float64T> b);
V(Int32AbsWithOverflow, PAIR_TYPE(Int32T, BoolT), Int32T) \
V(Int64AbsWithOverflow, PAIR_TYPE(Int64T, BoolT), Int64T) \
V(IntPtrAbsWithOverflow, PAIR_TYPE(IntPtrT, BoolT), IntPtrT) \
V(Word32BinaryNot, BoolT, Word32T)
V(Word32BinaryNot, BoolT, Word32T) \
V(StackPointerGreaterThan, BoolT, WordT)
// A "public" interface used by components outside of compiler directory to
// create code objects with TurboFan's backend. This class is mostly a thin
......
......@@ -263,6 +263,7 @@ class MachineRepresentationInferrer {
case IrOpcode::kFloat64LessThan:
case IrOpcode::kFloat64LessThanOrEqual:
case IrOpcode::kChangeTaggedToBit:
case IrOpcode::kStackPointerGreaterThan:
representation_vector_[node->id()] = MachineRepresentation::kBit;
break;
#define LABEL(opcode) case IrOpcode::k##opcode:
......@@ -696,6 +697,10 @@ class MachineRepresentationChecker {
}
break;
}
case IrOpcode::kStackPointerGreaterThan:
CheckValueInputRepresentationIs(
node, 0, MachineType::PointerRepresentation());
break;
case IrOpcode::kThrow:
case IrOpcode::kTypedStateValues:
case IrOpcode::kFrameState:
......
......@@ -578,6 +578,9 @@ class V8_EXPORT_PRIVATE RawMachineAssembler {
Node* Word32PairSar(Node* low_word, Node* high_word, Node* shift) {
return AddNode(machine()->Word32PairSar(), low_word, high_word, shift);
}
Node* StackPointerGreaterThan(Node* value) {
return AddNode(machine()->StackPointerGreaterThan(), value);
}
#define INTPTR_BINOP(prefix, name) \
Node* IntPtr##name(Node* a, Node* b) { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment