Commit 623ad7de authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Remove register file register and replace with LoadParentFramePointer.

Removes the register file machine register from the interpreter and
replaces it will loads from the parent frame pointer. As part of this
change the raw operand values for register values changes to enable the
interpreter to keep using the operand value as the offset from the
parent frame pointer.

BUG=v8:4280
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35618}
parent 09b50113
......@@ -1050,8 +1050,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load accumulator, register file, bytecode offset, dispatch table into
// registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ add(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ add(r4, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
__ mov(kInterpreterBytecodeOffsetRegister,
Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ mov(kInterpreterDispatchTableRegister,
......@@ -1071,12 +1070,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in r0.
// Leave the frame (also dropping the register file).
......@@ -1155,18 +1148,14 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ add(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize the dispatch table register.
__ mov(kInterpreterDispatchTableRegister,
Operand(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ ldr(
kInterpreterBytecodeArrayRegister,
MemOperand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
__ ldr(kInterpreterBytecodeArrayRegister,
MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -1179,9 +1168,7 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Get the target bytecode offset from the frame.
__ ldr(kInterpreterBytecodeOffsetRegister,
MemOperand(
kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
// Dispatch to the target bytecode.
......
......@@ -397,9 +397,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -20,7 +20,6 @@ const Register kReturnRegister2 = {Register::kCode_r2};
const Register kJSFunctionRegister = {Register::kCode_r1};
const Register kContextRegister = {Register::kCode_r7};
const Register kInterpreterAccumulatorRegister = {Register::kCode_r0};
const Register kInterpreterRegisterFileRegister = {Register::kCode_r4};
const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_r5};
const Register kInterpreterBytecodeArrayRegister = {Register::kCode_r6};
const Register kInterpreterDispatchTableRegister = {Register::kCode_r8};
......
......@@ -1052,8 +1052,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load accumulator, register file, bytecode offset, dispatch table into
// registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ Add(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ Add(x18, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
__ Mov(kInterpreterBytecodeOffsetRegister,
Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ Mov(kInterpreterDispatchTableRegister,
......@@ -1079,12 +1078,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in x0.
// Leave the frame (also dropping the register file).
......@@ -1099,18 +1092,14 @@ void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ Add(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize the dispatch table register.
__ Mov(kInterpreterDispatchTableRegister,
Operand(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ Ldr(
kInterpreterBytecodeArrayRegister,
MemOperand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
__ Ldr(kInterpreterBytecodeArrayRegister,
MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -1123,9 +1112,7 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Get the target bytecode offset from the frame.
__ Ldr(kInterpreterBytecodeOffsetRegister,
MemOperand(
kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
// Dispatch to the target bytecode.
......
......@@ -429,9 +429,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -40,7 +40,6 @@ namespace internal {
#define kJSFunctionRegister x1
#define kContextRegister cp
#define kInterpreterAccumulatorRegister x0
#define kInterpreterRegisterFileRegister x18
#define kInterpreterBytecodeOffsetRegister x19
#define kInterpreterBytecodeArrayRegister x20
#define kInterpreterDispatchTableRegister x21
......
......@@ -1253,7 +1253,7 @@ void InterpretedFrame::PatchBytecodeArray(BytecodeArray* bytecode_array) {
Object* InterpretedFrame::ReadInterpreterRegister(int register_index) const {
const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex;
DCHECK_EQ(
InterpreterFrameConstants::kRegisterFilePointerFromFp,
InterpreterFrameConstants::kRegisterFileFromFp,
InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
return GetExpression(index + register_index);
}
......@@ -1262,7 +1262,7 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index,
Object* value) {
const int index = InterpreterFrameConstants::kRegisterFileExpressionIndex;
DCHECK_EQ(
InterpreterFrameConstants::kRegisterFilePointerFromFp,
InterpreterFrameConstants::kRegisterFileFromFp,
InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
return SetExpression(index + register_index, value);
}
......
......@@ -324,31 +324,22 @@ class InterpreterFrameConstants : public AllStatic {
StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize;
// FP-relative.
static const int kLastParamFromFp = StandardFrameConstants::kCallerSPOffset;
static const int kNewTargetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize;
static const int kBytecodeArrayFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize;
static const int kBytecodeOffsetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize;
static const int kRegisterFilePointerFromFp =
static const int kRegisterFileFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 4 * kPointerSize;
static const int kExpressionsOffset = kRegisterFilePointerFromFp;
static const int kExpressionsOffset = kRegisterFileFromFp;
// Expression index for {StandardFrame::GetExpressionAddress}.
static const int kBytecodeArrayExpressionIndex = -2;
static const int kBytecodeOffsetExpressionIndex = -1;
static const int kRegisterFileExpressionIndex = 0;
// Register file pointer relative.
static const int kLastParamFromRegisterPointer =
StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize;
static const int kBytecodeArrayFromRegisterPointer = 2 * kPointerSize;
static const int kNewTargetFromRegisterPointer = 3 * kPointerSize;
static const int kFunctionFromRegisterPointer = 4 * kPointerSize;
static const int kContextFromRegisterPointer = 5 * kPointerSize;
};
inline static int FPOffsetToFrameSlot(int frame_offset) {
......
......@@ -613,9 +613,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load accumulator, register file, bytecode offset, dispatch table into
// registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ mov(kInterpreterRegisterFileRegister, ebp);
__ add(kInterpreterRegisterFileRegister,
Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ mov(edx, ebp);
__ add(edx, Immediate(InterpreterFrameConstants::kRegisterFileFromFp));
__ mov(kInterpreterBytecodeOffsetRegister,
Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ mov(kInterpreterDispatchTableRegister,
......@@ -643,13 +642,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in rax.
// The return value is in accumulator, which is already in eax.
// Leave the frame (also dropping the register file).
__ leave();
......@@ -752,18 +745,14 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ mov(kInterpreterRegisterFileRegister, ebp);
__ add(kInterpreterRegisterFileRegister,
Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize the dispatch table register.
__ mov(kInterpreterDispatchTableRegister,
Immediate(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ mov(kInterpreterBytecodeArrayRegister,
Operand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
Operand(ebp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -774,10 +763,8 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
}
// Get the target bytecode offset from the frame.
__ mov(
kInterpreterBytecodeOffsetRegister,
Operand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
__ mov(kInterpreterBytecodeOffsetRegister,
Operand(ebp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
// Dispatch to the target bytecode.
......
......@@ -381,9 +381,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -20,7 +20,6 @@ const Register kReturnRegister2 = {Register::kCode_edi};
const Register kJSFunctionRegister = {Register::kCode_edi};
const Register kContextRegister = {Register::kCode_esi};
const Register kInterpreterAccumulatorRegister = {Register::kCode_eax};
const Register kInterpreterRegisterFileRegister = {Register::kCode_edx};
const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_ecx};
const Register kInterpreterBytecodeArrayRegister = {Register::kCode_edi};
const Register kInterpreterDispatchTableRegister = {Register::kCode_esi};
......
......@@ -522,9 +522,8 @@ InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction();
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(kAccumulatorParameter, AnyTagged(zone));
function->InitParameter(kRegisterFileParameter, ExternalPointer(zone));
function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone));
function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone));
function->InitParameter(kDispatchTableParameter, AnyTagged(zone));
......
......@@ -796,11 +796,9 @@ class InterpreterDispatchDescriptor : public CallInterfaceDescriptor {
CallInterfaceDescriptor)
static const int kAccumulatorParameter = 0;
static const int kRegisterFileParameter = 1;
static const int kBytecodeOffsetParameter = 2;
static const int kBytecodeArrayParameter = 3;
static const int kDispatchTableParameter = 4;
static const int kContextParameter = 5;
static const int kBytecodeOffsetParameter = 1;
static const int kBytecodeArrayParameter = 2;
static const int kDispatchTableParameter = 3;
};
class InterpreterPushArgsAndCallDescriptor : public CallInterfaceDescriptor {
......
This diff is collapsed.
......@@ -645,21 +645,29 @@ std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) {
}
static const int kLastParamRegisterIndex =
-InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize;
(InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kLastParamFromFp) /
kPointerSize;
static const int kFunctionClosureRegisterIndex =
-InterpreterFrameConstants::kFunctionFromRegisterPointer / kPointerSize;
(InterpreterFrameConstants::kRegisterFileFromFp -
StandardFrameConstants::kFunctionOffset) /
kPointerSize;
static const int kCurrentContextRegisterIndex =
-InterpreterFrameConstants::kContextFromRegisterPointer / kPointerSize;
(InterpreterFrameConstants::kRegisterFileFromFp -
StandardFrameConstants::kContextOffset) /
kPointerSize;
static const int kNewTargetRegisterIndex =
-InterpreterFrameConstants::kNewTargetFromRegisterPointer / kPointerSize;
bool Register::is_byte_operand() const {
return index_ >= -kMaxInt8 && index_ <= -kMinInt8;
}
bool Register::is_short_operand() const {
return index_ >= -kMaxInt16 && index_ <= -kMinInt16;
}
(InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kNewTargetFromFp) /
kPointerSize;
static const int kBytecodeArrayRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kBytecodeArrayFromFp) /
kPointerSize;
static const int kBytecodeOffsetRegisterIndex =
(InterpreterFrameConstants::kRegisterFileFromFp -
InterpreterFrameConstants::kBytecodeOffsetFromFp) /
kPointerSize;
Register Register::FromParameterIndex(int index, int parameter_count) {
DCHECK_GE(index, 0);
......@@ -669,40 +677,60 @@ Register Register::FromParameterIndex(int index, int parameter_count) {
return Register(register_index);
}
int Register::ToParameterIndex(int parameter_count) const {
DCHECK(is_parameter());
return index() - kLastParamRegisterIndex + parameter_count - 1;
}
Register Register::function_closure() {
return Register(kFunctionClosureRegisterIndex);
}
bool Register::is_function_closure() const {
return index() == kFunctionClosureRegisterIndex;
}
Register Register::current_context() {
return Register(kCurrentContextRegisterIndex);
}
bool Register::is_current_context() const {
return index() == kCurrentContextRegisterIndex;
}
Register Register::new_target() { return Register(kNewTargetRegisterIndex); }
bool Register::is_new_target() const {
return index() == kNewTargetRegisterIndex;
}
Register Register::bytecode_array() {
return Register(kBytecodeArrayRegisterIndex);
}
bool Register::is_bytecode_array() const {
return index() == kBytecodeArrayRegisterIndex;
}
Register Register::bytecode_offset() {
return Register(kBytecodeOffsetRegisterIndex);
}
bool Register::is_bytecode_offset() const {
return index() == kBytecodeOffsetRegisterIndex;
}
OperandSize Register::SizeOfOperand() const {
int32_t operand = ToOperand();
if (operand >= kMinInt8 && operand <= kMaxInt8) {
return OperandSize::kByte;
} else if (index_ >= kMinInt16 && index_ <= kMaxInt16) {
return OperandSize::kShort;
} else {
return OperandSize::kQuad;
}
}
bool Register::AreContiguous(Register reg1, Register reg2, Register reg3,
Register reg4, Register reg5) {
if (reg1.index() + 1 != reg2.index()) {
......
......@@ -9,6 +9,7 @@
// Clients of this interface shouldn't depend on lots of interpreter internals.
// Do not include anything from src/interpreter here!
#include "src/frames.h"
#include "src/utils.h"
namespace v8 {
......@@ -335,8 +336,6 @@ class Register {
int index() const { return index_; }
bool is_parameter() const { return index() < 0; }
bool is_valid() const { return index_ != kInvalidIndex; }
bool is_byte_operand() const;
bool is_short_operand() const;
static Register FromParameterIndex(int index, int parameter_count);
int ToParameterIndex(int parameter_count) const;
......@@ -356,8 +355,20 @@ class Register {
static Register new_target();
bool is_new_target() const;
int32_t ToOperand() const { return -index_; }
static Register FromOperand(int32_t operand) { return Register(-operand); }
// Returns the register for the bytecode array.
static Register bytecode_array();
bool is_bytecode_array() const;
// Returns the register for the saved bytecode offset.
static Register bytecode_offset();
bool is_bytecode_offset() const;
OperandSize SizeOfOperand() const;
int32_t ToOperand() const { return kRegisterFileStartOffset - index_; }
static Register FromOperand(int32_t operand) {
return Register(kRegisterFileStartOffset - operand);
}
static bool AreContiguous(Register reg1, Register reg2,
Register reg3 = Register(),
......@@ -387,6 +398,8 @@ class Register {
private:
static const int kInvalidIndex = kMaxInt;
static const int kRegisterFileStartOffset =
InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize;
void* operator new(size_t size);
void operator delete(void* p);
......
......@@ -77,16 +77,11 @@ Node* InterpreterAssembler::BytecodeOffset() {
return Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter);
}
Node* InterpreterAssembler::RegisterFileRawPointer() {
return Parameter(InterpreterDispatchDescriptor::kRegisterFileParameter);
}
Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
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);
return LoadRegister(Register::bytecode_array());
} else {
return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter);
}
......@@ -97,40 +92,32 @@ Node* InterpreterAssembler::DispatchTableRawPointer() {
}
Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index));
return IntPtrAdd(LoadParentFramePointer(), RegisterFrameOffset(reg_index));
}
Node* InterpreterAssembler::LoadRegister(int offset) {
return Load(MachineType::AnyTagged(), RegisterFileRawPointer(),
IntPtrConstant(offset));
Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
return WordShl(index, kPointerSizeLog2);
}
Node* InterpreterAssembler::LoadRegister(Register reg) {
return LoadRegister(-reg.index() << kPointerSizeLog2);
}
Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
return WordShl(index, kPointerSizeLog2);
return Load(MachineType::AnyTagged(), LoadParentFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2));
}
Node* InterpreterAssembler::LoadRegister(Node* reg_index) {
return Load(MachineType::AnyTagged(), RegisterFileRawPointer(),
return Load(MachineType::AnyTagged(), LoadParentFramePointer(),
RegisterFrameOffset(reg_index));
}
Node* InterpreterAssembler::StoreRegister(Node* value, int offset) {
return StoreNoWriteBarrier(MachineRepresentation::kTagged,
RegisterFileRawPointer(), IntPtrConstant(offset),
value);
}
Node* InterpreterAssembler::StoreRegister(Node* value, Register reg) {
return StoreRegister(value, IntPtrConstant(-reg.index()));
return StoreNoWriteBarrier(
MachineRepresentation::kTagged, LoadParentFramePointer(),
IntPtrConstant(reg.ToOperand() << kPointerSizeLog2), value);
}
Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
return StoreNoWriteBarrier(MachineRepresentation::kTagged,
RegisterFileRawPointer(),
LoadParentFramePointer(),
RegisterFrameOffset(reg_index), value);
}
......@@ -410,9 +397,7 @@ Node* InterpreterAssembler::StoreContextSlot(Node* context, Node* slot_index,
}
Node* InterpreterAssembler::LoadTypeFeedbackVector() {
Node* function = Load(
MachineType::AnyTagged(), RegisterFileRawPointer(),
IntPtrConstant(InterpreterFrameConstants::kFunctionFromRegisterPointer));
Node* function = LoadRegister(Register::function_closure());
Node* shared_info =
LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset);
Node* vector =
......@@ -421,8 +406,7 @@ Node* InterpreterAssembler::LoadTypeFeedbackVector() {
}
void InterpreterAssembler::CallPrologue() {
StoreRegister(SmiTag(BytecodeOffset()),
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer);
StoreRegister(SmiTag(BytecodeOffset()), Register::bytecode_offset());
if (FLAG_debug_code && !disable_stack_check_across_call_) {
DCHECK(stack_pointer_before_call_ == nullptr);
......@@ -579,9 +563,8 @@ void InterpreterAssembler::DispatchToBytecodeHandlerEntry(
}
InterpreterDispatchDescriptor descriptor(isolate());
Node* args[] = {GetAccumulatorUnchecked(), RegisterFileRawPointer(),
bytecode_offset, BytecodeArrayTaggedPointer(),
DispatchTableRawPointer()};
Node* args[] = {GetAccumulatorUnchecked(), bytecode_offset,
BytecodeArrayTaggedPointer(), DispatchTableRawPointer()};
TailCallBytecodeDispatch(descriptor, handler_entry, args);
}
......
......@@ -51,10 +51,8 @@ class InterpreterAssembler : public CodeStubAssembler {
void SetContext(compiler::Node* value);
// Loads from and stores to the interpreter register file.
compiler::Node* LoadRegister(int offset);
compiler::Node* LoadRegister(Register reg);
compiler::Node* LoadRegister(compiler::Node* reg_index);
compiler::Node* StoreRegister(compiler::Node* value, int offset);
compiler::Node* StoreRegister(compiler::Node* value, Register reg);
compiler::Node* StoreRegister(compiler::Node* value,
compiler::Node* reg_index);
......@@ -152,8 +150,6 @@ class InterpreterAssembler : public CodeStubAssembler {
static bool TargetSupportsUnalignedAccess();
private:
// Returns a raw pointer to start of the register file on the stack.
compiler::Node* RegisterFileRawPointer();
// Returns a tagged pointer to the current function's BytecodeArray object.
compiler::Node* BytecodeArrayTaggedPointer();
// Returns the offset from the BytecodeArrayPointer of the current bytecode.
......
......@@ -1039,8 +1039,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load bytecode offset and dispatch table into registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ Addu(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ Addu(t3, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
__ li(kInterpreterBytecodeOffsetRegister,
Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ li(kInterpreterDispatchTableRegister,
......@@ -1067,12 +1066,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in v0.
// Leave the frame (also dropping the register file).
......@@ -1151,18 +1144,14 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ Addu(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize the dispatch table register.
__ li(kInterpreterDispatchTableRegister,
Operand(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ lw(
kInterpreterBytecodeArrayRegister,
MemOperand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
__ lw(kInterpreterBytecodeArrayRegister,
MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -1176,9 +1165,7 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Get the target bytecode offset from the frame.
__ lw(kInterpreterBytecodeOffsetRegister,
MemOperand(
kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
// Dispatch to the target bytecode.
......
......@@ -376,9 +376,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -19,7 +19,6 @@ const Register kReturnRegister2 = {Register::kCode_a0};
const Register kJSFunctionRegister = {Register::kCode_a1};
const Register kContextRegister = {Register::kCpRegister};
const Register kInterpreterAccumulatorRegister = {Register::kCode_v0};
const Register kInterpreterRegisterFileRegister = {Register::kCode_t3};
const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_t4};
const Register kInterpreterBytecodeArrayRegister = {Register::kCode_t5};
const Register kInterpreterDispatchTableRegister = {Register::kCode_t6};
......
......@@ -1028,8 +1028,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load bytecode offset and dispatch table into registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ Daddu(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ Daddu(a7, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
__ li(kInterpreterBytecodeOffsetRegister,
Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ li(kInterpreterDispatchTableRegister,
......@@ -1056,12 +1055,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in v0.
// Leave the frame (also dropping the register file).
......@@ -1140,18 +1133,14 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ Daddu(kInterpreterRegisterFileRegister, fp,
Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize the dispatch table register.
__ li(kInterpreterDispatchTableRegister,
Operand(ExternalReference::interpreter_dispatch_table_address(
masm->isolate())));
// Get the bytecode array pointer from the frame.
__ ld(
kInterpreterBytecodeArrayRegister,
MemOperand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
__ ld(kInterpreterBytecodeArrayRegister,
MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -1165,9 +1154,7 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Get the target bytecode offset from the frame.
__ ld(kInterpreterBytecodeOffsetRegister,
MemOperand(
kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiUntag(kInterpreterBytecodeOffsetRegister);
// Dispatch to the target bytecode.
......
......@@ -375,9 +375,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -19,7 +19,6 @@ const Register kReturnRegister2 = {Register::kCode_a0};
const Register kJSFunctionRegister = {Register::kCode_a1};
const Register kContextRegister = {Register::kCpRegister};
const Register kInterpreterAccumulatorRegister = {Register::kCode_v0};
const Register kInterpreterRegisterFileRegister = {Register::kCode_a7};
const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_t0};
const Register kInterpreterBytecodeArrayRegister = {Register::kCode_t1};
const Register kInterpreterDispatchTableRegister = {Register::kCode_t2};
......
......@@ -64,14 +64,11 @@ void PrintRegisters(std::ostream& os, bool is_input,
os << " ]" << std::endl;
}
// Find the location of the register file.
// Print the registers.
JavaScriptFrameIterator frame_iterator(
bytecode_iterator.bytecode_array()->GetIsolate());
JavaScriptFrame* frame = frame_iterator.frame();
Address register_file =
frame->fp() + InterpreterFrameConstants::kRegisterFilePointerFromFp;
// Print the registers.
InterpretedFrame* frame =
reinterpret_cast<InterpretedFrame*>(frame_iterator.frame());
int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode);
for (int operand_index = 0; operand_index < operand_count; operand_index++) {
interpreter::OperandType operand_type =
......@@ -86,8 +83,7 @@ void PrintRegisters(std::ostream& os, bool is_input,
int range = bytecode_iterator.GetRegisterOperandRange(operand_index);
for (int reg_index = first_reg.index();
reg_index < first_reg.index() + range; reg_index++) {
Address reg_location = register_file - reg_index * kPointerSize;
Object* reg_object = Memory::Object_at(reg_location);
Object* reg_object = frame->ReadInterpreterRegister(reg_index);
os << " [ " << std::setw(kRegFieldWidth)
<< interpreter::Register(reg_index).ToString(
bytecode_iterator.bytecode_array()->parameter_count())
......
......@@ -690,9 +690,8 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load accumulator, register file, bytecode offset, dispatch table into
// registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ movp(kInterpreterRegisterFileRegister, rbp);
__ addp(kInterpreterRegisterFileRegister,
Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
__ movp(r11, rbp);
__ addp(r11, Immediate(InterpreterFrameConstants::kRegisterFileFromFp));
__ movp(kInterpreterBytecodeOffsetRegister,
Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ Move(
......@@ -720,12 +719,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// TODO(rmcilroy): List of things not currently dealt with here but done in
// fullcodegen's EmitReturnSequence.
// - Supporting FLAG_trace for Runtime::TraceExit.
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// The return value is in accumulator, which is already in rax.
// Leave the frame (also dropping the register file).
......@@ -825,19 +818,14 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
// Initialize register file register and dispatch table register.
__ movp(kInterpreterRegisterFileRegister, rbp);
__ addp(kInterpreterRegisterFileRegister,
Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
// Initialize dispatch table register.
__ Move(
kInterpreterDispatchTableRegister,
ExternalReference::interpreter_dispatch_table_address(masm->isolate()));
// Get the bytecode array pointer from the frame.
__ movp(
kInterpreterBytecodeArrayRegister,
Operand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
__ movp(kInterpreterBytecodeArrayRegister,
Operand(rbp, InterpreterFrameConstants::kBytecodeArrayFromFp));
if (FLAG_debug_code) {
// Check function data field is actually a BytecodeArray object.
......@@ -848,10 +836,8 @@ static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
}
// Get the target bytecode offset from the frame.
__ movp(
kInterpreterBytecodeOffsetRegister,
Operand(kInterpreterRegisterFileRegister,
InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
__ movp(kInterpreterBytecodeOffsetRegister,
Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp));
__ SmiToInteger32(kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeOffsetRegister);
......
......@@ -372,9 +372,8 @@ void ApiCallbackDescriptorBase::InitializePlatformSpecific(
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterRegisterFileRegister,
kInterpreterBytecodeOffsetRegister, kInterpreterBytecodeArrayRegister,
kInterpreterDispatchTableRegister};
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -22,7 +22,6 @@ const Register kReturnRegister2 = {Register::kCode_r8};
const Register kJSFunctionRegister = {Register::kCode_rdi};
const Register kContextRegister = {Register::kCode_rsi};
const Register kInterpreterAccumulatorRegister = {Register::kCode_rax};
const Register kInterpreterRegisterFileRegister = {Register::kCode_r11};
const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_r12};
const Register kInterpreterBytecodeArrayRegister = {Register::kCode_r14};
const Register kInterpreterDispatchTableRegister = {Register::kCode_r15};
......
......@@ -171,10 +171,10 @@ snippet: "
"
frame size: 157
parameter count: 1
bytecode array length: 6
bytecode array length: 8
bytecodes: [
B(StackCheck),
B(Ldar), R(127),
B(Wide), B(Ldar), R16(127),
B(Star), R(0),
B(Return),
]
......@@ -347,11 +347,11 @@ snippet: "
"
frame size: 157
parameter count: 1
bytecode array length: 6
bytecode array length: 10
bytecodes: [
B(StackCheck),
B(Ldar), R(126),
B(Star), R(127),
B(Wide), B(Ldar), R16(126),
B(Wide), B(Star), R16(127),
B(Return),
]
constant pool: [
......@@ -523,7 +523,7 @@ snippet: "
"
frame size: 158
parameter count: 1
bytecode array length: 23
bytecode array length: 25
bytecodes: [
B(StackCheck),
B(Ldar), R(2),
......@@ -533,7 +533,7 @@ bytecodes: [
B(JumpIfFalse), U8(7),
B(Wide), B(Ldar), R16(129),
B(Return),
B(Ldar), R(128),
B(Wide), B(Ldar), R16(128),
B(Return),
]
constant pool: [
......@@ -899,7 +899,7 @@ snippet: "
"
frame size: 158
parameter count: 1
bytecode array length: 54
bytecode array length: 66
bytecodes: [
B(StackCheck),
B(LdaZero),
......@@ -907,25 +907,25 @@ bytecodes: [
B(LdaZero),
B(Star), R(1),
B(LdaZero),
B(Star), R(128),
B(Ldar), R(128),
B(Wide), B(Star), R16(128),
B(Wide), B(Ldar), R16(128),
B(Wide), B(Star), R16(157),
B(LdaSmi), U8(64),
B(Wide), B(TestLessThan), R16(157),
B(JumpIfFalse), U8(29),
B(JumpIfFalse), U8(35),
B(StackCheck),
B(Ldar), R(1),
B(Wide), B(Star), R16(157),
B(Ldar), R(128),
B(Wide), B(Ldar), R16(128),
B(Wide), B(Add), R16(157),
B(Star), R(1),
B(Ldar), R(128),
B(Wide), B(Ldar), R16(128),
B(ToNumber),
B(Wide), B(Star), R16(157),
B(Inc),
B(Star), R(128),
B(Jump), U8(-39),
B(Ldar), R(128),
B(Wide), B(Star), R16(128),
B(Jump), U8(-47),
B(Wide), B(Ldar), R16(128),
B(Return),
]
constant pool: [
......@@ -1098,7 +1098,7 @@ snippet: "
"
frame size: 163
parameter count: 1
bytecode array length: 80
bytecode array length: 84
bytecodes: [
B(StackCheck),
B(Wide), B(LdaSmi), U16(1234),
......@@ -1106,27 +1106,27 @@ bytecodes: [
B(LdaZero),
B(Star), R(1),
B(Ldar), R(0),
B(JumpIfUndefined), U8(65),
B(JumpIfNull), U8(63),
B(JumpIfUndefined), U8(69),
B(JumpIfNull), U8(67),
B(ToObject),
B(Wide), B(Star), R16(157),
B(Wide), B(ForInPrepare), R16(158),
B(LdaZero),
B(Wide), B(Star), R16(161),
B(Wide), B(ForInDone), R16(161), R16(160),
B(JumpIfTrue), U8(41),
B(JumpIfTrue), U8(45),
B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(1),
B(JumpIfUndefined), U8(19),
B(Star), R(128),
B(JumpIfUndefined), U8(23),
B(Wide), B(Star), R16(128),
B(StackCheck),
B(Ldar), R(1),
B(Wide), B(Star), R16(162),
B(Ldar), R(128),
B(Wide), B(Ldar), R16(128),
B(Wide), B(Add), R16(162),
B(Star), R(1),
B(Wide), B(ForInStep), R16(161),
B(Wide), B(Star), R16(161),
B(Jump), U8(-45),
B(Jump), U8(-49),
B(Ldar), R(1),
B(Return),
]
......
......@@ -2204,6 +2204,10 @@ Matcher<Node*> IsLoadFramePointer() {
return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer));
}
Matcher<Node*> IsLoadParentFramePointer() {
return MakeMatcher(new NodeMatcher(IrOpcode::kLoadParentFramePointer));
}
#define IS_QUADOP_MATCHER(Name) \
Matcher<Node*> Is##Name( \
const Matcher<Node*>& a_matcher, const Matcher<Node*>& b_matcher, \
......
......@@ -360,6 +360,7 @@ Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher);
Matcher<Node*> IsParameter(const Matcher<int> index_matcher);
Matcher<Node*> IsLoadFramePointer();
Matcher<Node*> IsLoadParentFramePointer();
Matcher<Node*> IsInt32PairAdd(const Matcher<Node*>& a_matcher,
const Matcher<Node*>& b_matcher,
......
......@@ -364,14 +364,11 @@ TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) {
TEST_F(BytecodeArrayBuilderTest, RegisterValues) {
int index = 1;
int32_t operand = -index;
Register the_register(index);
CHECK_EQ(the_register.index(), index);
int actual_operand = the_register.ToOperand();
CHECK_EQ(actual_operand, operand);
int actual_index = Register::FromOperand(actual_operand).index();
CHECK_EQ(actual_index, index);
}
......
......@@ -31,15 +31,6 @@ TEST(OperandConversion, Registers) {
Register reg2 = Register::FromOperand(operand2);
CHECK_EQ(i, reg2.index());
}
for (int i = 0; i <= kMaxUInt8; i++) {
Register reg = Register::FromOperand(i);
if (i > 0) {
CHECK(reg.is_parameter());
} else {
CHECK(!reg.is_parameter());
}
}
}
TEST(OperandConversion, Parameters) {
......@@ -200,9 +191,9 @@ TEST(Bytecodes, DecodeBytecodeAndOperands) {
6,
0,
"LdaSmi.ExtraWide [-100000]"},
{{B(Star), 0xfb}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0x78, 0xff}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0x7a, 0xff, 0x79, 0xff, 0x02, 0x00, 0xb1, 0x00},
{{B(Star), 0xf5}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0x72, 0xff}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0x74, 0xff, 0x73, 0xff, 0x02, 0x00, 0xb1, 0x00},
10,
0,
"Call.Wide r134, r135, #2, [177]"},
......@@ -232,9 +223,9 @@ TEST(Bytecodes, DecodeBytecodeAndOperands) {
6,
0,
"LdaSmi.ExtraWide [-100000]"},
{{B(Star), 0xfb}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0xff, 0x78}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0xff, 0x7a, 0xff, 0x79, 0x00, 0x02, 0x00, 0xb1},
{{B(Star), 0xf5}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0xff, 0x72}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0xff, 0x74, 0xff, 0x73, 0x00, 0x02, 0x00, 0xb1},
10,
0,
"Call.Wide r134, r135, #2, [177]"},
......
......@@ -342,7 +342,6 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
IsTailCall(
_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
next_bytecode_offset_matcher,
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter),
......@@ -384,8 +383,6 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
IsTailCall(
_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
IsParameter(
InterpreterDispatchDescriptor::kRegisterFileParameter),
next_bytecode_offset_matcher, _,
IsParameter(
InterpreterDispatchDescriptor::kDispatchTableParameter),
......@@ -434,8 +431,6 @@ TARGET_TEST_F(InterpreterAssemblerTest, JumpIfWordEqual) {
IsTailCall(
_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
IsParameter(
InterpreterDispatchDescriptor::kRegisterFileParameter),
next_bytecode_offset_matcher, _,
IsParameter(
InterpreterDispatchDescriptor::kDispatchTableParameter),
......@@ -469,7 +464,6 @@ TARGET_TEST_F(InterpreterAssemblerTest, InterpreterReturn) {
IsTailCall(
_, exit_trampoline_entry_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
_,
......@@ -562,7 +556,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) {
Node* tail_call_node = end->InputAt(0);
EXPECT_THAT(tail_call_node,
IsTailCall(_, _, accumulator_value_2, _, _, _, _, _, _));
IsTailCall(_, _, accumulator_value_2, _, _, _, _));
}
}
......@@ -571,11 +565,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetContext) {
InterpreterAssemblerForTest m(this, bytecode);
EXPECT_THAT(
m.GetContext(),
m.IsLoad(
MachineType::AnyTagged(),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsIntPtrConstant(-Register::current_context().index()
<< kPointerSizeLog2)));
m.IsLoad(MachineType::AnyTagged(), IsLoadParentFramePointer(),
IsIntPtrConstant(Register::current_context().ToOperand()
<< kPointerSizeLog2)));
}
}
......@@ -584,11 +576,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, RegisterLocation) {
InterpreterAssemblerForTest m(this, bytecode);
Node* reg_index_node = m.IntPtrConstant(44);
Node* reg_location_node = m.RegisterLocation(reg_index_node);
EXPECT_THAT(
reg_location_node,
IsIntPtrAdd(
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2))));
EXPECT_THAT(reg_location_node,
IsIntPtrAdd(IsLoadParentFramePointer(),
IsWordShl(reg_index_node,
IsIntPtrConstant(kPointerSizeLog2))));
}
}
......@@ -597,12 +588,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadRegister) {
InterpreterAssemblerForTest m(this, bytecode);
Node* reg_index_node = m.IntPtrConstant(44);
Node* load_reg_node = m.LoadRegister(reg_index_node);
EXPECT_THAT(
load_reg_node,
m.IsLoad(
MachineType::AnyTagged(),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2))));
EXPECT_THAT(load_reg_node,
m.IsLoad(MachineType::AnyTagged(), IsLoadParentFramePointer(),
IsWordShl(reg_index_node,
IsIntPtrConstant(kPointerSizeLog2))));
}
}
......@@ -614,12 +603,11 @@ TARGET_TEST_F(InterpreterAssemblerTest, StoreRegister) {
Node* store_reg_node = m.StoreRegister(store_value, reg_index_node);
EXPECT_THAT(
store_reg_node,
m.IsStore(
StoreRepresentation(MachineRepresentation::kTagged,
kNoWriteBarrier),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2)),
store_value));
m.IsStore(StoreRepresentation(MachineRepresentation::kTagged,
kNoWriteBarrier),
IsLoadParentFramePointer(),
IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2)),
store_value));
}
}
......@@ -733,14 +721,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime2) {
InterpreterAssemblerForTest m(this, bytecode);
Node* arg1 = m.Int32Constant(2);
Node* arg2 = m.Int32Constant(3);
Node* context =
m.Parameter(InterpreterDispatchDescriptor::kContextParameter);
Node* context = m.Int32Constant(4);
Node* call_runtime = m.CallRuntime(Runtime::kAdd, context, arg1, arg2);
EXPECT_THAT(
call_runtime,
IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
IsParameter(InterpreterDispatchDescriptor::kContextParameter), _,
_));
EXPECT_THAT(call_runtime,
IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), context, _, _));
}
}
......@@ -754,8 +738,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
Node* function_id = m.Int32Constant(0);
Node* first_arg = m.Int32Constant(1);
Node* arg_count = m.Int32Constant(2);
Node* context =
m.Parameter(InterpreterDispatchDescriptor::kContextParameter);
Node* context = m.Int32Constant(4);
Matcher<Node*> function_table = IsExternalConstant(
ExternalReference::runtime_function_table_address(isolate()));
......@@ -768,12 +751,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
Node* call_runtime = m.CallRuntimeN(function_id, context, first_arg,
arg_count, result_size);
EXPECT_THAT(
call_runtime,
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
function_entry,
IsParameter(InterpreterDispatchDescriptor::kContextParameter),
_, _));
EXPECT_THAT(call_runtime,
IsCall(_, IsHeapConstant(builtin.code()), arg_count,
first_arg, function_entry, context, _, _));
}
}
}
......@@ -789,16 +769,11 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
Node* function = m.Int32Constant(0);
Node* first_arg = m.Int32Constant(1);
Node* arg_count = m.Int32Constant(2);
Node* context =
m.Parameter(InterpreterDispatchDescriptor::kContextParameter);
Node* context = m.Int32Constant(3);
Node* call_js =
m.CallJS(function, context, first_arg, arg_count, tail_call_mode);
EXPECT_THAT(
call_js,
IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
function,
IsParameter(InterpreterDispatchDescriptor::kContextParameter),
_, _));
EXPECT_THAT(call_js, IsCall(_, IsHeapConstant(builtin.code()), arg_count,
first_arg, function, context, _, _));
}
}
}
......@@ -808,11 +783,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadTypeFeedbackVector) {
InterpreterAssemblerForTest m(this, bytecode);
Node* feedback_vector = m.LoadTypeFeedbackVector();
Matcher<Node*> load_function_matcher = m.IsLoad(
MachineType::AnyTagged(),
IsParameter(InterpreterDispatchDescriptor::kRegisterFileParameter),
IsIntPtrConstant(
InterpreterFrameConstants::kFunctionFromRegisterPointer));
Matcher<Node*> load_function_matcher =
m.IsLoad(MachineType::AnyTagged(), IsLoadParentFramePointer(),
IsIntPtrConstant(Register::function_closure().ToOperand()
<< kPointerSizeLog2));
Matcher<Node*> load_shared_function_info_matcher =
m.IsLoad(MachineType::AnyTagged(), load_function_matcher,
IsIntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
......
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