Commit 1ed46983 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[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: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66570}
parent 5aaccdcf
......@@ -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
}
......
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