5#ifndef INCLUDE_V8_FUNCTION_CALLBACK_H_
6#define INCLUDE_V8_FUNCTION_CALLBACK_H_
15class BasicTracedReference;
22class FunctionCallbackArguments;
23class PropertyCallbackArguments;
27class ConsoleCallArguments;
35 static_assert(std::is_base_of<T, S>::value,
"type check");
72 template <
class F,
class G,
class H>
261 static_assert(std::is_base_of<T, S>::value,
"type check");
263 *value_ = GetDefaultValue();
272 static_assert(std::is_base_of<T, S>::value,
"type check");
274 *value_ = GetDefaultValue();
283 static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
286 *value_ = GetDefaultValue();
294 static_assert(std::is_base_of<T, Number>::value,
"type check");
295 Set(Number::New(GetIsolate(), i));
300 static_assert(std::is_base_of<T, Integer>::value,
"type check");
303 *value_ = I::IntToSmi(i);
306 Set(Integer::New(GetIsolate(), i));
311 static_assert(std::is_base_of<T, Integer>::value,
"type check");
313 bool fits_into_int32_t = (i & (1U << 31)) == 0;
318 Set(Integer::NewFromUnsigned(GetIsolate(), i));
323 static_assert(std::is_base_of<T, Boolean>::value,
"type check");
327 root_index = I::kTrueValueRootIndex;
329 root_index = I::kFalseValueRootIndex;
331 *value_ = *I::GetRoot(GetIsolate(), root_index);
336 static_assert(std::is_base_of<T, Primitive>::value,
"type check");
338 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
343 static_assert(std::is_base_of<T, Primitive>::value,
"type check");
345 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
350 static_assert(std::is_base_of<T, String>::value,
"type check");
352 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
358 return *
reinterpret_cast<Isolate**
>(&value_[-2]);
364 if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex))
372 static_assert(
sizeof(S) < 0,
"incompilable to prevent inadvertent misuse");
385 : implicit_args_(implicit_args), values_(values), length_(length) {}
403 reinterpret_cast<Object*
>(&implicit_args_[kHolderIndex]));
409 reinterpret_cast<Value*
>(&implicit_args_[kNewTargetIndex]));
419 return *
reinterpret_cast<Isolate**
>(&implicit_args_[kIsolateIndex]);
429 return !NewTarget()->IsUndefined();
439 return *
reinterpret_cast<Isolate**
>(&args_[kIsolateIndex]);
465 if (args_[kShouldThrowOnErrorIndex] !=
466 I::IntToSmi(I::kInferShouldThrowMode)) {
467 return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
470 reinterpret_cast<v8::internal::Isolate*
>(GetIsolate()));
static const int kDataIndex
static const int kReturnValueDefaultValueIndex
V8_INLINE ReturnValue< T > GetReturnValue() const
V8_INLINE bool IsConstructCall() const
V8_INLINE Local< Object > This() const
V8_INLINE Local< Object > Holder() const
V8_INLINE Isolate * GetIsolate() const
V8_INLINE Local< Value > Data() const
internal::Address * implicit_args_
V8_INLINE int Length() const
static const int kNewTargetIndex
internal::Address * values_
static const int kIsolateIndex
friend class debug::ConsoleCallArguments
V8_INLINE Local< Value > NewTarget() const
friend class internal::FunctionCallbackArguments
static const int kArgsLength
static const int kReturnValueIndex
V8_INLINE Local< Value > operator[](int i) const
static const int kHolderIndex
V8_INLINE bool IsEmpty() const
V8_INLINE bool IsEmpty() const
static const int kShouldThrowOnErrorIndex
static const int kDataIndex
static const int kReturnValueDefaultValueIndex
V8_INLINE ReturnValue< T > GetReturnValue() const
internal::Address * args_
friend class internal::PropertyCallbackArguments
V8_INLINE Local< Object > This() const
V8_INLINE Local< Object > Holder() const
V8_INLINE Isolate * GetIsolate() const
V8_INLINE Local< Value > Data() const
V8_INLINE bool ShouldThrowOnError() const
static const int kThisIndex
static const int kIsolateIndex
static const int kArgsLength
static const int kReturnValueIndex
static const int kHolderIndex
friend class MacroAssembler
V8_INLINE PropertyCallbackInfo(internal::Address *args)
V8_INLINE ReturnValue(const ReturnValue< S > &that)
V8_INLINE Isolate * GetIsolate() const
V8_INLINE void Set(const BasicTracedReference< S > &handle)
V8_INLINE void SetUndefined()
V8_INLINE void Set(const Global< S > &handle)
V8_INLINE void SetEmptyString()
V8_INLINE void Set(const Local< S > handle)
V8_INLINE void Set(S *whatever)
V8_INLINE Local< Value > Get() const
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
int32_t(Local< Array > src, int32_t *dst, uint32_t max_length)
V8_INLINE Local< Primitive > Undefined(Isolate *isolate)
#define V8_LIKELY(condition)
#define V8_UNLIKELY(condition)