5#ifndef V8_API_API_ARGUMENTS_INL_H_
6#define V8_API_API_ARGUMENTS_INL_H_
47#define DCHECK_NAME_COMPATIBLE(interceptor, name) \
48 DCHECK(interceptor->is_named()); \
49 DCHECK(!name->IsPrivate()); \
50 DCHECK_IMPLIES(IsSymbol(*name), interceptor->can_intercept_symbols());
52#define PREPARE_CALLBACK_INFO_ACCESSOR(ISOLATE, F, API_RETURN_TYPE, \
53 ACCESSOR_INFO, RECEIVER, ACCESSOR_KIND, \
55 if (ISOLATE->should_check_side_effects() && \
56 !ISOLATE->debug()->PerformSideEffectCheckForAccessor( \
57 ACCESSOR_INFO, RECEIVER, ACCESSOR_KIND)) { \
60 const PropertyCallbackInfo<API_RETURN_TYPE>& callback_info = \
61 GetPropertyCallbackInfo<API_RETURN_TYPE>(); \
62 ExternalCallbackScope call_scope(ISOLATE, FUNCTION_ADDR(F), \
63 EXCEPTION_CONTEXT, &callback_info);
65#define PREPARE_CALLBACK_INFO_INTERCEPTOR(ISOLATE, F, API_RETURN_TYPE, \
66 INTERCEPTOR_INFO, EXCEPTION_CONTEXT) \
67 if (ISOLATE->should_check_side_effects() && \
68 !ISOLATE->debug()->PerformSideEffectCheckForInterceptor( \
69 INTERCEPTOR_INFO)) { \
72 const PropertyCallbackInfo<API_RETURN_TYPE>& callback_info = \
73 GetPropertyCallbackInfo<API_RETURN_TYPE>(); \
74 ExternalCallbackScope call_scope(ISOLATE, FUNCTION_ADDR(F), \
75 EXCEPTION_CONTEXT, &callback_info);
80 RCS_SCOPE(isolate, RuntimeCallCounterId::kFunctionCallback);
83 if (isolate->should_check_side_effects() &&
84 !isolate->debug()->PerformSideEffectCheckForCallback(
85 handle(function, isolate))) {
109 v8::Intercepted intercepted,
const char* callback_kind_for_error_message,
110 bool ignore_return_value) {
117 "Check failed: %s interceptor callback has thrown an "
118 "exception but hasn't returned v8::Intercepted::kYes.",
119 callback_kind_for_error_message);
126 DCHECK(!isolate->has_exception());
140 "Check failed: %s interceptor callback hasn't thrown an "
141 "exception on failure as requested.",
142 callback_kind_for_error_message);
153 DCHECK(interceptor->is_named());
163 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedQueryCallback);
167 interceptor->named_query(isolate));
170 v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
179 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedGetterCallback);
183 interceptor->named_getter(isolate));
186 v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
195 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDescriptorCallback);
200 interceptor->named_descriptor(isolate));
203 v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
213 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedSetterCallback);
217 interceptor->named_setter(isolate));
222 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info);
231 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDefinerCallback);
236 interceptor->named_definer(isolate));
241 f(v8::Utils::ToLocal(name), desc, callback_info);
249 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedDeleterCallback);
254 interceptor->named_deleter(isolate));
258 v8::Intercepted intercepted = f(v8::Utils::ToLocal(name), callback_info);
268 DCHECK(!interceptor->is_named());
276 DCHECK(!interceptor->is_named());
278 RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedQueryCallback);
284 interceptor->indexed_query(isolate));
294 DCHECK(!interceptor->is_named());
296 RCS_SCOPE(isolate, RuntimeCallCounterId::kNamedGetterCallback);
302 interceptor->indexed_getter(isolate));
312 DCHECK(!interceptor->is_named());
314 RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDescriptorCallback);
320 interceptor->indexed_descriptor(isolate));
331 DCHECK(!interceptor->is_named());
333 RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedSetterCallback);
339 interceptor->indexed_setter(isolate));
344 f(index, v8::Utils::ToLocal(value), callback_info);
351 DCHECK(!interceptor->is_named());
353 RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDefinerCallback);
359 interceptor->indexed_definer(isolate));
369 DCHECK(!interceptor->is_named());
371 RCS_SCOPE(isolate, RuntimeCallCounterId::kIndexedDeleterCallback);
377 interceptor->indexed_deleter(isolate));
398 if (interceptor->is_named()) {
400 interceptor->named_enumerator(isolate));
403 interceptor->indexed_enumerator(isolate));
419 RCS_SCOPE(isolate, RuntimeCallCounterId::kAccessorGetterCallback);
431 f(v8::Utils::ToLocal(name), callback_info);
439 RCS_SCOPE(isolate, RuntimeCallCounterId::kAccessorSetterCallback);
456 accessor_info->setter(isolate));
460 f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), callback_info);
474 return IsTrue(*
result, isolate);
477#undef PREPARE_CALLBACK_INFO_ACCESSOR
478#undef PREPARE_CALLBACK_INFO_INTERCEPTOR
#define PREPARE_CALLBACK_INFO_INTERCEPTOR(ISOLATE, F, API_RETURN_TYPE, INTERCEPTOR_INFO, EXCEPTION_CONTEXT)
#define PREPARE_CALLBACK_INFO_ACCESSOR(ISOLATE, F, API_RETURN_TYPE, ACCESSOR_INFO, RECEIVER, ACCESSOR_KIND, EXCEPTION_CONTEXT)
#define DCHECK_NAME_COMPATIBLE(interceptor, name)
static constexpr int kThisIndex
static constexpr int kHolderIndex
CustomArgumentsBase(Isolate *isolate)
Handle< V > GetReturnValue(Isolate *isolate) const
Address values_[FunctionCallbackInfo< Value >::kArgsLength]
~CustomArguments() override
static constexpr int kReturnValueIndex
Isolate * isolate() const
FullObjectSlot slot_at(int index) const
void store(Tagged< Object > value) const
DirectHandle< Object > CallOrConstruct(Tagged< FunctionTemplateInfo > function, bool is_construct)
DirectHandle< JSAny > CallNamedGetter(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name)
DirectHandle< JSObjectOrUndefined > CallIndexedEnumerator(DirectHandle< InterceptorInfo > interceptor)
Handle< JSAny > CallIndexedDescriptor(DirectHandle< InterceptorInfo > interceptor, uint32_t index)
DirectHandle< JSAny > CallAccessorGetter(DirectHandle< AccessorInfo > info, DirectHandle< Name > name)
Tagged< JSObject > holder() const
v8::Intercepted CallNamedDeleter(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name)
Maybe< InterceptorResult > GetBooleanReturnValue(v8::Intercepted intercepted, const char *callback_kind_for_error_message, bool ignore_return_value=false)
Tagged< Object > receiver() const
DirectHandle< JSObjectOrUndefined > CallNamedEnumerator(DirectHandle< InterceptorInfo > interceptor)
DirectHandle< Object > CallNamedQuery(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name)
static constexpr int kPropertyKeyIndex
v8::Intercepted CallNamedSetter(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name, DirectHandle< Object > value)
v8::Intercepted CallNamedDefiner(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name, const v8::PropertyDescriptor &desc)
DirectHandle< JSAny > CallIndexedGetter(DirectHandle< InterceptorInfo > interceptor, uint32_t index)
DirectHandle< JSObjectOrUndefined > CallPropertyEnumerator(DirectHandle< InterceptorInfo > interceptor)
v8::Intercepted CallIndexedDefiner(DirectHandle< InterceptorInfo > interceptor, uint32_t index, const v8::PropertyDescriptor &desc)
bool ShouldThrowOnError()
DirectHandle< Object > CallIndexedQuery(DirectHandle< InterceptorInfo > interceptor, uint32_t index)
~PropertyCallbackArguments()
v8::Intercepted CallIndexedDeleter(DirectHandle< InterceptorInfo > interceptor, uint32_t index)
V8_WARN_UNUSED_RESULT bool CallAccessorSetter(DirectHandle< AccessorInfo > info, DirectHandle< Name > name, DirectHandle< Object > value)
v8::Intercepted CallIndexedSetter(DirectHandle< InterceptorInfo > interceptor, uint32_t index, DirectHandle< Object > value)
Handle< JSAny > CallNamedDescriptor(DirectHandle< InterceptorInfo > interceptor, DirectHandle< Name > name)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr Tagged< Smi > zero()
Handle< SharedFunctionInfo > info
ZoneVector< RpoNumber > & result
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
bool Is(IndirectHandle< U > value)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
constexpr uint32_t kHandleZapValue
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Boolean > &info) IndexedPropertyDeleterCallbackV2
void(*)(Local< Name > property, const PropertyCallbackInfo< Value > &info) AccessorNameGetterCallback
void(*)(const PropertyCallbackInfo< Array > &info) NamedPropertyEnumeratorCallback
Intercepted(*)( Local< Name > property, const PropertyCallbackInfo< Integer > &info) NamedPropertyQueryCallback
Intercepted(*)( uint32_t index, Local< Value > value, const PropertyCallbackInfo< void > &info) IndexedPropertySetterCallbackV2
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyDescriptorCallbackV2
Intercepted(*)( Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyGetterCallback
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Value > &info) IndexedPropertyGetterCallbackV2
Intercepted(*)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) IndexedPropertyDefinerCallbackV2
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
void(*)(const PropertyCallbackInfo< Array > &info) IndexedPropertyEnumeratorCallback
Intercepted(*)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< void > &info) NamedPropertyDefinerCallback
void(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) AccessorNameSetterCallback
Intercepted(*)( Local< Name > property, const PropertyCallbackInfo< Value > &info) NamedPropertyDescriptorCallback
Intercepted(*)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) NamedPropertySetterCallback
Intercepted(*)( Local< Name > property, const PropertyCallbackInfo< Boolean > &info) NamedPropertyDeleterCallback
Intercepted(*)(uint32_t index, const PropertyCallbackInfo< Integer > &info) IndexedPropertyQueryCallbackV2
Maybe< T > Just(const T &t)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)