[runtime] Adapt FunctionCallInfo when arguments are reversed in the stack

Bug: v8:10201
Change-Id: I5cae5d5c30f42427995c2380d906ade0f117fcd9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2083011
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66570}
This commit is contained in:
Victor Gomes 2020-03-02 09:53:31 +01:00 committed by Commit Bot
parent 5aaccdcf8c
commit 1ed4698331

View File

@ -11096,14 +11096,24 @@ FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Address* implicit_args,
template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
// values_ points to the first argument (not the receiver).
if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
#ifdef V8_REVERSE_JSARGS
return Local<Value>(reinterpret_cast<Value*>(values_ + i));
#else
return Local<Value>(reinterpret_cast<Value*>(values_ - i));
#endif
}
template<typename T>
Local<Object> FunctionCallbackInfo<T>::This() const {
// values_ points to the first argument (not the receiver).
#ifdef V8_REVERSE_JSARGS
return Local<Object>(reinterpret_cast<Object*>(values_ - 1));
#else
return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
#endif
}