v8 14.1.146 (node 25.0.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-function-callback.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_FUNCTION_CALLBACK_H_
6#define INCLUDE_V8_FUNCTION_CALLBACK_H_
7
8#include <cstdint>
9#include <limits>
10
11#include "v8-internal.h" // NOLINT(build/include_directory)
12#include "v8-local-handle.h" // NOLINT(build/include_directory)
13#include "v8-primitive.h" // NOLINT(build/include_directory)
14#include "v8config.h" // NOLINT(build/include_directory)
15
16namespace v8 {
17
18template <typename T>
20template <typename T>
21class Global;
22class Object;
23class Value;
24
25namespace internal {
26class FunctionCallbackArguments;
27class PropertyCallbackArguments;
28class Builtins;
29} // namespace internal
30
31namespace debug {
32class ConsoleCallArguments;
33} // namespace debug
34
35namespace api_internal {
37 v8::Isolate* isolate, v8::Local<v8::Data> raw_target);
38} // namespace api_internal
39
40template <typename T>
42 public:
43 template <class S>
44 V8_INLINE ReturnValue(const ReturnValue<S>& that) : value_(that.value_) {
45 static_assert(std::is_base_of_v<T, S>, "type check");
46 }
47 // Handle-based setters.
48 template <typename S>
49 V8_INLINE void Set(const Global<S>& handle);
50 template <typename S>
51 V8_INLINE void SetNonEmpty(const Global<S>& handle);
52 template <typename S>
53 V8_INLINE void Set(const BasicTracedReference<S>& handle);
54 template <typename S>
56 template <typename S>
57 V8_INLINE void Set(const Local<S> handle);
58 template <typename S>
59 V8_INLINE void SetNonEmpty(const Local<S> handle);
60 // Fast primitive number setters.
61 V8_INLINE void Set(bool value);
62 V8_INLINE void Set(double i);
63 V8_INLINE void Set(int16_t i);
64 V8_INLINE void Set(int32_t i);
65 V8_INLINE void Set(int64_t i);
66 V8_INLINE void Set(uint16_t i);
67 V8_INLINE void Set(uint32_t i);
68 V8_INLINE void Set(uint64_t i);
69 // Fast JS primitive setters.
70 V8_INLINE void SetNull();
72 V8_INLINE void SetFalse();
74 // Convenience getter for the Isolate.
76
77 // Pointer setter: Uncompilable to prevent inadvertent misuse.
78 template <typename S>
79 V8_INLINE void Set(S* whatever);
80
81 // Getter. Creates a new Local<> so it comes with a certain performance
82 // hit. If the ReturnValue was not yet set, this will return the undefined
83 // value.
84 V8_INLINE Local<Value> Get() const;
85
86 private:
87 template <class F>
88 friend class ReturnValue;
89 template <class F>
91 template <class F>
93 template <class F, class G, class H>
95 V8_INLINE void SetInternal(internal::Address value);
96 // Default value depends on <T>:
97 // - <void> -> true_value,
98 // - <v8::Boolean> -> true_value,
99 // - <v8::Integer> -> 0,
100 // - <v8::Value> -> undefined_value,
101 // - <v8::Array> -> undefined_value.
102 V8_INLINE void SetDefaultValue();
103 V8_INLINE explicit ReturnValue(internal::Address* slot);
104
105 // See FunctionCallbackInfo.
106 static constexpr int kIsolateValueIndex = -2;
107
108 internal::Address* value_;
109};
110
111/**
112 * The argument information given to function call callbacks. This
113 * class provides access to information about the context of the call,
114 * including the receiver, the number and values of arguments, and
115 * the holder of the function.
116 */
117template <typename T>
119 public:
120 /** The number of available arguments. */
121 V8_INLINE int Length() const;
122 /**
123 * Accessor for the available arguments. Returns `undefined` if the index
124 * is out of bounds.
125 */
126 V8_INLINE Local<Value> operator[](int i) const;
127 /** Returns the receiver. This corresponds to the "this" value. */
128 V8_INLINE Local<Object> This() const;
129 /** For construct calls, this returns the "new.target" value. */
131 /** Indicates whether this is a regular call or a construct call. */
132 V8_INLINE bool IsConstructCall() const;
133 /** The data argument specified when creating the callback. */
134 V8_INLINE Local<Value> Data() const;
135 /** The current Isolate. */
137 /** The ReturnValue for the call. */
139
140 private:
141 friend class internal::FunctionCallbackArguments;
143 friend class debug::ConsoleCallArguments;
145
146 // TODO(ishell, http://crbug.com/326505377): in case of non-constructor
147 // call, don't pass kNewTarget and kUnused. Add IsConstructCall flag to
148 // kIsolate field.
149 static constexpr int kUnusedIndex = 0;
150 static constexpr int kIsolateIndex = 1;
151 static constexpr int kContextIndex = 2;
152 static constexpr int kReturnValueIndex = 3;
153 static constexpr int kTargetIndex = 4;
154 static constexpr int kNewTargetIndex = 5;
155 static constexpr int kArgsLength = 6;
156
157 static constexpr int kArgsLengthWithReceiver = kArgsLength + 1;
158
159 // Codegen constants:
160 static constexpr int kSize = 3 * internal::kApiSystemPointerSize;
161 static constexpr int kImplicitArgsOffset = 0;
162 static constexpr int kValuesOffset =
163 kImplicitArgsOffset + internal::kApiSystemPointerSize;
164 static constexpr int kLengthOffset =
165 kValuesOffset + internal::kApiSystemPointerSize;
166
167 static constexpr int kThisValuesIndex = -1;
168 static_assert(ReturnValue<Value>::kIsolateValueIndex ==
170
171 V8_INLINE FunctionCallbackInfo(internal::Address* implicit_args,
172 internal::Address* values, int length);
173
174 // TODO(https://crbug.com/326505377): flatten the v8::FunctionCallbackInfo
175 // object to avoid indirect loads through values_ and implicit_args_ and
176 // reduce the number of instructions in the CallApiCallback builtin.
177 internal::Address* implicit_args_;
178 internal::Address* values_;
179 internal::Address length_;
180};
181
182/**
183 * The information passed to a property callback about the context
184 * of the property access.
185 */
186template <typename T>
188 public:
189 /**
190 * \return The isolate of the property access.
191 */
193
194 /**
195 * \return The data set in the configuration, i.e., in
196 * `NamedPropertyHandlerConfiguration` or
197 * `IndexedPropertyHandlerConfiguration.`
198 */
200
201 /**
202 * \return The receiver. In many cases, this is the object on which the
203 * property access was intercepted. When using
204 * `Reflect.get`, `Function.prototype.call`, or similar functions, it is the
205 * object passed in as receiver or thisArg.
206 *
207 * \code
208 * void GetterCallback(Local<Name> name,
209 * const v8::PropertyCallbackInfo<v8::Value>& info) {
210 * auto context = info.GetIsolate()->GetCurrentContext();
211 *
212 * v8::Local<v8::Value> a_this =
213 * info.This()
214 * ->GetRealNamedProperty(context, v8_str("a"))
215 * .ToLocalChecked();
216 * v8::Local<v8::Value> a_holder =
217 * info.Holder()
218 * ->GetRealNamedProperty(context, v8_str("a"))
219 * .ToLocalChecked();
220 *
221 * CHECK(v8_str("r")->Equals(context, a_this).FromJust());
222 * CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
223 *
224 * info.GetReturnValue().Set(name);
225 * }
226 *
227 * v8::Local<v8::FunctionTemplate> templ =
228 * v8::FunctionTemplate::New(isolate);
229 * templ->InstanceTemplate()->SetHandler(
230 * v8::NamedPropertyHandlerConfiguration(GetterCallback));
231 * LocalContext env;
232 * env->Global()
233 * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
234 * .ToLocalChecked()
235 * ->NewInstance(env.local())
236 * .ToLocalChecked())
237 * .FromJust();
238 *
239 * CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
240 * \endcode
241 */
243
244 /**
245 * \return The object in the prototype chain of the receiver that has the
246 * interceptor. Suppose you have `x` and its prototype is `y`, and `y`
247 * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`.
248 * The Holder() could be a hidden object (the global object, rather
249 * than the global proxy).
250 *
251 * \note For security reasons, do not pass the object back into the runtime.
252 */
254 "V8 will stop providing access to hidden prototype (i.e. "
255 "JSGlobalObject). Use HolderV2() instead. \n"
256 "DO NOT try to workaround this by accessing JSGlobalObject via "
257 "v8::Object::GetPrototype() - it'll be deprecated soon too. \n"
258 "See http://crbug.com/333672197. ")
259 V8_INLINE Local<Object> Holder() const;
260
261 /**
262 * \return The object in the prototype chain of the receiver that has the
263 * interceptor. Suppose you have `x` and its prototype is `y`, and `y`
264 * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`.
265 * In case the property is installed on the global object the Holder()
266 * would return the global proxy.
267 */
269
270 /**
271 * \return The return value of the callback.
272 * Can be changed by calling Set().
273 * \code
274 * info.GetReturnValue().Set(...)
275 * \endcode
276 *
277 */
279
280 /**
281 * \return True if the intercepted function should throw if an error occurs.
282 * Usually, `true` corresponds to `'use strict'`.
283 *
284 * \note Always `false` when intercepting `Reflect.set()`
285 * independent of the language mode.
286 */
288
289 private:
290 template <typename U>
292 friend class MacroAssembler;
293 friend class internal::PropertyCallbackArguments;
296
297 static constexpr int kPropertyKeyIndex = 0;
298 static constexpr int kShouldThrowOnErrorIndex = 1;
299 static constexpr int kHolderIndex = 2;
300 static constexpr int kIsolateIndex = 3;
301 static constexpr int kHolderV2Index = 4;
302 static constexpr int kReturnValueIndex = 5;
303 static constexpr int kDataIndex = 6;
304 static constexpr int kThisIndex = 7;
305 static constexpr int kArgsLength = 8;
306
307 static constexpr int kSize = kArgsLength * internal::kApiSystemPointerSize;
308
309 PropertyCallbackInfo() = default;
310
311 mutable internal::Address args_[kArgsLength];
312};
313
314using FunctionCallback = void (*)(const FunctionCallbackInfo<Value>& info);
315
316// --- Implementation ---
317
318template <typename T>
319ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
320
321template <typename T>
322void ReturnValue<T>::SetInternal(internal::Address value) {
324 using I = internal::Internals;
325 // Ensure that the upper 32-bits are not modified. Compiler should be
326 // able to optimize this to a store of a lower 32-bits of the value.
327 // This is fine since the callback can return only JavaScript values which
328 // are either Smis or heap objects allocated in the main cage.
329 *value_ = I::DecompressTaggedField(*value_, I::CompressTagged(value));
330#else
331 *value_ = value;
332#endif // V8_STATIC_ROOTS_BOOL
333}
334
335template <typename T>
336template <typename S>
337void ReturnValue<T>::Set(const Global<S>& handle) {
338 static_assert(std::is_base_of_v<T, S>, "type check");
339 if (V8_UNLIKELY(handle.IsEmpty())) {
340 SetDefaultValue();
341 } else {
342 SetInternal(handle.ptr());
343 }
344}
345
346template <typename T>
347template <typename S>
348void ReturnValue<T>::SetNonEmpty(const Global<S>& handle) {
349 static_assert(std::is_base_of_v<T, S>, "type check");
350#ifdef V8_ENABLE_CHECKS
351 internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
352#endif // V8_ENABLE_CHECKS
353 SetInternal(handle.ptr());
354}
355
356template <typename T>
357template <typename S>
358void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
359 static_assert(std::is_base_of_v<T, S>, "type check");
360 if (V8_UNLIKELY(handle.IsEmpty())) {
361 SetDefaultValue();
362 } else {
363 SetInternal(handle.ptr());
364 }
365}
366
367template <typename T>
368template <typename S>
369void ReturnValue<T>::SetNonEmpty(const BasicTracedReference<S>& handle) {
370 static_assert(std::is_base_of_v<T, S>, "type check");
371#ifdef V8_ENABLE_CHECKS
372 internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
373#endif // V8_ENABLE_CHECKS
374 SetInternal(handle.ptr());
375}
376
377template <typename T>
378template <typename S>
379void ReturnValue<T>::Set(const Local<S> handle) {
380 // "V8_DEPRECATE_SOON" this method if |T| is |void|.
381#ifdef V8_IMMINENT_DEPRECATION_WARNINGS
382 static constexpr bool is_allowed_void = false;
383 static_assert(!std::is_void_v<T>,
384 "ReturnValue<void>::Set(const Local<S>) is deprecated. "
385 "Do nothing to indicate that the operation succeeded or use "
386 "SetFalse() to indicate that the operation failed (don't "
387 "forget to handle info.ShouldThrowOnError()). "
388 "See http://crbug.com/348660658 for details.");
389#else
390 static constexpr bool is_allowed_void = std::is_void_v<T>;
391#endif // V8_IMMINENT_DEPRECATION_WARNINGS
392 static_assert(is_allowed_void || std::is_base_of_v<T, S>, "type check");
393 if (V8_UNLIKELY(handle.IsEmpty())) {
394 SetDefaultValue();
395 } else if constexpr (is_allowed_void) {
396 // Simulate old behaviour for "v8::AccessorSetterCallback" for which
397 // it was possible to set the return value even for ReturnValue<void>.
398 Set(handle->BooleanValue(GetIsolate()));
399 } else {
400 SetInternal(handle.ptr());
401 }
402}
403
404template <typename T>
405template <typename S>
406void ReturnValue<T>::SetNonEmpty(const Local<S> handle) {
407 // "V8_DEPRECATE_SOON" this method if |T| is |void|.
408#ifdef V8_IMMINENT_DEPRECATION_WARNINGS
409 static constexpr bool is_allowed_void = false;
410 static_assert(!std::is_void_v<T>,
411 "ReturnValue<void>::SetNonEmpty(const Local<S>) is deprecated. "
412 "Do nothing to indicate that the operation succeeded or use "
413 "SetFalse() to indicate that the operation failed (don't "
414 "forget to handle info.ShouldThrowOnError()). "
415 "See http://crbug.com/348660658 for details.");
416#else
417 static constexpr bool is_allowed_void = std::is_void_v<T>;
418#endif // V8_IMMINENT_DEPRECATION_WARNINGS
419 static_assert(is_allowed_void || std::is_base_of_v<T, S>, "type check");
420#ifdef V8_ENABLE_CHECKS
421 internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
422#endif // V8_ENABLE_CHECKS
423 if constexpr (is_allowed_void) {
424 // Simulate old behaviour for "v8::AccessorSetterCallback" for which
425 // it was possible to set the return value even for ReturnValue<void>.
426 Set(handle->BooleanValue(GetIsolate()));
427 } else {
428 SetInternal(handle.ptr());
429 }
430}
431
432template <typename T>
433void ReturnValue<T>::Set(double i) {
434 static_assert(std::is_base_of_v<T, Number>, "type check");
435 SetNonEmpty(Number::New(GetIsolate(), i));
436}
437
438template <typename T>
439void ReturnValue<T>::Set(int16_t i) {
440 static_assert(std::is_base_of_v<T, Integer>, "type check");
441 using I = internal::Internals;
442 static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::min()));
443 static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::max()));
444 SetInternal(I::IntegralToSmi(i));
445}
446
447template <typename T>
448void ReturnValue<T>::Set(int32_t i) {
449 static_assert(std::is_base_of_v<T, Integer>, "type check");
450 if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
451 SetInternal(*result);
452 return;
453 }
454 SetNonEmpty(Integer::New(GetIsolate(), i));
455}
456
457template <typename T>
458void ReturnValue<T>::Set(int64_t i) {
459 static_assert(std::is_base_of_v<T, Integer>, "type check");
460 if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
461 SetInternal(*result);
462 return;
463 }
464 SetNonEmpty(Number::New(GetIsolate(), static_cast<double>(i)));
465}
466
467template <typename T>
468void ReturnValue<T>::Set(uint16_t i) {
469 static_assert(std::is_base_of_v<T, Integer>, "type check");
470 using I = internal::Internals;
471 static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::min()));
472 static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::max()));
473 SetInternal(I::IntegralToSmi(i));
474}
475
476template <typename T>
477void ReturnValue<T>::Set(uint32_t i) {
478 static_assert(std::is_base_of_v<T, Integer>, "type check");
479 if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
480 SetInternal(*result);
481 return;
482 }
484}
485
486template <typename T>
487void ReturnValue<T>::Set(uint64_t i) {
488 static_assert(std::is_base_of_v<T, Integer>, "type check");
489 if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
490 SetInternal(*result);
491 return;
492 }
493 SetNonEmpty(Number::New(GetIsolate(), static_cast<double>(i)));
494}
495
496template <typename T>
497void ReturnValue<T>::Set(bool value) {
498 static_assert(std::is_void_v<T> || std::is_base_of_v<T, Boolean>,
499 "type check");
500 using I = internal::Internals;
502#ifdef V8_ENABLE_CHECKS
503 internal::PerformCastCheck(
504 internal::ValueHelper::SlotAsValue<Value, true>(value_));
505#endif // V8_ENABLE_CHECKS
506 SetInternal(value ? I::StaticReadOnlyRoot::kTrueValue
507 : I::StaticReadOnlyRoot::kFalseValue);
508#else
509 int root_index;
510 if (value) {
511 root_index = I::kTrueValueRootIndex;
512 } else {
513 root_index = I::kFalseValueRootIndex;
514 }
515 *value_ = I::GetRoot(GetIsolate(), root_index);
516#endif // V8_STATIC_ROOTS_BOOL
517}
518
519template <typename T>
520void ReturnValue<T>::SetDefaultValue() {
521 using I = internal::Internals;
522 if constexpr (std::is_same_v<void, T> || std::is_same_v<v8::Boolean, T>) {
523 Set(true);
524 } else if constexpr (std::is_same_v<v8::Integer, T>) {
525 SetInternal(I::IntegralToSmi(0));
526 } else {
527 static_assert(std::is_same_v<v8::Value, T> || std::is_same_v<v8::Array, T>);
529 SetInternal(I::StaticReadOnlyRoot::kUndefinedValue);
530#else
532#endif // V8_STATIC_ROOTS_BOOL
533 }
534}
535
536template <typename T>
538 static_assert(std::is_base_of_v<T, Primitive>, "type check");
539 using I = internal::Internals;
541#ifdef V8_ENABLE_CHECKS
542 internal::PerformCastCheck(
543 internal::ValueHelper::SlotAsValue<Value, true>(value_));
544#endif // V8_ENABLE_CHECKS
545 SetInternal(I::StaticReadOnlyRoot::kNullValue);
546#else
548#endif // V8_STATIC_ROOTS_BOOL
549}
550
551template <typename T>
553 static_assert(std::is_base_of_v<T, Primitive>, "type check");
554 using I = internal::Internals;
556#ifdef V8_ENABLE_CHECKS
557 internal::PerformCastCheck(
558 internal::ValueHelper::SlotAsValue<Value, true>(value_));
559#endif // V8_ENABLE_CHECKS
560 SetInternal(I::StaticReadOnlyRoot::kUndefinedValue);
561#else
563#endif // V8_STATIC_ROOTS_BOOL
564}
565
566template <typename T>
568 static_assert(std::is_void_v<T> || std::is_base_of_v<T, Boolean>,
569 "type check");
570 using I = internal::Internals;
572#ifdef V8_ENABLE_CHECKS
573 internal::PerformCastCheck(
574 internal::ValueHelper::SlotAsValue<Value, true>(value_));
575#endif // V8_ENABLE_CHECKS
576 SetInternal(I::StaticReadOnlyRoot::kFalseValue);
577#else
579#endif // V8_STATIC_ROOTS_BOOL
580}
581
582template <typename T>
584 static_assert(std::is_base_of_v<T, String>, "type check");
585 using I = internal::Internals;
587#ifdef V8_ENABLE_CHECKS
588 internal::PerformCastCheck(
589 internal::ValueHelper::SlotAsValue<Value, true>(value_));
590#endif // V8_ENABLE_CHECKS
591 SetInternal(I::StaticReadOnlyRoot::kEmptyString);
592#else
594#endif // V8_STATIC_ROOTS_BOOL
595}
596
597template <typename T>
599 return *reinterpret_cast<Isolate**>(&value_[kIsolateValueIndex]);
600}
601
602template <typename T>
604 return Local<Value>::New(GetIsolate(),
605 internal::ValueHelper::SlotAsValue<Value>(value_));
606}
607
608template <typename T>
609template <typename S>
610void ReturnValue<T>::Set(S* whatever) {
611 static_assert(sizeof(S) < 0, "incompilable to prevent inadvertent misuse");
612}
613
614template <typename T>
615FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Address* implicit_args,
616 internal::Address* values,
617 int length)
618 : implicit_args_(implicit_args), values_(values), length_(length) {}
619
620template <typename T>
622 // values_ points to the first argument (not the receiver).
623 if (i < 0 || Length() <= i) return Undefined(GetIsolate());
624 return Local<Value>::FromSlot(values_ + i);
625}
626
627template <typename T>
629 // values_ points to the first argument (not the receiver).
630 return Local<Object>::FromSlot(values_ + kThisValuesIndex);
631}
632
633template <typename T>
635 return Local<Value>::FromSlot(&implicit_args_[kNewTargetIndex]);
636}
637
638template <typename T>
640 auto target = Local<v8::Data>::FromSlot(&implicit_args_[kTargetIndex]);
642}
643
644template <typename T>
646 return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
647}
648
649template <typename T>
651 return ReturnValue<T>(&implicit_args_[kReturnValueIndex]);
652}
653
654template <typename T>
656 return !NewTarget()->IsUndefined();
657}
658
659template <typename T>
661 return static_cast<int>(length_);
662}
663
664template <typename T>
666 return *reinterpret_cast<Isolate**>(&args_[kIsolateIndex]);
667}
668
669template <typename T>
671 return Local<Value>::FromSlot(&args_[kDataIndex]);
672}
673
674template <typename T>
676 return Local<Object>::FromSlot(&args_[kThisIndex]);
677}
678
679template <typename T>
680Local<Object> PropertyCallbackInfo<T>::Holder() const {
681 return Local<Object>::FromSlot(&args_[kHolderIndex]);
682}
683
684namespace api_internal {
685// Returns JSGlobalProxy if holder is JSGlobalObject or unmodified holder
686// otherwise.
687V8_EXPORT internal::Address ConvertToJSGlobalProxyIfNecessary(
688 internal::Address holder);
689} // namespace api_internal
690
691template <typename T>
693 using I = internal::Internals;
694 if (!I::HasHeapObjectTag(args_[kHolderV2Index])) {
695 args_[kHolderV2Index] =
696 api_internal::ConvertToJSGlobalProxyIfNecessary(args_[kHolderIndex]);
697 }
698 return Local<Object>::FromSlot(&args_[kHolderV2Index]);
699}
700
701template <typename T>
703 return ReturnValue<T>(&args_[kReturnValueIndex]);
704}
705
706template <typename T>
708 using I = internal::Internals;
709 if (args_[kShouldThrowOnErrorIndex] !=
710 I::IntegralToSmi(I::kInferShouldThrowMode)) {
711 return args_[kShouldThrowOnErrorIndex] != I::IntegralToSmi(I::kDontThrow);
712 }
714 reinterpret_cast<v8::internal::Isolate*>(GetIsolate()));
715}
716
717} // namespace v8
718
719#endif // INCLUDE_V8_FUNCTION_CALLBACK_H_
V8_INLINE ReturnValue< T > GetReturnValue() const
V8_INLINE bool IsConstructCall() const
V8_INLINE Local< Object > This() const
V8_INLINE Isolate * GetIsolate() const
V8_INLINE Local< Value > Data() const
V8_INLINE int Length() const
V8_INLINE Local< Value > NewTarget() const
V8_INLINE Local< Value > operator[](int i) const
friend void internal::PrintFunctionCallbackInfo(void *)
static Local< Integer > New(Isolate *isolate, int32_t value)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
friend class Local
friend class internal::CustomArguments
friend class Global
static Local< Number > New(Isolate *isolate, double value)
V8_INLINE ReturnValue< T > GetReturnValue() const
V8_INLINE Local< Object > This() const
V8_INLINE Isolate * GetIsolate() const
V8_INLINE Local< Value > Data() const
V8_INLINE bool ShouldThrowOnError() const
friend void internal::PrintPropertyCallbackInfo(void *)
V8_INLINE Local< Object > HolderV2() const
friend class PersistentValueMapBase
V8_INLINE ReturnValue(const ReturnValue< S > &that)
V8_INLINE Isolate * GetIsolate() const
V8_INLINE void SetFalse()
V8_INLINE void SetNonEmpty(const Local< S > handle)
V8_INLINE void Set(int16_t i)
V8_INLINE void Set(const BasicTracedReference< S > &handle)
friend class FunctionCallbackInfo
V8_INLINE void SetNull()
V8_INLINE void SetUndefined()
V8_INLINE void Set(uint16_t i)
V8_INLINE void SetNonEmpty(const Global< S > &handle)
V8_INLINE void Set(const Global< S > &handle)
V8_INLINE void Set(int32_t i)
V8_INLINE void SetEmptyString()
V8_INLINE void SetNonEmpty(const BasicTracedReference< S > &handle)
V8_INLINE void Set(bool value)
V8_INLINE void Set(const Local< S > handle)
V8_INLINE void Set(uint64_t i)
V8_INLINE void Set(uint32_t i)
V8_INLINE void Set(S *whatever)
V8_INLINE void Set(int64_t i)
V8_INLINE void Set(double i)
V8_INLINE Local< Value > Get() const
static const int kTrueValueRootIndex
static const int kInferShouldThrowMode
static const int kFalseValueRootIndex
static const int kNullValueRootIndex
static const int kDontThrow
static const int kEmptyStringRootIndex
static const int kUndefinedValueRootIndex
static V8_INLINE constexpr bool HasHeapObjectTag(Address value)
static V8_INLINE Address GetRoot(v8::Isolate *isolate, int index)
V8_EXPORT v8::Local< v8::Value > GetFunctionTemplateData(v8::Isolate *isolate, v8::Local< v8::Data > raw_target)
const int kApiSystemPointerSize
Definition v8-internal.h:65
V8_DEPRECATE_SOON("Use GetCurrentIsolate() instead, which is guaranteed to return the same " "isolate since https://crrev.com/c/6458560.") V8_EXPORT internal V8_EXPORT bool ShouldThrowOnError(internal::Isolate *isolate)
uintptr_t Address
Definition v8-internal.h:52
#define V8_STATIC_ROOTS_BOOL
Definition v8config.h:1061
#define V8_EXPORT
Definition v8config.h:860
#define V8_INLINE
Definition v8config.h:513
#define V8_DEPRECATED(message)
Definition v8config.h:619
#define V8_UNLIKELY(condition)
Definition v8config.h:673