[maglev][arm64] Port simple Load<Type> IRs

Bug: v8:7700
Change-Id: I275a72562c5d2f85fce007db5e77bb804cca6bd2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4088684
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84777}
This commit is contained in:
Victor Gomes 2022-12-12 11:49:39 +01:00 committed by V8 LUCI CQ
parent 1bf670ef20
commit d871c03e4a
4 changed files with 90 additions and 15 deletions

View File

@ -968,6 +968,11 @@ inline Operand FieldOperand(Register object, int offset) {
return Operand(object, offset - kHeapObjectTag);
}
// For compatibility with platform-independent code.
inline MemOperand FieldMemOperand(Register object, int offset) {
return MemOperand(object, offset - kHeapObjectTag);
}
// Generate an Operand for loading a field from an object. Object pointer is a
// compressed pointer when pointer compression is enabled.
inline Operand FieldOperand(TaggedRegister object, int offset) {

View File

@ -140,15 +140,11 @@ UNIMPLEMENTED_NODE_WITH_CALL(CreateRegExpLiteral)
UNIMPLEMENTED_NODE(GeneratorRestoreRegister)
UNIMPLEMENTED_NODE(GetSecondReturnedValue)
UNIMPLEMENTED_NODE_WITH_CALL(GetTemplateObject)
UNIMPLEMENTED_NODE(LoadTaggedField)
UNIMPLEMENTED_NODE(LoadDoubleField)
UNIMPLEMENTED_NODE(LoadTaggedElement)
UNIMPLEMENTED_NODE(LoadSignedIntDataViewElement, type_)
UNIMPLEMENTED_NODE(LoadDoubleDataViewElement)
UNIMPLEMENTED_NODE(LoadSignedIntTypedArrayElement, elements_kind_)
UNIMPLEMENTED_NODE(LoadUnsignedIntTypedArrayElement, elements_kind_)
UNIMPLEMENTED_NODE(LoadDoubleTypedArrayElement, elements_kind_)
UNIMPLEMENTED_NODE(LoadDoubleElement)
UNIMPLEMENTED_NODE(CheckedSmiTagUint32)
UNIMPLEMENTED_NODE(CheckedInternalizedString, check_type_)
UNIMPLEMENTED_NODE_WITH_CALL(CheckedObjectToIndex)
@ -605,6 +601,79 @@ void ReduceInterruptBudget::GenerateCode(MaglevAssembler* masm,
__ bind(*done);
}
void LoadDoubleField::SetValueLocationConstraints() {
UseRegister(object_input());
DefineAsRegister(this);
}
void LoadDoubleField::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
UseScratchRegisterScope temps(masm);
Register tmp = temps.AcquireX();
Register object = ToRegister(object_input());
__ AssertNotSmi(object);
__ DecompressAnyTagged(tmp, FieldMemOperand(object, offset()));
__ AssertNotSmi(tmp);
__ Ldr(ToDoubleRegister(result()),
FieldMemOperand(tmp, HeapNumber::kValueOffset));
}
void LoadTaggedElement::SetValueLocationConstraints() {
UseRegister(object_input());
UseRegister(index_input());
DefineAsRegister(this);
}
void LoadTaggedElement::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Register object = ToRegister(object_input());
Register index = ToRegister(index_input());
UseScratchRegisterScope temps(masm);
Register scratch = temps.AcquireX();
Register elements = temps.AcquireX();
__ AssertNotSmi(object);
if (v8_flags.debug_code) {
__ CompareObjectType(object, scratch, scratch, JS_OBJECT_TYPE);
__ Assert(hs, AbortReason::kUnexpectedValue);
}
__ DecompressAnyTagged(elements,
FieldMemOperand(object, JSObject::kElementsOffset));
if (v8_flags.debug_code) {
__ CompareObjectType(elements, scratch, scratch, FIXED_ARRAY_TYPE);
__ Assert(eq, AbortReason::kUnexpectedValue);
}
__ Add(elements, elements, Operand(index, LSL, kTaggedSizeLog2));
__ DecompressAnyTagged(ToRegister(result()),
FieldMemOperand(elements, FixedArray::kHeaderSize));
}
void LoadDoubleElement::SetValueLocationConstraints() {
UseRegister(object_input());
UseRegister(index_input());
DefineAsRegister(this);
}
void LoadDoubleElement::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Register object = ToRegister(object_input());
Register index = ToRegister(index_input());
UseScratchRegisterScope temps(masm);
Register scratch = temps.AcquireX();
Register elements = temps.AcquireX();
__ AssertNotSmi(object);
if (v8_flags.debug_code) {
__ CompareObjectType(object, scratch, scratch, JS_OBJECT_TYPE);
__ Assert(hs, AbortReason::kUnexpectedValue);
}
__ DecompressAnyTagged(elements,
FieldMemOperand(object, JSObject::kElementsOffset));
if (v8_flags.debug_code) {
__ CompareObjectType(elements, scratch, scratch, FIXED_DOUBLE_ARRAY_TYPE);
__ Assert(eq, AbortReason::kUnexpectedValue);
}
__ Add(elements, elements, Operand(index, LSL, kDoubleSizeLog2));
__ Ldr(ToDoubleRegister(result()),
FieldMemOperand(elements, FixedArray::kHeaderSize));
}
// ---
// Control nodes
// ---

View File

@ -809,6 +809,18 @@ void GetIterator::GenerateCode(MaglevAssembler* masm,
masm->DefineExceptionHandlerAndLazyDeoptPoint(this);
}
void LoadTaggedField::SetValueLocationConstraints() {
UseRegister(object_input());
DefineAsRegister(this);
}
void LoadTaggedField::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Register object = ToRegister(object_input());
__ AssertNotSmi(object);
__ DecompressAnyTagged(ToRegister(result()),
FieldMemOperand(object, offset()));
}
int LoadGlobal::MaxCallStackArgs() const {
if (typeof_mode() == TypeofMode::kNotInside) {
using D = CallInterfaceDescriptorFor<Builtin::kLoadGlobalIC>::type;

View File

@ -1014,17 +1014,6 @@ void BuiltinStringPrototypeCharCodeAt::GenerateCode(
__ bind(*done);
}
void LoadTaggedField::SetValueLocationConstraints() {
UseRegister(object_input());
DefineAsRegister(this);
}
void LoadTaggedField::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Register object = ToRegister(object_input());
__ AssertNotSmi(object);
__ DecompressAnyTagged(ToRegister(result()), FieldOperand(object, offset()));
}
void LoadDoubleField::SetValueLocationConstraints() {
UseRegister(object_input());
DefineAsRegister(this);