[Interpreter] Maintain the parent frame pointer after load

Maintain the parent frame pointer in a variable after loading it to avoid
having to reload it each time it is required.

BUG=v8:4280

Review-Url: https://codereview.chromium.org/2085353005
Cr-Commit-Position: refs/heads/master@{#37247}
This commit is contained in:
rmcilroy 2016-06-24 03:14:07 -07:00 committed by Commit bot
parent 25b511ca9b
commit 361548ca4c
2 changed files with 20 additions and 5 deletions

View File

@ -31,6 +31,7 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
Bytecodes::ReturnCount(bytecode)),
bytecode_(bytecode),
operand_scale_(operand_scale),
interpreted_frame_pointer_(this, MachineType::PointerRepresentation()),
accumulator_(this, MachineRepresentation::kTagged),
accumulator_use_(AccumulatorUse::kNone),
made_call_(false),
@ -50,6 +51,13 @@ InterpreterAssembler::~InterpreterAssembler() {
DCHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_));
}
Node* InterpreterAssembler::GetInterpretedFramePointer() {
if (!interpreted_frame_pointer_.IsBound()) {
interpreted_frame_pointer_.Bind(LoadParentFramePointer());
}
return interpreted_frame_pointer_.value();
}
Node* InterpreterAssembler::GetAccumulatorUnchecked() {
return accumulator_.value();
}
@ -93,7 +101,8 @@ Node* InterpreterAssembler::DispatchTableRawPointer() {
}
Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
return IntPtrAdd(LoadParentFramePointer(), RegisterFrameOffset(reg_index));
return IntPtrAdd(GetInterpretedFramePointer(),
RegisterFrameOffset(reg_index));
}
Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
@ -101,24 +110,24 @@ Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
}
Node* InterpreterAssembler::LoadRegister(Register reg) {
return Load(MachineType::AnyTagged(), LoadParentFramePointer(),
return Load(MachineType::AnyTagged(), GetInterpretedFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2));
}
Node* InterpreterAssembler::LoadRegister(Node* reg_index) {
return Load(MachineType::AnyTagged(), LoadParentFramePointer(),
return Load(MachineType::AnyTagged(), GetInterpretedFramePointer(),
RegisterFrameOffset(reg_index));
}
Node* InterpreterAssembler::StoreRegister(Node* value, Register reg) {
return StoreNoWriteBarrier(
MachineRepresentation::kTagged, LoadParentFramePointer(),
MachineRepresentation::kTagged, GetInterpretedFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2), value);
}
Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
return StoreNoWriteBarrier(MachineRepresentation::kTagged,
LoadParentFramePointer(),
GetInterpretedFramePointer(),
RegisterFrameOffset(reg_index), value);
}

View File

@ -159,6 +159,7 @@ class InterpreterAssembler : public CodeStubAssembler {
private:
// Returns a tagged pointer to the current function's BytecodeArray object.
compiler::Node* BytecodeArrayTaggedPointer();
// Returns a raw pointer to first entry in the interpreter dispatch table.
compiler::Node* DispatchTableRawPointer();
@ -167,6 +168,10 @@ class InterpreterAssembler : public CodeStubAssembler {
// tracing as these need to bypass accumulator use validity checks.
compiler::Node* GetAccumulatorUnchecked();
// Returns the frame pointer for the interpreted frame of the function being
// interpreted.
compiler::Node* GetInterpretedFramePointer();
// Saves and restores interpreter bytecode offset to the interpreter stack
// frame when performing a call.
void CallPrologue() override;
@ -233,6 +238,7 @@ class InterpreterAssembler : public CodeStubAssembler {
Bytecode bytecode_;
OperandScale operand_scale_;
CodeStubAssembler::Variable interpreted_frame_pointer_;
CodeStubAssembler::Variable accumulator_;
AccumulatorUse accumulator_use_;
bool made_call_;