Commit 4e4fa66f authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Avoid binding bytecode_array to a variable in CallEpilogue

Binding bytecode_array to a CodeStubAssembler variable in CallEpilogue
was causing issues with the approach to inline code stubs into
interpreter bytecode handlers. Instead of doing this, just keep track of
whether a call has been made, and if so reload directly from the stack
frame when necessary.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1895063002

Cr-Commit-Position: refs/heads/master@{#35586}
parent 5110f6c8
...@@ -32,13 +32,11 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, ...@@ -32,13 +32,11 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
operand_scale_(operand_scale), operand_scale_(operand_scale),
accumulator_(this, MachineRepresentation::kTagged), accumulator_(this, MachineRepresentation::kTagged),
accumulator_use_(AccumulatorUse::kNone), accumulator_use_(AccumulatorUse::kNone),
bytecode_array_(this, MachineRepresentation::kTagged), made_call_(false),
disable_stack_check_across_call_(false), disable_stack_check_across_call_(false),
stack_pointer_before_call_(nullptr) { stack_pointer_before_call_(nullptr) {
accumulator_.Bind( accumulator_.Bind(
Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter)); Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
bytecode_array_.Bind(
Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter));
if (FLAG_trace_ignition) { if (FLAG_trace_ignition) {
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
} }
...@@ -84,7 +82,14 @@ Node* InterpreterAssembler::RegisterFileRawPointer() { ...@@ -84,7 +82,14 @@ Node* InterpreterAssembler::RegisterFileRawPointer() {
} }
Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
return bytecode_array_.value(); if (made_call_) {
// If we have made a call, restore bytecode array from stack frame in case
// the debugger has swapped us to the patched debugger bytecode array.
return LoadRegister(
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer);
} else {
return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter);
}
} }
Node* InterpreterAssembler::DispatchTableRawPointer() { Node* InterpreterAssembler::DispatchTableRawPointer() {
...@@ -423,6 +428,7 @@ void InterpreterAssembler::CallPrologue() { ...@@ -423,6 +428,7 @@ void InterpreterAssembler::CallPrologue() {
DCHECK(stack_pointer_before_call_ == nullptr); DCHECK(stack_pointer_before_call_ == nullptr);
stack_pointer_before_call_ = LoadStackPointer(); stack_pointer_before_call_ = LoadStackPointer();
} }
made_call_ = true;
} }
void InterpreterAssembler::CallEpilogue() { void InterpreterAssembler::CallEpilogue() {
...@@ -433,11 +439,6 @@ void InterpreterAssembler::CallEpilogue() { ...@@ -433,11 +439,6 @@ void InterpreterAssembler::CallEpilogue() {
AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call, AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call,
kUnexpectedStackPointer); kUnexpectedStackPointer);
} }
// Restore bytecode array from stack frame in case the debugger has swapped us
// to the patched debugger bytecode array.
bytecode_array_.Bind(LoadRegister(
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
} }
Node* InterpreterAssembler::CallJS(Node* function, Node* context, Node* InterpreterAssembler::CallJS(Node* function, Node* context,
......
...@@ -233,7 +233,7 @@ class InterpreterAssembler : public CodeStubAssembler { ...@@ -233,7 +233,7 @@ class InterpreterAssembler : public CodeStubAssembler {
OperandScale operand_scale_; OperandScale operand_scale_;
CodeStubAssembler::Variable accumulator_; CodeStubAssembler::Variable accumulator_;
AccumulatorUse accumulator_use_; AccumulatorUse accumulator_use_;
CodeStubAssembler::Variable bytecode_array_; bool made_call_;
bool disable_stack_check_across_call_; bool disable_stack_check_across_call_;
compiler::Node* stack_pointer_before_call_; compiler::Node* stack_pointer_before_call_;
......
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