Commit 56a6f0a1 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[interpreter,compiler] Remove CodeAssembler::LoadStackPointer

This removes LoadStackPointer and its last remaining use in the
interpreter assembler.

Bug: v8:9534
Change-Id: I19aafb12c5fd50248841a3d92448e64243c723ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1748729
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63164}
parent 1e2ca0ca
......@@ -453,10 +453,6 @@ TNode<RawPtrT> CodeAssembler::LoadParentFramePointer() {
return UncheckedCast<RawPtrT>(raw_assembler()->LoadParentFramePointer());
}
TNode<RawPtrT> CodeAssembler::LoadStackPointer() {
return UncheckedCast<RawPtrT>(raw_assembler()->LoadStackPointer());
}
TNode<Object> CodeAssembler::TaggedPoisonOnSpeculation(
SloppyTNode<Object> value) {
return UncheckedCast<Object>(
......
......@@ -954,9 +954,6 @@ class V8_EXPORT_PRIVATE CodeAssembler {
TNode<RawPtrT> LoadFramePointer();
TNode<RawPtrT> LoadParentFramePointer();
// Access to the stack pointer
TNode<RawPtrT> LoadStackPointer();
// Poison |value| on speculative paths.
TNode<Object> TaggedPoisonOnSpeculation(SloppyTNode<Object> value);
TNode<WordT> WordPoisonOnSpeculation(SloppyTNode<WordT> value);
......
......@@ -911,7 +911,6 @@ class V8_EXPORT_PRIVATE RawMachineAssembler {
}
// Stack operations.
Node* LoadStackPointer() { return AddNode(machine()->LoadStackPointer()); }
Node* LoadFramePointer() { return AddNode(machine()->LoadFramePointer()); }
Node* LoadParentFramePointer() {
return AddNode(machine()->LoadParentFramePointer());
......
......@@ -48,9 +48,7 @@ InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
accumulator_use_(AccumulatorUse::kNone),
made_call_(false),
reloaded_frame_ptr_(false),
bytecode_array_valid_(true),
disable_stack_check_across_call_(false),
stack_pointer_before_call_(nullptr) {
bytecode_array_valid_(true) {
#ifdef V8_TRACE_IGNITION
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
#endif
......@@ -682,22 +680,11 @@ void InterpreterAssembler::CallPrologue() {
SaveBytecodeOffset();
}
if (FLAG_debug_code && !disable_stack_check_across_call_) {
DCHECK_NULL(stack_pointer_before_call_);
stack_pointer_before_call_ = LoadStackPointer();
}
bytecode_array_valid_ = false;
made_call_ = true;
}
void InterpreterAssembler::CallEpilogue() {
if (FLAG_debug_code && !disable_stack_check_across_call_) {
Node* stack_pointer_after_call = LoadStackPointer();
Node* stack_pointer_before_call = stack_pointer_before_call_;
stack_pointer_before_call_ = nullptr;
AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call,
AbortReason::kUnexpectedStackPointer);
}
}
void InterpreterAssembler::IncrementCallCount(Node* feedback_vector,
......@@ -1508,10 +1495,8 @@ Node* InterpreterAssembler::LoadOsrNestingLevel() {
}
void InterpreterAssembler::Abort(AbortReason abort_reason) {
disable_stack_check_across_call_ = true;
Node* abort_id = SmiConstant(abort_reason);
CallRuntime(Runtime::kAbort, GetContext(), abort_id);
disable_stack_check_across_call_ = false;
}
void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs,
......
......@@ -427,8 +427,6 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
bool made_call_;
bool reloaded_frame_ptr_;
bool bytecode_array_valid_;
bool disable_stack_check_across_call_;
compiler::Node* stack_pointer_before_call_;
DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler);
};
......
......@@ -3225,54 +3225,6 @@ TEST_F(InstructionSelectorTest, Float64Neg) {
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, StackCheck0) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit = m.Load(MachineType::Int32(), m.Parameter(0));
Node* const interrupt = m.UintPtrLessThan(sp, stack_limit);
RawMachineLabel if_true, if_false;
m.Branch(interrupt, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArmLdr, s[0]->arch_opcode());
EXPECT_EQ(kArmCmp, s[1]->arch_opcode());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(0U, s[1]->OutputCount());
}
TEST_F(InstructionSelectorTest, StackCheck1) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit = m.Load(MachineType::Int32(), m.Parameter(0));
Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp);
RawMachineLabel if_true, if_false;
m.Branch(sp_within_limit, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArmLdr, s[0]->arch_opcode());
EXPECT_EQ(kArmCmp, s[1]->arch_opcode());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(0U, s[1]->OutputCount());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -4571,54 +4571,6 @@ TEST_F(InstructionSelectorTest, CompareFloat64HighGreaterThanOrEqualZero64) {
EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, StackCheck0) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit = m.Load(MachineType::Int64(), m.Parameter(0));
Node* const interrupt = m.UintPtrLessThan(sp, stack_limit);
RawMachineLabel if_true, if_false;
m.Branch(interrupt, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Ldr, s[0]->arch_opcode());
EXPECT_EQ(kArm64Cmp, s[1]->arch_opcode());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(0U, s[1]->OutputCount());
}
TEST_F(InstructionSelectorTest, StackCheck1) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit = m.Load(MachineType::Int64(), m.Parameter(0));
Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp);
RawMachineLabel if_true, if_false;
m.Branch(sp_within_limit, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Ldr, s[0]->arch_opcode());
EXPECT_EQ(kArm64Cmp, s[1]->arch_opcode());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(0U, s[1]->OutputCount());
}
TEST_F(InstructionSelectorTest, ExternalReferenceLoad1) {
// Test offsets we can use kMode_Root for.
const int64_t kOffsets[] = {0, 1, 4, INT32_MIN, INT32_MAX};
......
......@@ -836,58 +836,6 @@ TEST_F(InstructionSelectorTest, Word32Clz) {
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, StackCheck0) {
ExternalReference js_stack_limit =
ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit());
StreamBuilder m(this, MachineType::Int32());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit =
m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit));
Node* const interrupt = m.UintPtrLessThan(sp, stack_limit);
RawMachineLabel if_true, if_false;
m.Branch(interrupt, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kIA32Cmp, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, StackCheck1) {
ExternalReference js_stack_limit =
ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit());
StreamBuilder m(this, MachineType::Int32());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit =
m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit));
Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp);
RawMachineLabel if_true, if_false;
m.Branch(sp_within_limit, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kIA32StackCheck, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -1718,58 +1718,6 @@ TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) {
}
}
TEST_F(InstructionSelectorTest, StackCheck0) {
ExternalReference js_stack_limit =
ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit());
StreamBuilder m(this, MachineType::Int32());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit =
m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit));
Node* const interrupt = m.UintPtrLessThan(sp, stack_limit);
RawMachineLabel if_true, if_false;
m.Branch(interrupt, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64Cmp, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, StackCheck1) {
ExternalReference js_stack_limit =
ExternalReference::Create(isolate()->stack_guard()->address_of_jslimit());
StreamBuilder m(this, MachineType::Int32());
Node* const sp = m.LoadStackPointer();
Node* const stack_limit =
m.Load(MachineType::Pointer(), m.ExternalConstant(js_stack_limit));
Node* const sp_within_limit = m.UintPtrLessThan(stack_limit, sp);
RawMachineLabel if_true, if_false;
m.Branch(sp_within_limit, &if_true, &if_false);
m.Bind(&if_true);
m.Return(m.Int32Constant(1));
m.Bind(&if_false);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kX64StackCheck, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
} // namespace compiler
} // namespace internal
} // namespace v8
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