[CSA] Adapt arguments to be accessed in the reversed order
Bug: v8:10201 Change-Id: I2271602b2da6fd06038ddfab16090d7faac592ca Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074218 Commit-Queue: Victor Gomes <victorgomes@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#66593}
This commit is contained in:
parent
c0c3b20782
commit
f0bfa9ea1a
@ -12526,10 +12526,18 @@ CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler,
|
|||||||
argc_(argc),
|
argc_(argc),
|
||||||
base_(),
|
base_(),
|
||||||
fp_(fp != nullptr ? fp : assembler_->LoadFramePointer()) {
|
fp_(fp != nullptr ? fp : assembler_->LoadFramePointer()) {
|
||||||
|
#ifdef V8_REVERSE_JSARGS
|
||||||
|
TNode<IntPtrT> offset = assembler_->IntPtrConstant(
|
||||||
|
(StandardFrameConstants::kFixedSlotCountAboveFp + 1) *
|
||||||
|
kSystemPointerSize);
|
||||||
|
#else
|
||||||
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
||||||
argc_, SYSTEM_POINTER_ELEMENTS,
|
argc_, SYSTEM_POINTER_ELEMENTS,
|
||||||
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) *
|
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) *
|
||||||
kSystemPointerSize);
|
kSystemPointerSize);
|
||||||
|
#endif
|
||||||
|
// base_ points to the first argument, not the receiver
|
||||||
|
// whether present or not.
|
||||||
base_ = assembler_->RawPtrAdd(fp_, offset);
|
base_ = assembler_->RawPtrAdd(fp_, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12546,10 +12554,14 @@ void CodeStubArguments::SetReceiver(TNode<Object> object) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TNode<RawPtrT> CodeStubArguments::AtIndexPtr(TNode<IntPtrT> index) const {
|
TNode<RawPtrT> CodeStubArguments::AtIndexPtr(TNode<IntPtrT> index) const {
|
||||||
|
#ifdef V8_REVERSE_JSARGS
|
||||||
|
TNode<IntPtrT> offset = index;
|
||||||
|
#else
|
||||||
TNode<IntPtrT> negated_index =
|
TNode<IntPtrT> negated_index =
|
||||||
assembler_->IntPtrOrSmiSub(assembler_->IntPtrConstant(0), index);
|
assembler_->IntPtrOrSmiSub(assembler_->IntPtrConstant(0), index);
|
||||||
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
||||||
negated_index, SYSTEM_POINTER_ELEMENTS, 0);
|
negated_index, SYSTEM_POINTER_ELEMENTS, 0);
|
||||||
|
#endif
|
||||||
return assembler_->RawPtrAdd(base_, offset);
|
return assembler_->RawPtrAdd(base_, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12613,18 +12625,20 @@ void CodeStubArguments::ForEach(
|
|||||||
if (last == nullptr) {
|
if (last == nullptr) {
|
||||||
last = argc_;
|
last = argc_;
|
||||||
}
|
}
|
||||||
TNode<RawPtrT> start = assembler_->RawPtrSub(
|
TNode<RawPtrT> start = AtIndexPtr(first);
|
||||||
base_,
|
TNode<RawPtrT> end = AtIndexPtr(last);
|
||||||
assembler_->ElementOffsetFromIndex(first, SYSTEM_POINTER_ELEMENTS));
|
#ifdef V8_REVERSE_JSARGS
|
||||||
TNode<RawPtrT> end = assembler_->RawPtrSub(
|
const int increment = kSystemPointerSize;
|
||||||
base_, assembler_->ElementOffsetFromIndex(last, SYSTEM_POINTER_ELEMENTS));
|
#else
|
||||||
|
const int increment = -kSystemPointerSize;
|
||||||
|
#endif
|
||||||
assembler_->BuildFastLoop<RawPtrT>(
|
assembler_->BuildFastLoop<RawPtrT>(
|
||||||
vars, start, end,
|
vars, start, end,
|
||||||
[&](TNode<RawPtrT> current) {
|
[&](TNode<RawPtrT> current) {
|
||||||
TNode<Object> arg = assembler_->Load<Object>(current);
|
TNode<Object> arg = assembler_->Load<Object>(current);
|
||||||
body(arg);
|
body(arg);
|
||||||
},
|
},
|
||||||
-kSystemPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost);
|
increment, CodeStubAssembler::IndexAdvanceMode::kPost);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeStubArguments::PopAndReturn(TNode<Object> value) {
|
void CodeStubArguments::PopAndReturn(TNode<Object> value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user