22 #include "v8-version.h"
35 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
36 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
37 build configuration to ensure that at most one of these is set
40 #ifdef BUILDING_V8_SHARED
41 # define V8_EXPORT __declspec(dllexport)
43 # define V8_EXPORT __declspec(dllimport)
46 #endif // BUILDING_V8_SHARED
51 #if V8_HAS_ATTRIBUTE_VISIBILITY && defined(V8_SHARED)
52 # ifdef BUILDING_V8_SHARED
53 # define V8_EXPORT __attribute__ ((visibility("default")))
68 class AccessorSignature;
78 class FunctionTemplate;
80 class ImplementationUtilities;
90 class ObjectOperationDescriptor;
95 class RawOperationDescriptor;
120 template <
class K,
class V,
class T>
122 template <
class K,
class V,
class T>
134 class CallHandlerHelper;
144 struct StreamedSource;
146 class PropertyCallbackArguments;
147 class FunctionCallbackArguments;
160 bool operator==(
const UniqueId& other)
const {
161 return data_ == other.data_;
164 bool operator!=(
const UniqueId& other)
const {
165 return data_ != other.data_;
168 bool operator<(
const UniqueId& other)
const {
169 return data_ < other.data_;
178 #define TYPE_CHECK(T, S) \
180 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
212 V8_INLINE
Local() : val_(0) {}
215 : val_(reinterpret_cast<T*>(*that)) {
227 V8_INLINE
bool IsEmpty()
const {
return val_ == 0; }
232 V8_INLINE
void Clear() { val_ = 0; }
234 V8_INLINE T* operator->()
const {
return val_; }
236 V8_INLINE T* operator*()
const {
return val_; }
246 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
247 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
248 if (a == 0)
return b == 0;
249 if (b == 0)
return false;
255 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
256 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
257 if (a == 0)
return b == 0;
258 if (b == 0)
return false;
278 template <
class S> V8_INLINE
static Local<T> Cast(Local<S> that) {
279 #ifdef V8_ENABLE_CHECKS
282 if (that.IsEmpty())
return Local<T>();
284 return Local<T>(T::Cast(*that));
288 template <
class S> V8_INLINE Local<S> As() {
289 return Local<S>::Cast(*
this);
297 V8_INLINE
static Local<T>
New(Isolate* isolate, Local<T> that);
298 V8_INLINE
static Local<T>
New(Isolate* isolate,
299 const PersistentBase<T>& that);
303 template<
class F>
friend class Eternal;
304 template<
class F>
friend class PersistentBase;
305 template<
class F,
class M>
friend class Persistent;
306 template<
class F>
friend class Local;
308 friend class MaybeLocal;
309 template<
class F>
friend class FunctionCallbackInfo;
310 template<
class F>
friend class PropertyCallbackInfo;
313 friend class Context;
314 friend class Private;
315 template<
class F>
friend class internal::CustomArguments;
316 friend Local<Primitive> Undefined(Isolate* isolate);
317 friend Local<Primitive> Null(Isolate* isolate);
318 friend Local<Boolean> True(Isolate* isolate);
319 friend Local<Boolean> False(Isolate* isolate);
320 friend class HandleScope;
321 friend class EscapableHandleScope;
322 template <
class F1,
class F2,
class F3>
323 friend class PersistentValueMapBase;
324 template<
class F1,
class F2>
friend class PersistentValueVector;
327 V8_INLINE Local(S* that)
329 V8_INLINE
static Local<T>
New(Isolate* isolate, T* that);
336 using Handle = Local<T>;
352 V8_INLINE MaybeLocal() : val_(nullptr) {}
354 V8_INLINE MaybeLocal(Local<S> that)
355 : val_(reinterpret_cast<T*>(*that)) {
359 V8_INLINE
bool IsEmpty()
const {
return val_ ==
nullptr; }
362 V8_WARN_UNUSED_RESULT V8_INLINE
bool ToLocal(Local<S>* out)
const {
363 out->val_ = IsEmpty() ?
nullptr : this->val_;
368 V8_INLINE Local<T> ToLocalChecked();
371 V8_INLINE Local<S> FromMaybe(Local<S> default_value)
const {
372 return IsEmpty() ? default_value : Local<S>(val_);
381 template <
class T>
class Eternal {
383 V8_INLINE Eternal() : index_(kInitialValue) { }
385 V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue) {
386 Set(isolate, handle);
389 V8_INLINE Local<T> Get(Isolate* isolate);
390 V8_INLINE
bool IsEmpty() {
return index_ == kInitialValue; }
391 template<
class S> V8_INLINE
void Set(Isolate* isolate, Local<S> handle);
394 static const int kInitialValue = -1;
399 static const int kInternalFieldsInWeakCallback = 2;
402 template <
typename T>
408 void* internal_fields[kInternalFieldsInWeakCallback],
410 : isolate_(isolate), parameter_(parameter), callback_(callback) {
411 for (
int i = 0; i < kInternalFieldsInWeakCallback; ++i) {
412 internal_fields_[i] = internal_fields[i];
416 V8_INLINE
Isolate* GetIsolate()
const {
return isolate_; }
417 V8_INLINE T* GetParameter()
const {
return parameter_; }
418 V8_INLINE
void* GetInternalField(
int index)
const;
420 V8_INLINE V8_DEPRECATE_SOON(
"use indexed version",
421 void* GetInternalField1())
const {
422 return internal_fields_[0];
424 V8_INLINE V8_DEPRECATE_SOON(
"use indexed version",
425 void* GetInternalField2())
const {
426 return internal_fields_[1];
429 bool IsFirstPass()
const {
return callback_ !=
nullptr; }
437 void SetSecondPassCallback(Callback callback)
const { *callback_ = callback; }
443 void* internal_fields_[kInternalFieldsInWeakCallback];
447 template <
class T,
class P>
453 : isolate_(isolate), parameter_(parameter), handle_(handle) {}
455 V8_INLINE
Isolate* GetIsolate()
const {
return isolate_; }
456 V8_INLINE P* GetParameter()
const {
return parameter_; }
457 V8_INLINE
Local<T> GetValue()
const {
return handle_; }
471 enum class WeakCallbackType { kParameter, kInternalFields };
487 template <
class T>
class PersistentBase {
493 V8_INLINE
void Reset();
499 V8_INLINE
void Reset(Isolate* isolate,
const Handle<S>& other);
506 V8_INLINE
void Reset(Isolate* isolate,
const PersistentBase<S>& other);
508 V8_INLINE
bool IsEmpty()
const {
return val_ == NULL; }
509 V8_INLINE
void Empty() { val_ = 0; }
512 V8_INLINE
bool operator==(
const PersistentBase<S>& that)
const {
513 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
514 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
515 if (a == NULL)
return b == NULL;
516 if (b == NULL)
return false;
520 template <
class S> V8_INLINE
bool operator==(
const Handle<S>& that)
const {
521 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
522 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
523 if (a == NULL)
return b == NULL;
524 if (b == NULL)
return false;
529 V8_INLINE
bool operator!=(
const PersistentBase<S>& that)
const {
530 return !operator==(that);
533 template <
class S> V8_INLINE
bool operator!=(
const Handle<S>& that)
const {
534 return !operator==(that);
544 template <
typename P>
546 "use WeakCallbackInfo version",
547 void SetWeak(P* parameter,
548 typename WeakCallbackData<T, P>::Callback callback));
550 template <
typename S,
typename P>
552 "use WeakCallbackInfo version",
553 void SetWeak(P* parameter,
554 typename WeakCallbackData<S, P>::Callback callback));
562 template <
typename P>
565 void SetPhantom(P* parameter,
566 typename WeakCallbackInfo<P>::Callback callback,
567 int internal_field_index1 = -1,
568 int internal_field_index2 = -1));
570 template <
typename P>
571 V8_INLINE
void SetWeak(P* parameter,
572 typename WeakCallbackInfo<P>::Callback callback,
573 WeakCallbackType type);
576 V8_INLINE P* ClearWeak();
579 V8_INLINE
void ClearWeak() { ClearWeak<void>(); }
599 V8_INLINE
bool IsIndependent()
const;
605 V8_INLINE
bool IsWeak()
const;
620 friend class Isolate;
622 template<
class F>
friend class Local;
623 template<
class F1,
class F2>
friend class Persistent;
626 template<
class F>
friend class PersistentBase;
627 template<
class F>
friend class ReturnValue;
628 template <
class F1,
class F2,
class F3>
629 friend class PersistentValueMapBase;
630 template<
class F1,
class F2>
friend class PersistentValueVector;
633 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
634 PersistentBase(PersistentBase& other) =
delete;
635 void operator=(PersistentBase&) =
delete;
636 V8_INLINE
static T* New(Isolate* isolate, T* that);
649 class NonCopyablePersistentTraits {
651 typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent;
652 static const bool kResetInDestructor =
false;
653 template<
class S,
class M>
654 V8_INLINE
static void Copy(
const Persistent<S, M>& source,
655 NonCopyablePersistent* dest) {
656 Uncompilable<Object>();
659 template<
class O> V8_INLINE
static void Uncompilable() {
660 TYPE_CHECK(O, Primitive);
672 static const bool kResetInDestructor =
true;
673 template<
class S,
class M>
675 CopyablePersistent* dest) {
709 template <
class S,
class M2>
723 template <
class S,
class M2>
731 template <
class S,
class M2>
732 V8_INLINE
Persistent& operator=(
const Persistent<S, M2>& that) {
742 if (M::kResetInDestructor) this->
Reset();
748 #ifdef V8_ENABLE_CHECKS
751 if (!that.IsEmpty()) T::Cast(*that);
757 template <
class S> V8_INLINE Persistent<S>& As() {
758 return Persistent<S>::Cast(*
this);
762 friend class Isolate;
764 template<
class F>
friend class Local;
765 template<
class F1,
class F2>
friend class Persistent;
766 template<
class F>
friend class ReturnValue;
768 template <
class S> V8_INLINE
Persistent(S* that) : PersistentBase<T>(that) { }
769 V8_INLINE T* operator*()
const {
return this->val_; }
770 template<
class S,
class M2>
771 V8_INLINE
void Copy(
const Persistent<S, M2>& that);
781 class Global :
public PersistentBase<T> {
811 other.val_ =
nullptr;
822 this->val_ = rhs.val_;
835 typedef void MoveOnlyTypeForCPP03;
845 using UniquePersistent = Global<T>;
871 static int NumberOfHandles(
Isolate* isolate);
873 V8_INLINE
Isolate* GetIsolate()
const {
874 return reinterpret_cast<Isolate*
>(isolate_);
880 void Initialize(
Isolate* isolate);
882 static internal::Object** CreateHandle(internal::Isolate* isolate,
883 internal::Object* value);
887 static internal::Object** CreateHandle(internal::HeapObject* heap_object,
888 internal::Object* value);
894 void*
operator new(
size_t size);
895 void operator delete(
void*, size_t);
897 internal::Isolate* isolate_;
898 internal::Object** prev_next_;
899 internal::Object** prev_limit_;
902 template<
class F>
friend class Local;
926 internal::Object** slot =
927 Escape(reinterpret_cast<internal::Object**>(*value));
928 return Local<T>(
reinterpret_cast<T*
>(slot));
932 internal::Object** Escape(internal::Object** escape_value);
938 void*
operator new(
size_t size);
939 void operator delete(
void*, size_t);
941 internal::Object** escape_slot_;
954 void*
operator new(
size_t size);
955 void operator delete(
void*, size_t);
957 internal::Isolate* isolate_;
959 internal::Object** prev_limit_;
988 : resource_name_(resource_name),
989 resource_line_offset_(resource_line_offset),
990 resource_column_offset_(resource_column_offset),
991 resource_is_embedder_debug_script_(resource_is_embedder_debug_script),
992 resource_is_shared_cross_origin_(resource_is_shared_cross_origin),
993 script_id_(script_id),
994 source_map_url_(source_map_url) {}
1043 int GetLineNumber(
int code_pos);
1045 static const int kNoScriptId = 0;
1058 static V8_DEPRECATE_SOON(
1059 "Use maybe version",
1075 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Value> Run());
1083 V8_DEPRECATED(
"Use GetUnboundScript()->GetId()",
1085 return GetUnboundScript()->GetId();
1112 buffer_policy(BufferNotOwned) {}
1119 BufferPolicy buffer_policy = BufferNotOwned);
1123 const uint8_t* data;
1126 BufferPolicy buffer_policy;
1144 V8_INLINE ~Source();
1149 V8_INLINE
const CachedData* GetCachedData()
const;
1154 Source(
const Source&);
1155 Source& operator=(
const Source&);
1198 virtual size_t GetMoreData(
const uint8_t** src) = 0;
1210 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 };
1220 internal::StreamedSource* impl()
const {
return impl_; }
1227 internal::StreamedSource* impl_;
1237 virtual void Run() = 0;
1240 enum CompileOptions {
1241 kNoCompileOptions = 0,
1242 kProduceParserCache,
1243 kConsumeParserCache,
1264 static V8_DEPRECATE_SOON(
"Use maybe version",
1266 Isolate* isolate, Source* source,
1267 CompileOptions options = kNoCompileOptions));
1269 Isolate* isolate, Source* source,
1270 CompileOptions options = kNoCompileOptions);
1283 static V8_DEPRECATE_SOON(
1284 "Use maybe version",
1286 CompileOptions options = kNoCompileOptions));
1289 CompileOptions options = kNoCompileOptions);
1302 static ScriptStreamingTask* StartStreamingScript(
1303 Isolate* isolate, StreamedSource* source,
1304 CompileOptions options = kNoCompileOptions);
1313 static V8_DEPRECATE_SOON(
1314 "Use maybe version",
1340 static uint32_t CachedDataVersionTag();
1350 static V8_DEPRECATE_SOON(
1351 "Use maybe version",
1353 CompileOptions options = kNoCompileOptions));
1356 CompileOptions options = kNoCompileOptions);
1368 static V8_DEPRECATE_SOON(
"Use maybe version",
1370 Isolate* isolate, Source* source,
1373 size_t context_extension_count,
1382 Isolate* isolate, Source* source, CompileOptions options,
bool is_module);
1393 V8_DEPRECATE_SOON(
"Use maybe version",
Local<String> GetSourceLine())
const;
1419 V8_DEPRECATE_SOON(
"Use maybe version",
int GetLineNumber())
const;
1426 int GetStartPosition()
const;
1432 int GetEndPosition()
const;
1438 V8_DEPRECATE_SOON(
"Use maybe version",
int GetStartColumn())
const;
1445 V8_DEPRECATE_SOON(
"Use maybe version",
int GetEndColumn())
const;
1452 bool IsSharedCrossOrigin()
const;
1455 static void PrintCurrentStackTrace(
Isolate* isolate, FILE* out);
1457 static const int kNoLineNumberInfo = 0;
1458 static const int kNoColumnInfo = 0;
1459 static const int kNoScriptIdInfo = 0;
1476 kColumnOffset = 1 << 1 | kLineNumber,
1477 kScriptName = 1 << 2,
1478 kFunctionName = 1 << 3,
1480 kIsConstructor = 1 << 5,
1481 kScriptNameOrSourceURL = 1 << 6,
1483 kExposeFramesAcrossSecurityOrigins = 1 << 8,
1484 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
1485 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
1496 int GetFrameCount()
const;
1513 StackTraceOptions options = kOverview);
1528 int GetLineNumber()
const;
1537 int GetColumn()
const;
1545 int GetScriptId()
const;
1570 bool IsEval()
const;
1576 bool IsConstructor()
const;
1581 enum StateTag { JS, GC, COMPILER, OTHER, EXTERNAL, IDLE };
1596 size_t frames_count;
1613 static V8_DEPRECATE_SOON(
"Use maybe version",
1647 V8_INLINE
bool IsUndefined()
const;
1653 V8_INLINE
bool IsNull()
const;
1658 bool IsTrue()
const;
1663 bool IsFalse()
const;
1669 bool IsName()
const;
1675 V8_INLINE
bool IsString()
const;
1681 bool IsSymbol()
const;
1686 bool IsFunction()
const;
1691 bool IsArray()
const;
1696 bool IsObject()
const;
1701 bool IsBoolean()
const;
1706 bool IsNumber()
const;
1711 bool IsExternal()
const;
1716 bool IsInt32()
const;
1721 bool IsUint32()
const;
1726 bool IsDate()
const;
1731 bool IsArgumentsObject()
const;
1736 bool IsBooleanObject()
const;
1741 bool IsNumberObject()
const;
1746 bool IsStringObject()
const;
1752 bool IsSymbolObject()
const;
1757 bool IsNativeError()
const;
1762 bool IsRegExp()
const;
1768 bool IsGeneratorFunction()
const;
1774 bool IsGeneratorObject()
const;
1780 bool IsPromise()
const;
1798 bool IsMapIterator()
const;
1804 bool IsSetIterator()
const;
1810 bool IsWeakMap()
const;
1816 bool IsWeakSet()
const;
1822 bool IsArrayBuffer()
const;
1828 bool IsArrayBufferView()
const;
1834 bool IsTypedArray()
const;
1840 bool IsUint8Array()
const;
1846 bool IsUint8ClampedArray()
const;
1852 bool IsInt8Array()
const;
1858 bool IsUint16Array()
const;
1864 bool IsInt16Array()
const;
1870 bool IsUint32Array()
const;
1876 bool IsInt32Array()
const;
1882 bool IsFloat32Array()
const;
1888 bool IsFloat64Array()
const;
1894 bool IsDataView()
const;
1912 V8_DEPRECATE_SOON(
"Use maybe version",
1914 V8_DEPRECATE_SOON(
"Use maybe version",
1916 V8_DEPRECATE_SOON(
"Use maybe version",
1918 V8_DEPRECATE_SOON(
"Use maybe version",
1920 V8_DEPRECATE_SOON(
"Use maybe version",
1922 V8_DEPRECATE_SOON(
"Use maybe version",
1924 V8_DEPRECATE_SOON(
"Use maybe version",
1926 V8_DEPRECATE_SOON(
"Use maybe version",
1929 inline V8_DEPRECATE_SOON(
"Use maybe version",
1931 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<Number> ToNumber())
const;
1932 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<String> ToString())
const;
1933 inline V8_DEPRECATE_SOON(
"Use maybe version",
1935 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<Object> ToObject())
const;
1936 inline V8_DEPRECATE_SOON(
"Use maybe version",
1938 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<Uint32> ToUint32())
const;
1939 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<Int32> ToInt32())
const;
1945 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Uint32> ToArrayIndex())
const;
1957 V8_DEPRECATE_SOON(
"Use maybe version",
bool BooleanValue())
const;
1958 V8_DEPRECATE_SOON(
"Use maybe version",
double NumberValue())
const;
1959 V8_DEPRECATE_SOON(
"Use maybe version", int64_t IntegerValue())
const;
1960 V8_DEPRECATE_SOON(
"Use maybe version", uint32_t Uint32Value())
const;
1961 V8_DEPRECATE_SOON(
"Use maybe version", int32_t Int32Value())
const;
1964 V8_DEPRECATE_SOON(
"Use maybe version",
bool Equals(
Handle<Value> that))
const;
1970 template <
class T> V8_INLINE
static Value* Cast(T* value);
1973 V8_INLINE
bool QuickIsUndefined()
const;
1974 V8_INLINE
bool QuickIsNull()
const;
1975 V8_INLINE
bool QuickIsString()
const;
1976 bool FullIsUndefined()
const;
1977 bool FullIsNull()
const;
1978 bool FullIsString()
const;
2014 int GetIdentityHash();
2022 enum class NewStringType { kNormal, kInternalized };
2030 static const int kMaxLength = (1 << 28) - 16;
2033 UNKNOWN_ENCODING = 0x1,
2034 TWO_BYTE_ENCODING = 0x0,
2035 ONE_BYTE_ENCODING = 0x4
2046 int Utf8Length()
const;
2053 bool IsOneByte()
const;
2059 bool ContainsOnlyOneByte()
const;
2088 HINT_MANY_WRITES_EXPECTED = 1,
2089 NO_NULL_TERMINATION = 2,
2090 PRESERVE_ONE_BYTE_NULL = 4,
2094 REPLACE_INVALID_UTF8 = 8
2098 int Write(uint16_t* buffer,
2101 int options = NO_OPTIONS)
const;
2103 int WriteOneByte(uint8_t* buffer,
2106 int options = NO_OPTIONS)
const;
2108 int WriteUtf8(
char* buffer,
2110 int* nchars_ref = NULL,
2111 int options = NO_OPTIONS)
const;
2121 bool IsExternal()
const;
2126 bool IsExternalOneByte()
const;
2148 friend class v8::internal::Heap;
2169 virtual const uint16_t* data()
const = 0;
2174 virtual size_t length()
const = 0;
2199 virtual const char* data()
const = 0;
2201 virtual size_t length()
const = 0;
2211 V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
2212 Encoding* encoding_out)
const;
2218 V8_INLINE ExternalStringResource* GetExternalStringResource()
const;
2224 const ExternalOneByteStringResource* GetExternalOneByteStringResource()
const;
2226 V8_INLINE
static String* Cast(
v8::Value* obj);
2229 enum NewStringType {
2230 kNormalString =
static_cast<int>(v8::NewStringType::kNormal),
2231 kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
2235 static V8_DEPRECATE_SOON(
2236 "Use maybe version",
2237 Local<String> NewFromUtf8(Isolate* isolate,
const char* data,
2238 NewStringType type = kNormalString,
2243 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
2244 Isolate* isolate,
const char* data, v8::NewStringType type,
2248 static V8_DEPRECATE_SOON(
2249 "Use maybe version",
2250 Local<String> NewFromOneByte(Isolate* isolate,
const uint8_t* data,
2251 NewStringType type = kNormalString,
2256 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
2257 Isolate* isolate,
const uint8_t* data, v8::NewStringType type,
2261 static V8_DEPRECATE_SOON(
2262 "Use maybe version",
2263 Local<String> NewFromTwoByte(Isolate* isolate,
const uint16_t* data,
2264 NewStringType type = kNormalString,
2269 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
2270 Isolate* isolate,
const uint16_t* data, v8::NewStringType type,
2277 static Local<String> Concat(Handle<String> left, Handle<String> right);
2287 static V8_DEPRECATE_SOON(
2288 "Use maybe version",
2289 Local<String> NewExternal(Isolate* isolate,
2290 ExternalStringResource* resource));
2291 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalTwoByte(
2292 Isolate* isolate, ExternalStringResource* resource);
2303 bool MakeExternal(ExternalStringResource* resource);
2313 static V8_DEPRECATE_SOON(
2314 "Use maybe version",
2315 Local<String> NewExternal(Isolate* isolate,
2316 ExternalOneByteStringResource* resource));
2317 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
2318 Isolate* isolate, ExternalOneByteStringResource* resource);
2329 bool MakeExternal(ExternalOneByteStringResource* resource);
2334 bool CanMakeExternal();
2347 char* operator*() {
return str_; }
2348 const char* operator*()
const {
return str_; }
2349 int length()
const {
return length_; }
2369 uint16_t* operator*() {
return str_; }
2370 const uint16_t* operator*()
const {
return str_; }
2371 int length()
const {
return length_; }
2378 void operator=(
const Value&);
2383 Encoding encoding)
const;
2460 double Value()
const;
2476 int64_t
Value()
const;
2489 int32_t
Value()
const;
2503 uint32_t
Value()
const;
2512 enum PropertyAttribute {
2527 typedef void (*AccessorNameGetterCallback)(
2532 typedef void (*AccessorSetterCallback)(
2536 typedef void (*AccessorNameSetterCallback)(
2554 ALL_CAN_WRITE = 1 << 1,
2555 PROHIBITS_OVERWRITING = 1 << 2
2564 V8_DEPRECATE_SOON(
"Use maybe version",
2569 V8_DEPRECATE_SOON(
"Use maybe version",
2582 V8_DEPRECATE_SOON(
"Use maybe version",
2584 PropertyAttribute attribs = None));
2593 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Value> Get(uint32_t index));
2602 V8_DEPRECATE_SOON(
"Use maybe version",
2603 PropertyAttribute GetPropertyAttributes(
Handle<Value> key));
2610 V8_DEPRECATE_SOON(
"Use maybe version",
2615 V8_DEPRECATE_SOON(
"Use maybe version",
bool Has(
Handle<Value> key));
2619 V8_DEPRECATE_SOON(
"Use maybe version",
bool Delete(
Handle<Value> key));
2623 V8_DEPRECATE_SOON(
"Use maybe version",
bool Has(uint32_t index));
2626 V8_DEPRECATE_SOON(
"Use maybe version",
bool Delete(uint32_t index));
2630 V8_DEPRECATE_SOON(
"Use maybe version",
2633 AccessorSetterCallback setter = 0,
2636 PropertyAttribute attribute = None));
2637 V8_DEPRECATE_SOON(
"Use maybe version",
2639 AccessorNameGetterCallback getter,
2640 AccessorNameSetterCallback setter = 0,
2643 PropertyAttribute attribute = None));
2646 AccessorNameGetterCallback getter,
2647 AccessorNameSetterCallback setter = 0,
2650 PropertyAttribute attribute = None);
2655 PropertyAttribute attribute = None,
2676 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Array> GetPropertyNames());
2685 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Array> GetOwnPropertyNames());
2701 V8_DEPRECATE_SOON(
"Use maybe version",
2717 V8_DEPRECATE_SOON(
"Use maybe version",
Local<String> ObjectProtoToString());
2727 int InternalFieldCount();
2732 return object.val_->InternalFieldCount();
2746 V8_INLINE
void* GetAlignedPointerFromInternalField(
int index);
2751 return object.val_->GetAlignedPointerFromInternalField(index);
2759 void SetAlignedPointerInInternalField(
int index,
void* value);
2762 V8_DEPRECATE_SOON(
"Use maybe version",
2766 V8_DEPRECATE_SOON(
"Use maybe version",
2770 V8_DEPRECATE_SOON(
"Use maybe version",
2771 bool HasRealIndexedProperty(uint32_t index));
2772 V8_WARN_UNUSED_RESULT
Maybe<bool> HasRealIndexedProperty(
2774 V8_DEPRECATE_SOON(
"Use maybe version",
2776 V8_WARN_UNUSED_RESULT
Maybe<bool> HasRealNamedCallbackProperty(
2784 "Use maybe version",
2795 "Use maybe version",
2799 GetRealNamedPropertyAttributesInPrototypeChain(
Local<Context> context,
2807 V8_DEPRECATE_SOON(
"Use maybe version",
2817 V8_DEPRECATE_SOON(
"Use maybe version",
2824 bool HasNamedLookupInterceptor();
2827 bool HasIndexedLookupInterceptor();
2834 V8_DEPRECATE_SOON(
"No alternative",
void TurnOnAccessCheck());
2843 int GetIdentityHash();
2879 V8_DEPRECATE_SOON(
"Use maybe version",
2892 V8_DEPRECATE_SOON(
"Use maybe version",
2901 V8_DEPRECATE_SOON(
"Keep track of isolate correctly",
Isolate* GetIsolate());
2909 static void CheckCast(
Value* obj);
2911 void* SlowGetAlignedPointerFromInternalField(
int index);
2920 uint32_t Length()
const;
2926 V8_DEPRECATE_SOON(
"Use maybe version",
2940 static void CheckCast(
Value* obj);
2944 template<
typename T>
2948 : value_(that.value_) {
2952 template <
typename S> V8_INLINE
void Set(
const Persistent<S>& handle);
2953 template <
typename S> V8_INLINE
void Set(
const Handle<S> handle);
2955 V8_INLINE
void Set(
bool value);
2956 V8_INLINE
void Set(
double i);
2957 V8_INLINE
void Set(int32_t i);
2958 V8_INLINE
void Set(uint32_t i);
2960 V8_INLINE
void SetNull();
2961 V8_INLINE
void SetUndefined();
2962 V8_INLINE
void SetEmptyString();
2964 V8_INLINE Isolate* GetIsolate();
2967 template <
typename S>
2968 V8_INLINE
void Set(S* whatever);
2971 template<
class F>
friend class ReturnValue;
2972 template<
class F>
friend class FunctionCallbackInfo;
2973 template<
class F>
friend class PropertyCallbackInfo;
2974 template <
class F,
class G,
class H>
2975 friend class PersistentValueMapBase;
2976 V8_INLINE
void SetInternal(internal::Object* value) { *value_ = value; }
2977 V8_INLINE internal::Object* GetDefaultValue();
2978 V8_INLINE
explicit ReturnValue(internal::Object** slot);
2979 internal::Object** value_;
2989 template<
typename T>
2990 class FunctionCallbackInfo {
2992 V8_INLINE
int Length()
const;
2993 V8_INLINE Local<Value> operator[](
int i)
const;
2994 V8_INLINE Local<Function> Callee()
const;
2995 V8_INLINE Local<Object> This()
const;
2996 V8_INLINE Local<Object> Holder()
const;
2997 V8_INLINE
bool IsConstructCall()
const;
2998 V8_INLINE Local<Value> Data()
const;
2999 V8_INLINE Isolate* GetIsolate()
const;
3000 V8_INLINE ReturnValue<T> GetReturnValue()
const;
3002 static const int kArgsLength = 7;
3005 friend class internal::FunctionCallbackArguments;
3006 friend class internal::CustomArguments<FunctionCallbackInfo>;
3007 static const int kHolderIndex = 0;
3008 static const int kIsolateIndex = 1;
3009 static const int kReturnValueDefaultValueIndex = 2;
3010 static const int kReturnValueIndex = 3;
3011 static const int kDataIndex = 4;
3012 static const int kCalleeIndex = 5;
3013 static const int kContextSaveIndex = 6;
3015 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
3016 internal::Object** values,
3018 bool is_construct_call);
3019 internal::Object** implicit_args_;
3020 internal::Object** values_;
3022 int is_construct_call_;
3030 template<
typename T>
3031 class PropertyCallbackInfo {
3033 V8_INLINE Isolate* GetIsolate()
const;
3034 V8_INLINE Local<Value> Data()
const;
3035 V8_INLINE Local<Object> This()
const;
3036 V8_INLINE Local<Object> Holder()
const;
3037 V8_INLINE ReturnValue<T> GetReturnValue()
const;
3039 static const int kArgsLength = 6;
3042 friend class MacroAssembler;
3043 friend class internal::PropertyCallbackArguments;
3044 friend class internal::CustomArguments<PropertyCallbackInfo>;
3045 static const int kHolderIndex = 0;
3046 static const int kIsolateIndex = 1;
3047 static const int kReturnValueDefaultValueIndex = 2;
3048 static const int kReturnValueIndex = 3;
3049 static const int kDataIndex = 4;
3050 static const int kThisIndex = 5;
3052 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {}
3053 internal::Object** args_;
3057 typedef void (*FunctionCallback)(
const FunctionCallbackInfo<Value>& info);
3070 FunctionCallback callback,
3074 V8_DEPRECATE_SOON(
"Use maybe version",
3080 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Object> NewInstance())
const;
3083 return NewInstance(context, 0,
nullptr);
3086 V8_DEPRECATE_SOON(
"Use maybe version",
3114 int GetScriptLineNumber()
const;
3119 int GetScriptColumnNumber()
const;
3124 bool IsBuiltin()
const;
3129 int ScriptId()
const;
3139 static const int kLineOffsetNotFound;
3143 static void CheckCast(
Value* obj);
3158 static V8_DEPRECATE_SOON(
"Use maybe version",
3172 V8_DEPRECATE_SOON(
"Use maybe version",
void Resolve(
Handle<Value> value));
3176 V8_DEPRECATE_SOON(
"Use maybe version",
void Reject(
Handle<Value> value));
3184 static void CheckCast(
Value* obj);
3193 V8_DEPRECATE_SOON(
"Use maybe version",
3198 V8_DEPRECATE_SOON(
"Use maybe version",
3203 V8_DEPRECATE_SOON(
"Use maybe version",
3218 static void CheckCast(
Value* obj);
3222 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
3224 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
3228 enum class ArrayBufferCreationMode { kInternalized, kExternalized };
3252 virtual void* Allocate(
size_t length) = 0;
3258 virtual void* AllocateUninitialized(
size_t length) = 0;
3263 virtual void Free(
void* data,
size_t length) = 0;
3278 Contents() : data_(NULL), byte_length_(0) {}
3280 void*
Data()
const {
return data_; }
3281 size_t ByteLength()
const {
return byte_length_; }
3285 size_t byte_length_;
3294 size_t ByteLength()
const;
3311 Isolate* isolate,
void* data,
size_t byte_length,
3312 ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
3318 bool IsExternal()
const;
3323 bool IsNeuterable()
const;
3358 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
3362 static void CheckCast(
Value* obj);
3366 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
3368 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
3387 size_t ByteOffset();
3391 size_t ByteLength();
3402 size_t CopyContents(
void* dest,
size_t byte_length);
3408 bool HasBuffer()
const;
3412 static const int kInternalFieldCount =
3413 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
3417 static void CheckCast(
Value* obj);
3438 static void CheckCast(
Value* obj);
3449 size_t byte_offset,
size_t length);
3454 static void CheckCast(
Value* obj);
3465 size_t byte_offset,
size_t length);
3470 static void CheckCast(
Value* obj);
3480 size_t byte_offset,
size_t length);
3485 static void CheckCast(
Value* obj);
3496 size_t byte_offset,
size_t length);
3501 static void CheckCast(
Value* obj);
3512 size_t byte_offset,
size_t length);
3517 static void CheckCast(
Value* obj);
3528 size_t byte_offset,
size_t length);
3533 static void CheckCast(
Value* obj);
3544 size_t byte_offset,
size_t length);
3549 static void CheckCast(
Value* obj);
3560 size_t byte_offset,
size_t length);
3565 static void CheckCast(
Value* obj);
3576 size_t byte_offset,
size_t length);
3581 static void CheckCast(
Value* obj);
3592 size_t byte_offset,
size_t length);
3597 static void CheckCast(
Value* obj);
3606 static V8_DEPRECATE_SOON(
"Use maybe version.",
3615 double ValueOf()
const;
3631 static void DateTimeConfigurationChangeNotification(
Isolate* isolate);
3645 double ValueOf()
const;
3661 bool ValueOf()
const;
3730 static V8_DEPRECATE_SOON(
"Use maybe version",
3746 Flags GetFlags()
const;
3763 void*
Value()
const;
3779 PropertyAttribute attributes = None);
3782 void SetAccessorProperty(
3786 PropertyAttribute attribute = None,
3818 AccessorSetterCallback setter = 0,
3821 PropertyAttribute attribute = None,
3826 AccessorNameGetterCallback getter,
3827 AccessorNameSetterCallback setter = 0,
3830 PropertyAttribute attribute = None,
4113 FunctionCallback callback = 0,
4119 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Function> GetFunction());
4128 void SetCallHandler(FunctionCallback callback,
4132 void SetLength(
int length);
4158 void SetAcceptAnyReceiver(
bool value);
4172 void SetHiddenPrototype(
bool value);
4178 void ReadOnlyPrototype();
4184 void RemovePrototype();
4199 enum class PropertyHandlerFlags {
4205 kNonMasking = 1 << 1,
4208 kOnlyInterceptStrings = 1 << 2,
4221 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
4226 enumerator(enumerator),
4236 PropertyHandlerFlags flags;
4249 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
4254 enumerator(enumerator),
4264 PropertyHandlerFlags flags;
4283 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Object> NewInstance());
4317 AccessorSetterCallback setter = 0,
4320 PropertyAttribute attribute = None,
4324 AccessorNameGetterCallback getter,
4325 AccessorNameSetterCallback setter = 0,
4328 PropertyAttribute attribute = None,
4353 void SetNamedPropertyHandler(
4380 void SetIndexedPropertyHandler(
4388 deleter, enumerator, data));
4396 void SetCallAsFunctionHandler(FunctionCallback callback,
4407 void MarkAsUndetectable();
4423 bool turned_on_by_default =
true);
4429 int InternalFieldCount();
4435 void SetInternalFieldCount(
int value);
4495 : data_(data), length_(length) {}
4496 const char*
data()
const {
return data_; }
4512 const char* source = 0,
4514 const char** deps = 0,
4515 int source_length = -1);
4522 const char* name()
const {
return name_; }
4523 size_t source_length()
const {
return source_length_; }
4526 int dependency_count() {
return dep_count_; }
4527 const char** dependencies() {
return deps_; }
4528 void set_auto_enable(
bool value) { auto_enable_ = value; }
4529 bool auto_enable() {
return auto_enable_; }
4533 size_t source_length_;
4545 void V8_EXPORT RegisterExtension(
Extension* extension);
4578 void ConfigureDefaults(uint64_t physical_memory,
4579 uint64_t virtual_memory_limit);
4582 V8_DEPRECATED(
"Use two-args version instead",
4583 void ConfigureDefaults(uint64_t physical_memory,
4584 uint64_t virtual_memory_limit,
4585 uint32_t number_of_processors));
4587 int max_semi_space_size()
const {
return max_semi_space_size_; }
4588 void set_max_semi_space_size(
int value) { max_semi_space_size_ = value; }
4589 int max_old_space_size()
const {
return max_old_space_size_; }
4590 void set_max_old_space_size(
int value) { max_old_space_size_ = value; }
4591 int max_executable_size()
const {
return max_executable_size_; }
4592 void set_max_executable_size(
int value) { max_executable_size_ = value; }
4593 uint32_t* stack_limit()
const {
return stack_limit_; }
4595 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
4596 V8_DEPRECATED(
"Unused, will be removed",
int max_available_threads()
const) {
4597 return max_available_threads_;
4600 V8_DEPRECATED(
"Unused, will be removed",
4601 void set_max_available_threads(
int value)) {
4602 max_available_threads_ = value;
4604 size_t code_range_size()
const {
return code_range_size_; }
4605 void set_code_range_size(
size_t value) {
4606 code_range_size_ = value;
4610 int max_semi_space_size_;
4611 int max_old_space_size_;
4612 int max_executable_size_;
4613 uint32_t* stack_limit_;
4614 int max_available_threads_;
4615 size_t code_range_size_;
4622 typedef void (*FatalErrorCallback)(
const char* location,
const char* message);
4629 typedef void (*LogEventCallback)(
const char* name,
int event);
4660 typedef int* (*CounterLookupCallback)(
const char* name);
4662 typedef void* (*CreateHistogramCallback)(
const char* name,
4667 typedef void (*AddHistogramSampleCallback)(
void* histogram,
int sample);
4671 kObjectSpaceNewSpace = 1 << 0,
4672 kObjectSpaceOldSpace = 1 << 1,
4673 kObjectSpaceCodeSpace = 1 << 2,
4674 kObjectSpaceMapSpace = 1 << 3,
4675 kObjectSpaceLoSpace = 1 << 4,
4676 kObjectSpaceAll = kObjectSpaceNewSpace | kObjectSpaceOldSpace |
4677 kObjectSpaceCodeSpace | kObjectSpaceMapSpace |
4681 enum AllocationAction {
4682 kAllocationActionAllocate = 1 << 0,
4683 kAllocationActionFree = 1 << 1,
4684 kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree
4687 typedef void (*MemoryAllocationCallback)(ObjectSpace space,
4688 AllocationAction action,
4692 typedef void (*CallCompletedCallback)();
4695 enum PromiseRejectEvent {
4696 kPromiseRejectWithNoHandler = 0,
4697 kPromiseHandlerAddedAfterReject = 1
4704 : promise_(promise),
4707 stack_trace_(stack_trace) {}
4710 V8_INLINE PromiseRejectEvent GetEvent()
const {
return event_; }
4718 PromiseRejectEvent event_;
4726 typedef void (*MicrotaskCallback)(
void* data);
4729 typedef void (*FailedAccessCheckCallback)(
Local<Object> target,
4751 kGCTypeScavenge = 1 << 0,
4752 kGCTypeMarkSweepCompact = 1 << 1,
4753 kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact
4756 enum GCCallbackFlags {
4757 kNoGCCallbackFlags = 0,
4758 kGCCallbackFlagCompacted = 1 << 0,
4759 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1,
4760 kGCCallbackFlagForced = 1 << 2
4763 typedef void (*GCPrologueCallback)(
GCType type, GCCallbackFlags flags);
4764 typedef void (*GCEpilogueCallback)(
GCType type, GCCallbackFlags flags);
4766 typedef void (*InterruptCallback)(Isolate* isolate,
void* data);
4778 size_t total_heap_size() {
return total_heap_size_; }
4779 size_t total_heap_size_executable() {
return total_heap_size_executable_; }
4780 size_t total_physical_size() {
return total_physical_size_; }
4781 size_t total_available_size() {
return total_available_size_; }
4782 size_t used_heap_size() {
return used_heap_size_; }
4783 size_t heap_size_limit() {
return heap_size_limit_; }
4786 size_t total_heap_size_;
4787 size_t total_heap_size_executable_;
4788 size_t total_physical_size_;
4789 size_t total_available_size_;
4790 size_t used_heap_size_;
4791 size_t heap_size_limit_;
4801 const char* space_name() {
return space_name_; }
4802 size_t space_size() {
return space_size_; }
4803 size_t space_used_size() {
return space_used_size_; }
4804 size_t space_available_size() {
return space_available_size_; }
4805 size_t physical_space_size() {
return physical_space_size_; }
4808 const char* space_name_;
4810 size_t space_used_size_;
4811 size_t space_available_size_;
4812 size_t physical_space_size_;
4833 uintptr_t return_addr_location);
4845 CODE_ADD_LINE_POS_INFO,
4846 CODE_START_LINE_INFO_RECORDING,
4847 CODE_END_LINE_INFO_RECORDING
4854 enum PositionType { POSITION, STATEMENT_POSITION };
4884 PositionType position_type;
4895 void* new_code_start;
4903 kJitCodeEventDefault = 0,
4905 kJitCodeEventEnumExisting = 1
4934 uint16_t class_id) {}
4954 code_event_handler(NULL),
4955 snapshot_blob(NULL),
4956 counter_lookup_callback(NULL),
4957 create_histogram_callback(NULL),
4958 add_histogram_sample_callback(NULL),
4959 array_buffer_allocator(NULL) {}
5000 AddHistogramSampleCallback add_histogram_sample_callback;
5020 ~
Scope() { isolate_->Exit(); }
5036 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE };
5061 void* internal_throws_;
5062 void* internal_assert_;
5080 internal::Isolate* isolate_;
5093 kFullGarbageCollection,
5094 kMinorGarbageCollection
5106 kMarkDequeOverflow = 3,
5107 kStoreBufferOverflow = 4,
5108 kSlotsBufferOverflow = 5,
5111 kUseCounterFeatureCount
5114 typedef void (*UseCounterCallback)(
Isolate* isolate,
5115 UseCounterFeature feature);
5127 static Isolate* New(
const CreateParams& params);
5129 static V8_DEPRECATE_SOON(
"Always pass CreateParams",
Isolate* New());
5170 V8_INLINE
void SetData(uint32_t slot,
void* data);
5176 V8_INLINE
void* GetData(uint32_t slot);
5182 V8_INLINE
static uint32_t GetNumberOfDataSlots();
5192 size_t NumberOfHeapSpaces();
5218 void GetStackSample(
const RegisterState& state,
void** frames,
5219 size_t frames_limit,
SampleInfo* sample_info);
5235 AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
5285 template<
typename T>
void SetObjectGroupId(
const Persistent<T>&
object,
5295 template<
typename T>
void SetReferenceFromGroup(
UniqueId id,
5304 template<
typename T,
typename S>
5307 typedef void (*GCPrologueCallback)(
Isolate* isolate,
5309 GCCallbackFlags flags);
5310 typedef void (*GCEpilogueCallback)(
Isolate* isolate,
5312 GCCallbackFlags flags);
5323 void AddGCPrologueCallback(
5324 GCPrologueCallback callback,
GCType gc_type_filter = kGCTypeAll);
5330 void RemoveGCPrologueCallback(GCPrologueCallback callback);
5341 void AddGCEpilogueCallback(
5342 GCEpilogueCallback callback,
GCType gc_type_filter = kGCTypeAll);
5348 void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
5358 void TerminateExecution();
5368 bool IsExecutionTerminating();
5384 void CancelTerminateExecution();
5394 void RequestInterrupt(InterruptCallback callback,
void* data);
5406 void RequestGarbageCollectionForTesting(GarbageCollectionType type);
5411 void SetEventLogger(LogEventCallback that);
5420 void AddCallCompletedCallback(CallCompletedCallback callback);
5425 void RemoveCallCompletedCallback(CallCompletedCallback callback);
5432 void SetPromiseRejectCallback(PromiseRejectCallback callback);
5438 void RunMicrotasks();
5448 void EnqueueMicrotask(MicrotaskCallback microtask,
void* data = NULL);
5454 void SetAutorunMicrotasks(
bool autorun);
5460 bool WillAutorunMicrotasks()
const;
5465 void SetUseCounterCallback(UseCounterCallback callback);
5471 void SetCounterFunction(CounterLookupCallback);
5479 void SetCreateHistogramFunction(CreateHistogramCallback);
5480 void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
5496 bool IdleNotificationDeadline(
double deadline_in_seconds);
5498 V8_DEPRECATE_SOON(
"use IdleNotificationDeadline()",
5499 bool IdleNotification(
int idle_time_in_ms));
5505 void LowMemoryNotification();
5516 int ContextDisposedNotification(
bool dependant_context =
true);
5552 void SetStackLimit(uintptr_t stack_limit);
5567 void GetCodeRange(
void** start,
size_t* length_in_bytes);
5570 void SetFatalErrorHandler(FatalErrorCallback that);
5576 void SetAllowCodeGenerationFromStringsCallback(
5594 bool AddMessageListener(MessageCallback that,
5600 void RemoveMessageListeners(MessageCallback that);
5603 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
5609 void SetCaptureStackTraceForUncaughtExceptions(
5610 bool capture,
int frame_limit = 10,
5617 void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
5618 ObjectSpace space, AllocationAction action);
5623 void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
5648 template <
class K,
class V,
class Traits>
5655 void*
operator new(
size_t size);
5656 void operator delete(
void*, size_t);
5658 void SetObjectGroupId(internal::Object**
object,
UniqueId id);
5659 void SetReferenceFromGroup(
UniqueId id, internal::Object**
object);
5660 void SetReference(internal::Object** parent, internal::Object** child);
5661 void CollectAllGarbage(
const char* gc_reason);
5692 uintptr_t return_addr_location);
5701 V8_INLINE
static V8_DEPRECATE_SOON(
5702 "Use isolate version",
5703 void SetFatalErrorHandler(FatalErrorCallback that));
5709 V8_INLINE
static V8_DEPRECATE_SOON(
5710 "Use isolate version",
void SetAllowCodeGenerationFromStringsCallback(
5719 static V8_DEPRECATE_SOON(
5720 "Use isolate version",
5727 V8_INLINE
static V8_DEPRECATE_SOON(
"no alternative",
bool IsDead());
5744 static void SetNativesDataBlob(
StartupData* startup_blob);
5745 static void SetSnapshotDataBlob(
StartupData* startup_blob);
5752 static StartupData CreateSnapshotDataBlob(
const char* custom_source = NULL);
5763 V8_INLINE
static V8_DEPRECATE_SOON(
5764 "Use isolate version",
5765 bool AddMessageListener(MessageCallback that,
5771 V8_INLINE
static V8_DEPRECATE_SOON(
5772 "Use isolate version",
void RemoveMessageListeners(MessageCallback that));
5778 V8_INLINE
static V8_DEPRECATE_SOON(
5779 "Use isolate version",
5780 void SetCaptureStackTraceForUncaughtExceptions(
5781 bool capture,
int frame_limit = 10,
5787 static void SetFlagsFromString(
const char* str,
int length);
5792 static void SetFlagsFromCommandLine(
int* argc,
5797 static const char* GetVersion();
5800 V8_INLINE
static V8_DEPRECATE_SOON(
5801 "Use isolate version",
5802 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback));
5814 static V8_DEPRECATE_SOON(
5815 "Use isolate version",
5816 void AddGCPrologueCallback(GCPrologueCallback callback,
5817 GCType gc_type_filter = kGCTypeAll));
5823 V8_INLINE
static V8_DEPRECATE_SOON(
5824 "Use isolate version",
5825 void RemoveGCPrologueCallback(GCPrologueCallback callback));
5837 static V8_DEPRECATE_SOON(
5838 "Use isolate version",
5839 void AddGCEpilogueCallback(GCEpilogueCallback callback,
5840 GCType gc_type_filter = kGCTypeAll));
5846 V8_INLINE
static V8_DEPRECATE_SOON(
5847 "Use isolate version",
5848 void RemoveGCEpilogueCallback(GCEpilogueCallback callback));
5854 V8_INLINE
static V8_DEPRECATE_SOON(
5855 "Use isolate version",
5856 void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
5858 AllocationAction action));
5863 V8_INLINE
static V8_DEPRECATE_SOON(
5864 "Use isolate version",
5865 void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback));
5871 static bool Initialize();
5883 static void SetReturnAddressLocationResolver(
5895 V8_INLINE
static V8_DEPRECATE_SOON(
"Use isolate version",
5896 void TerminateExecution(
Isolate* isolate));
5908 V8_INLINE
static V8_DEPRECATE_SOON(
5909 "Use isolate version",
5910 bool IsExecutionTerminating(
Isolate* isolate = NULL));
5928 V8_INLINE
static V8_DEPRECATE_SOON(
5929 "Use isolate version",
void CancelTerminateExecution(
Isolate* isolate));
5940 static bool Dispose();
5947 V8_INLINE
static V8_DEPRECATE_SOON(
5948 "Use isoalte version",
5955 V8_INLINE
static V8_DEPRECATE_SOON(
5956 "Use isolate version",
5963 V8_INLINE
static V8_DEPRECATE_SOON(
5964 "Use isolate version",
5965 void VisitHandlesWithClassIds(
Isolate* isolate,
5975 V8_INLINE
static V8_DEPRECATE_SOON(
5976 "Use isolate version",
5977 void VisitHandlesForPartialDependence(
Isolate* isolate,
5987 static bool InitializeICU(
const char* icu_data_file = NULL);
5993 static void InitializePlatform(
Platform* platform);
5999 static void ShutdownPlatform();
6004 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
6005 internal::Object** handle);
6006 static internal::Object** CopyPersistent(internal::Object** handle);
6007 static void DisposeGlobal(internal::Object** global_handle);
6009 static void MakeWeak(internal::Object** global_handle,
void* data,
6010 WeakCallback weak_callback);
6011 static void MakeWeak(internal::Object** global_handle,
void* data,
6013 WeakCallbackType type);
6014 static void MakeWeak(internal::Object** global_handle,
void* data,
6016 int internal_field_index1,
6018 int internal_field_index2,
6020 static void* ClearWeak(internal::Object** global_handle);
6021 static void Eternalize(
Isolate* isolate,
6026 static void FromJustIsNothing();
6027 static void ToLocalEmpty();
6028 static void InternalFieldOutOfBounds(
int index);
6029 template <
class T>
friend class Local;
6036 template <
class T>
friend class Eternal;
6038 template <
class T,
class M>
friend class Persistent;
6056 V8_INLINE
bool IsNothing()
const {
return !has_value; }
6057 V8_INLINE
bool IsJust()
const {
return has_value; }
6060 V8_INLINE T FromJust()
const {
6061 if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
6065 V8_INLINE T FromMaybe(
const T& default_value)
const {
6066 return has_value ? value : default_value;
6069 V8_INLINE
bool operator==(
const Maybe& other)
const {
6070 return (IsJust() == other.IsJust()) &&
6071 (!IsJust() || FromJust() == other.FromJust());
6074 V8_INLINE
bool operator!=(
const Maybe& other)
const {
6075 return !operator==(other);
6079 Maybe() : has_value(false) {}
6080 explicit Maybe(
const T& t) : has_value(true), value(t) {}
6086 friend Maybe<U> Nothing();
6088 friend Maybe<U> Just(
const U& u);
6093 inline Maybe<T> Nothing() {
6099 inline Maybe<T> Just(
const T& t) {
6114 V8_DEPRECATE_SOON(
"Use isolate version",
TryCatch());
6131 bool HasCaught()
const;
6141 bool CanContinue()
const;
6155 bool HasTerminated()
const;
6211 void SetVerbose(
bool value);
6218 void SetCaptureMessage(
bool value);
6232 if (handler == NULL)
return NULL;
6233 return handler->js_stack_comparable_address_;
6237 void ResetInternal();
6242 void*
operator new(
size_t size);
6243 void operator delete(
void*, size_t);
6245 v8::internal::Isolate* isolate_;
6249 void* js_stack_comparable_address_;
6250 bool is_verbose_ : 1;
6251 bool can_continue_ : 1;
6252 bool capture_message_ : 1;
6254 bool has_terminated_ : 1;
6256 friend class v8::internal::Isolate;
6270 : name_count_(name_count), names_(names) { }
6272 const char** begin()
const {
return &names_[0]; }
6273 const char** end()
const {
return &names_[name_count_]; }
6276 const int name_count_;
6277 const char** names_;
6305 void DetachGlobal();
6338 void UseDefaultSecurityToken();
6387 V8_INLINE
void* GetAlignedPointerFromEmbedderData(
int index);
6394 void SetAlignedPointerInEmbedderData(
int index,
void* value);
6409 void AllowCodeGenerationFromStrings(
bool allow);
6415 bool IsCodeGenerationFromStringsAllowed();
6422 void SetErrorMessageForCodeGenerationFromStrings(
Handle<String> message);
6433 V8_INLINE ~Scope() { context_->Exit(); }
6446 void* SlowGetAlignedPointerFromEmbedderData(
int index);
6535 void Initialize(
Isolate* isolate);
6537 internal::Isolate* isolate_;
6554 static bool IsLocked(
Isolate* isolate);
6559 static bool IsActive();
6562 void Initialize(
Isolate* isolate);
6566 internal::Isolate* isolate_;
6570 void operator=(
const Locker&);
6577 namespace internal {
6579 const int kApiPointerSize =
sizeof(
void*);
6580 const int kApiIntSize =
sizeof(int);
6581 const int kApiInt64Size =
sizeof(int64_t);
6584 const int kHeapObjectTag = 1;
6585 const int kHeapObjectTagSize = 2;
6586 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
6589 const int kSmiTag = 0;
6590 const int kSmiTagSize = 1;
6591 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
6595 template<
int kSmiShiftSize>
6596 V8_INLINE internal::Object* IntToSmi(
int value) {
6597 int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
6598 uintptr_t tagged_value =
6599 (
static_cast<uintptr_t
>(value) << smi_shift_bits) | kSmiTag;
6600 return reinterpret_cast<internal::Object*
>(tagged_value);
6605 enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
6606 static int SmiShiftSize() {
return kSmiShiftSize; }
6607 static int SmiValueSize() {
return kSmiValueSize; }
6608 V8_INLINE
static int SmiToInt(
const internal::Object* value) {
6609 int shift_bits = kSmiTagSize + kSmiShiftSize;
6611 return static_cast<int>(
reinterpret_cast<intptr_t
>(value)) >> shift_bits;
6613 V8_INLINE
static internal::Object* IntToSmi(
int value) {
6614 return internal::IntToSmi<kSmiShiftSize>(value);
6616 V8_INLINE
static bool IsValidSmi(intptr_t value) {
6628 return static_cast<uintptr_t
>(value + 0x40000000U) < 0x80000000U;
6634 enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
6635 static int SmiShiftSize() {
return kSmiShiftSize; }
6636 static int SmiValueSize() {
return kSmiValueSize; }
6637 V8_INLINE
static int SmiToInt(
const internal::Object* value) {
6638 int shift_bits = kSmiTagSize + kSmiShiftSize;
6640 return static_cast<int>(
reinterpret_cast<intptr_t
>(value) >> shift_bits);
6642 V8_INLINE
static internal::Object* IntToSmi(
int value) {
6643 return internal::IntToSmi<kSmiShiftSize>(value);
6645 V8_INLINE
static bool IsValidSmi(intptr_t value) {
6647 return (value == static_cast<int32_t>(value));
6652 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
6653 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
6654 V8_INLINE
static bool SmiValuesAre31Bits() {
return kSmiValueSize == 31; }
6655 V8_INLINE
static bool SmiValuesAre32Bits() {
return kSmiValueSize == 32; }
6666 static const int kHeapObjectMapOffset = 0;
6667 static const int kMapInstanceTypeAndBitFieldOffset =
6668 1 * kApiPointerSize + kApiIntSize;
6669 static const int kStringResourceOffset = 3 * kApiPointerSize;
6671 static const int kOddballKindOffset = 3 * kApiPointerSize;
6672 static const int kForeignAddressOffset = kApiPointerSize;
6673 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
6674 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
6675 static const int kContextHeaderSize = 2 * kApiPointerSize;
6676 static const int kContextEmbedderDataIndex = 77;
6677 static const int kFullStringRepresentationMask = 0x07;
6678 static const int kStringEncodingMask = 0x4;
6679 static const int kExternalTwoByteRepresentationTag = 0x02;
6680 static const int kExternalOneByteRepresentationTag = 0x06;
6682 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize;
6683 static const int kAmountOfExternalAllocatedMemoryOffset =
6684 4 * kApiPointerSize;
6685 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset =
6686 kAmountOfExternalAllocatedMemoryOffset + kApiInt64Size;
6687 static const int kIsolateRootsOffset =
6688 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size +
6690 static const int kUndefinedValueRootIndex = 5;
6691 static const int kNullValueRootIndex = 7;
6692 static const int kTrueValueRootIndex = 8;
6693 static const int kFalseValueRootIndex = 9;
6694 static const int kEmptyStringRootIndex = 10;
6698 static const int kExternalAllocationLimit = 192 * 1024 * 1024;
6700 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
6701 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
6702 static const int kNodeStateMask = 0x7;
6703 static const int kNodeStateIsWeakValue = 2;
6704 static const int kNodeStateIsPendingValue = 3;
6705 static const int kNodeStateIsNearDeathValue = 4;
6706 static const int kNodeIsIndependentShift = 3;
6707 static const int kNodeIsPartiallyDependentShift = 4;
6709 static const int kJSObjectType = 0xbe;
6710 static const int kFirstNonstringType = 0x80;
6711 static const int kOddballType = 0x83;
6712 static const int kForeignType = 0x86;
6714 static const int kUndefinedOddballKind = 5;
6715 static const int kNullOddballKind = 3;
6717 static const uint32_t kNumIsolateDataSlots = 4;
6719 V8_EXPORT
static void CheckInitializedImpl(
v8::Isolate* isolate);
6720 V8_INLINE
static void CheckInitialized(
v8::Isolate* isolate) {
6721 #ifdef V8_ENABLE_CHECKS
6722 CheckInitializedImpl(isolate);
6726 V8_INLINE
static bool HasHeapObjectTag(
const internal::Object* value) {
6727 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
6731 V8_INLINE
static int SmiValue(
const internal::Object* value) {
6732 return PlatformSmiTagging::SmiToInt(value);
6735 V8_INLINE
static internal::Object* IntToSmi(
int value) {
6736 return PlatformSmiTagging::IntToSmi(value);
6739 V8_INLINE
static bool IsValidSmi(intptr_t value) {
6740 return PlatformSmiTagging::IsValidSmi(value);
6743 V8_INLINE
static int GetInstanceType(
const internal::Object* obj) {
6744 typedef internal::Object O;
6745 O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
6748 return ReadField<uint16_t>(map, kMapInstanceTypeAndBitFieldOffset) & 0xff;
6751 V8_INLINE
static int GetOddballKind(
const internal::Object* obj) {
6752 typedef internal::Object O;
6753 return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
6756 V8_INLINE
static bool IsExternalTwoByteString(
int instance_type) {
6757 int representation = (instance_type & kFullStringRepresentationMask);
6758 return representation == kExternalTwoByteRepresentationTag;
6761 V8_INLINE
static uint8_t GetNodeFlag(internal::Object** obj,
int shift) {
6762 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
6763 return *addr &
static_cast<uint8_t
>(1U << shift);
6766 V8_INLINE
static void UpdateNodeFlag(internal::Object** obj,
6767 bool value,
int shift) {
6768 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
6769 uint8_t mask =
static_cast<uint8_t
>(1U << shift);
6770 *addr =
static_cast<uint8_t
>((*addr & ~mask) | (value << shift));
6773 V8_INLINE
static uint8_t GetNodeState(internal::Object** obj) {
6774 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
6775 return *addr & kNodeStateMask;
6778 V8_INLINE
static void UpdateNodeState(internal::Object** obj,
6780 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
6781 *addr =
static_cast<uint8_t
>((*addr & ~kNodeStateMask) | value);
6784 V8_INLINE
static void SetEmbedderData(
v8::Isolate* isolate,
6787 uint8_t *addr =
reinterpret_cast<uint8_t *
>(isolate) +
6788 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
6789 *
reinterpret_cast<void**
>(addr) = data;
6792 V8_INLINE
static void* GetEmbedderData(
const v8::Isolate* isolate,
6794 const uint8_t* addr =
reinterpret_cast<const uint8_t*
>(isolate) +
6795 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
6796 return *
reinterpret_cast<void* const*
>(addr);
6799 V8_INLINE
static internal::Object** GetRoot(
v8::Isolate* isolate,
6801 uint8_t* addr =
reinterpret_cast<uint8_t*
>(isolate) + kIsolateRootsOffset;
6802 return reinterpret_cast<internal::Object**
>(addr + index * kApiPointerSize);
6805 template <
typename T>
6806 V8_INLINE
static T ReadField(
const internal::Object* ptr,
int offset) {
6807 const uint8_t* addr =
6808 reinterpret_cast<const uint8_t*
>(ptr) + offset - kHeapObjectTag;
6809 return *
reinterpret_cast<const T*
>(addr);
6812 template <
typename T>
6813 V8_INLINE
static T ReadEmbedderData(
const v8::Context* context,
int index) {
6814 typedef internal::Object O;
6816 O* ctx = *
reinterpret_cast<O* const*
>(context);
6817 int embedder_data_offset = I::kContextHeaderSize +
6818 (internal::kApiPointerSize * I::kContextEmbedderDataIndex);
6819 O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset);
6821 I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index);
6822 return I::ReadField<T>(embedder_data, value_offset);
6831 return New(isolate, that.val_);
6836 return New(isolate, that.val_);
6842 if (that == NULL)
return Local<T>();
6844 internal::Object** p =
reinterpret_cast<internal::Object**
>(that_ptr);
6845 return Local<T>(
reinterpret_cast<T*
>(HandleScope::CreateHandle(
6846 reinterpret_cast<internal::Isolate*>(isolate), *p)));
6852 void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
6854 V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
6859 Local<T> Eternal<T>::Get(Isolate* isolate) {
6860 return Local<T>(
reinterpret_cast<T*
>(*V8::GetEternal(isolate, index_)));
6865 Local<T> MaybeLocal<T>::ToLocalChecked() {
6866 if (V8_UNLIKELY(val_ ==
nullptr)) V8::ToLocalEmpty();
6867 return Local<T>(val_);
6872 void* WeakCallbackInfo<T>::GetInternalField(
int index)
const {
6873 #ifdef V8_ENABLE_CHECKS
6874 if (index < 0 || index >= kInternalFieldsInWeakCallback) {
6875 V8::InternalFieldOutOfBounds(index);
6878 return internal_fields_[index];
6883 T* PersistentBase<T>::New(Isolate* isolate, T* that) {
6884 if (that == NULL)
return NULL;
6885 internal::Object** p =
reinterpret_cast<internal::Object**
>(that);
6886 return reinterpret_cast<T*
>(
6887 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
6892 template <
class T,
class M>
6893 template <
class S,
class M2>
6894 void Persistent<T, M>::Copy(
const Persistent<S, M2>& that) {
6897 if (that.IsEmpty())
return;
6898 internal::Object** p =
reinterpret_cast<internal::Object**
>(that.val_);
6899 this->val_ =
reinterpret_cast<T*
>(V8::CopyPersistent(p));
6900 M::Copy(that,
this);
6905 bool PersistentBase<T>::IsIndependent()
const {
6906 typedef internal::Internals I;
6907 if (this->IsEmpty())
return false;
6908 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
6909 I::kNodeIsIndependentShift);
6916 if (this->IsEmpty())
return false;
6917 uint8_t node_state =
6918 I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_));
6919 return node_state == I::kNodeStateIsNearDeathValue ||
6920 node_state == I::kNodeStateIsPendingValue;
6927 if (this->IsEmpty())
return false;
6928 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
6929 I::kNodeStateIsWeakValue;
6935 if (this->IsEmpty())
return;
6936 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
6947 this->val_ = New(isolate, other.val_);
6954 const PersistentBase<S>& other) {
6957 if (other.IsEmpty())
return;
6958 this->val_ = New(isolate, other.val_);
6963 template <
typename S,
typename P>
6964 void PersistentBase<T>::SetWeak(
6966 typename WeakCallbackData<S, P>::Callback callback) {
6968 typedef typename WeakCallbackData<Value, void>::Callback Callback;
6969 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
6970 reinterpret_cast<Callback>(callback));
6975 template <
typename P>
6976 void PersistentBase<T>::SetWeak(
6978 typename WeakCallbackData<T, P>::Callback callback) {
6979 SetWeak<T, P>(parameter, callback);
6984 template <
typename P>
6985 void PersistentBase<T>::SetPhantom(
6986 P* parameter,
typename WeakCallbackInfo<P>::Callback callback,
6987 int internal_field_index1,
int internal_field_index2) {
6988 typedef typename WeakCallbackInfo<void>::Callback Callback;
6989 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
6990 internal_field_index1, internal_field_index2,
6991 reinterpret_cast<Callback>(callback));
6996 template <
typename P>
6997 V8_INLINE
void PersistentBase<T>::SetWeak(
6998 P* parameter,
typename WeakCallbackInfo<P>::Callback callback,
6999 WeakCallbackType type) {
7000 typedef typename WeakCallbackInfo<void>::Callback Callback;
7001 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
7002 reinterpret_cast<Callback>(callback), type);
7007 template <
typename P>
7008 P* PersistentBase<T>::ClearWeak() {
7009 return reinterpret_cast<P*
>(
7010 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
7017 if (this->IsEmpty())
return;
7018 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
7020 I::kNodeIsIndependentShift);
7027 if (this->IsEmpty())
return;
7028 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
7030 I::kNodeIsPartiallyDependentShift);
7037 if (this->IsEmpty())
return;
7038 internal::Object** obj =
reinterpret_cast<internal::Object**
>(this->val_);
7039 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
7040 *
reinterpret_cast<uint16_t*
>(addr) = class_id;
7047 if (this->IsEmpty())
return 0;
7048 internal::Object** obj =
reinterpret_cast<internal::Object**
>(this->val_);
7049 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
7050 return *
reinterpret_cast<uint16_t*
>(addr);
7054 template<
typename T>
7057 template<
typename T>
7058 template<
typename S>
7059 void ReturnValue<T>::Set(
const Persistent<S>& handle) {
7061 if (V8_UNLIKELY(handle.IsEmpty())) {
7062 *value_ = GetDefaultValue();
7064 *value_ = *
reinterpret_cast<internal::Object**
>(*handle);
7068 template<
typename T>
7069 template<
typename S>
7070 void ReturnValue<T>::Set(
const Handle<S> handle) {
7072 if (V8_UNLIKELY(handle.IsEmpty())) {
7073 *value_ = GetDefaultValue();
7075 *value_ = *
reinterpret_cast<internal::Object**
>(*handle);
7079 template<
typename T>
7080 void ReturnValue<T>::Set(
double i) {
7081 TYPE_CHECK(T, Number);
7082 Set(Number::New(GetIsolate(), i));
7085 template<
typename T>
7086 void ReturnValue<T>::Set(int32_t i) {
7087 TYPE_CHECK(T, Integer);
7088 typedef internal::Internals I;
7089 if (V8_LIKELY(I::IsValidSmi(i))) {
7090 *value_ = I::IntToSmi(i);
7093 Set(Integer::New(GetIsolate(), i));
7096 template<
typename T>
7097 void ReturnValue<T>::Set(uint32_t i) {
7098 TYPE_CHECK(T, Integer);
7100 bool fits_into_int32_t = (i & (1U << 31)) == 0;
7101 if (V8_LIKELY(fits_into_int32_t)) {
7102 Set(static_cast<int32_t>(i));
7105 Set(Integer::NewFromUnsigned(GetIsolate(), i));
7108 template<
typename T>
7109 void ReturnValue<T>::Set(
bool value) {
7110 TYPE_CHECK(T, Boolean);
7111 typedef internal::Internals I;
7114 root_index = I::kTrueValueRootIndex;
7116 root_index = I::kFalseValueRootIndex;
7118 *value_ = *I::GetRoot(GetIsolate(), root_index);
7121 template<
typename T>
7122 void ReturnValue<T>::SetNull() {
7123 TYPE_CHECK(T, Primitive);
7124 typedef internal::Internals I;
7125 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
7128 template<
typename T>
7129 void ReturnValue<T>::SetUndefined() {
7130 TYPE_CHECK(T, Primitive);
7131 typedef internal::Internals I;
7132 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
7135 template<
typename T>
7136 void ReturnValue<T>::SetEmptyString() {
7137 TYPE_CHECK(T, String);
7138 typedef internal::Internals I;
7139 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
7142 template<
typename T>
7143 Isolate* ReturnValue<T>::GetIsolate() {
7145 return *
reinterpret_cast<Isolate**
>(&value_[-2]);
7148 template<
typename T>
7149 template<
typename S>
7150 void ReturnValue<T>::Set(S* whatever) {
7152 TYPE_CHECK(S*, Primitive);
7155 template<
typename T>
7156 internal::Object* ReturnValue<T>::GetDefaultValue() {
7162 template<
typename T>
7163 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args,
7164 internal::Object** values,
7166 bool is_construct_call)
7167 : implicit_args_(implicit_args),
7170 is_construct_call_(is_construct_call) { }
7173 template<
typename T>
7174 Local<Value> FunctionCallbackInfo<T>::operator[](
int i)
const {
7175 if (i < 0 || length_ <= i)
return Local<Value>(*Undefined(GetIsolate()));
7176 return Local<Value>(
reinterpret_cast<Value*
>(values_ - i));
7180 template<
typename T>
7181 Local<Function> FunctionCallbackInfo<T>::Callee()
const {
7182 return Local<Function>(
reinterpret_cast<Function*
>(
7183 &implicit_args_[kCalleeIndex]));
7187 template<
typename T>
7188 Local<Object> FunctionCallbackInfo<T>::This()
const {
7189 return Local<Object>(
reinterpret_cast<Object*
>(values_ + 1));
7193 template<
typename T>
7194 Local<Object> FunctionCallbackInfo<T>::Holder()
const {
7195 return Local<Object>(
reinterpret_cast<Object*
>(
7196 &implicit_args_[kHolderIndex]));
7200 template<
typename T>
7201 Local<Value> FunctionCallbackInfo<T>::Data()
const {
7202 return Local<Value>(
reinterpret_cast<Value*
>(&implicit_args_[kDataIndex]));
7206 template<
typename T>
7207 Isolate* FunctionCallbackInfo<T>::GetIsolate()
const {
7208 return *
reinterpret_cast<Isolate**
>(&implicit_args_[kIsolateIndex]);
7212 template<
typename T>
7213 ReturnValue<T> FunctionCallbackInfo<T>::GetReturnValue()
const {
7214 return ReturnValue<T>(&implicit_args_[kReturnValueIndex]);
7218 template<
typename T>
7219 bool FunctionCallbackInfo<T>::IsConstructCall()
const {
7220 return is_construct_call_ & 0x1;
7224 template<
typename T>
7225 int FunctionCallbackInfo<T>::Length()
const {
7230 Handle<Value> ScriptOrigin::ResourceName()
const {
7231 return resource_name_;
7235 Handle<Integer> ScriptOrigin::ResourceLineOffset()
const {
7236 return resource_line_offset_;
7240 Handle<Integer> ScriptOrigin::ResourceColumnOffset()
const {
7241 return resource_column_offset_;
7246 return resource_is_embedder_debug_script_;
7251 return resource_is_shared_cross_origin_;
7255 Handle<Integer> ScriptOrigin::ScriptID()
const {
7260 Handle<Value> ScriptOrigin::SourceMapUrl()
const {
return source_map_url_; }
7263 ScriptCompiler::Source::Source(Local<String>
string,
const ScriptOrigin& origin,
7265 : source_string(string),
7266 resource_name(origin.ResourceName()),
7267 resource_line_offset(origin.ResourceLineOffset()),
7268 resource_column_offset(origin.ResourceColumnOffset()),
7269 resource_is_embedder_debug_script(origin.ResourceIsEmbedderDebugScript()),
7270 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
7271 source_map_url(origin.SourceMapUrl()),
7272 cached_data(data) {}
7275 ScriptCompiler::Source::Source(Local<String>
string,
7277 : source_string(string), cached_data(data) {}
7280 ScriptCompiler::Source::~Source() {
7285 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
7291 Handle<Boolean> Boolean::New(Isolate* isolate,
bool value) {
7292 return value ? True(isolate) : False(isolate);
7302 #ifndef V8_ENABLE_CHECKS
7303 typedef internal::Object O;
7304 typedef internal::HeapObject HO;
7306 O* obj = *
reinterpret_cast<O**
>(
this);
7309 if (I::GetInstanceType(obj) == I::kJSObjectType) {
7310 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
7311 O* value = I::ReadField<O*>(obj, offset);
7312 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
7316 return SlowGetInternalField(index);
7321 #ifndef V8_ENABLE_CHECKS
7322 typedef internal::Object O;
7324 O* obj = *
reinterpret_cast<O**
>(
this);
7327 if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
7328 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
7329 return I::ReadField<void*>(obj, offset);
7332 return SlowGetAlignedPointerFromInternalField(index);
7337 #ifdef V8_ENABLE_CHECKS
7340 return static_cast<String*
>(value);
7345 typedef internal::Object* S;
7347 I::CheckInitialized(isolate);
7348 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
7354 typedef internal::Object O;
7356 O* obj = *
reinterpret_cast<O* const*
>(
this);
7358 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
7359 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
7364 #ifdef V8_ENABLE_CHECKS
7365 VerifyExternalStringResource(result);
7372 String::Encoding* encoding_out)
const {
7373 typedef internal::Object O;
7375 O* obj = *
reinterpret_cast<O* const*
>(
this);
7376 int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
7377 *encoding_out =
static_cast<Encoding
>(type & I::kStringEncodingMask);
7379 if (type == I::kExternalOneByteRepresentationTag ||
7380 type == I::kExternalTwoByteRepresentationTag) {
7381 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
7384 #ifdef V8_ENABLE_CHECKS
7385 VerifyExternalStringResourceBase(resource, *encoding_out);
7392 #ifdef V8_ENABLE_CHECKS
7393 return FullIsUndefined();
7395 return QuickIsUndefined();
7399 bool Value::QuickIsUndefined()
const {
7400 typedef internal::Object O;
7402 O* obj = *
reinterpret_cast<O* const*
>(
this);
7403 if (!I::HasHeapObjectTag(obj))
return false;
7404 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
7405 return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
7410 #ifdef V8_ENABLE_CHECKS
7411 return FullIsNull();
7413 return QuickIsNull();
7417 bool Value::QuickIsNull()
const {
7418 typedef internal::Object O;
7420 O* obj = *
reinterpret_cast<O* const*
>(
this);
7421 if (!I::HasHeapObjectTag(obj))
return false;
7422 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
7423 return (I::GetOddballKind(obj) == I::kNullOddballKind);
7428 #ifdef V8_ENABLE_CHECKS
7429 return FullIsString();
7431 return QuickIsString();
7435 bool Value::QuickIsString()
const {
7436 typedef internal::Object O;
7438 O* obj = *
reinterpret_cast<O* const*
>(
this);
7439 if (!I::HasHeapObjectTag(obj))
return false;
7440 return (I::GetInstanceType(obj) < I::kFirstNonstringType);
7444 template <
class T> Value* Value::Cast(T* value) {
7445 return static_cast<Value*
>(value);
7449 Local<Boolean> Value::ToBoolean()
const {
7454 Local<Number> Value::ToNumber()
const {
7459 Local<String> Value::ToString()
const {
7464 Local<String> Value::ToDetailString()
const {
7469 Local<Object> Value::ToObject()
const {
7474 Local<Integer> Value::ToInteger()
const {
7479 Local<Uint32> Value::ToUint32()
const {
7487 Boolean* Boolean::Cast(
v8::Value* value) {
7488 #ifdef V8_ENABLE_CHECKS
7491 return static_cast<Boolean*
>(value);
7496 #ifdef V8_ENABLE_CHECKS
7499 return static_cast<Name*
>(value);
7503 Symbol* Symbol::Cast(
v8::Value* value) {
7504 #ifdef V8_ENABLE_CHECKS
7507 return static_cast<Symbol*
>(value);
7511 Number* Number::Cast(
v8::Value* value) {
7512 #ifdef V8_ENABLE_CHECKS
7515 return static_cast<Number*
>(value);
7519 Integer* Integer::Cast(
v8::Value* value) {
7520 #ifdef V8_ENABLE_CHECKS
7523 return static_cast<Integer*
>(value);
7528 #ifdef V8_ENABLE_CHECKS
7531 return static_cast<Int32*
>(value);
7535 Uint32* Uint32::Cast(
v8::Value* value) {
7536 #ifdef V8_ENABLE_CHECKS
7539 return static_cast<Uint32*
>(value);
7544 #ifdef V8_ENABLE_CHECKS
7547 return static_cast<Date*
>(value);
7551 StringObject* StringObject::Cast(
v8::Value* value) {
7552 #ifdef V8_ENABLE_CHECKS
7555 return static_cast<StringObject*
>(value);
7559 SymbolObject* SymbolObject::Cast(
v8::Value* value) {
7560 #ifdef V8_ENABLE_CHECKS
7563 return static_cast<SymbolObject*
>(value);
7567 NumberObject* NumberObject::Cast(
v8::Value* value) {
7568 #ifdef V8_ENABLE_CHECKS
7571 return static_cast<NumberObject*
>(value);
7575 BooleanObject* BooleanObject::Cast(
v8::Value* value) {
7576 #ifdef V8_ENABLE_CHECKS
7579 return static_cast<BooleanObject*
>(value);
7583 RegExp* RegExp::Cast(
v8::Value* value) {
7584 #ifdef V8_ENABLE_CHECKS
7587 return static_cast<RegExp*
>(value);
7591 Object* Object::Cast(
v8::Value* value) {
7592 #ifdef V8_ENABLE_CHECKS
7595 return static_cast<Object*
>(value);
7600 #ifdef V8_ENABLE_CHECKS
7603 return static_cast<Array*
>(value);
7607 Promise* Promise::Cast(
v8::Value* value) {
7608 #ifdef V8_ENABLE_CHECKS
7611 return static_cast<Promise*
>(value);
7615 Promise::Resolver* Promise::Resolver::Cast(
v8::Value* value) {
7616 #ifdef V8_ENABLE_CHECKS
7619 return static_cast<Promise::Resolver*
>(value);
7623 ArrayBuffer* ArrayBuffer::Cast(
v8::Value* value) {
7624 #ifdef V8_ENABLE_CHECKS
7627 return static_cast<ArrayBuffer*
>(value);
7631 ArrayBufferView* ArrayBufferView::Cast(
v8::Value* value) {
7632 #ifdef V8_ENABLE_CHECKS
7635 return static_cast<ArrayBufferView*
>(value);
7639 TypedArray* TypedArray::Cast(
v8::Value* value) {
7640 #ifdef V8_ENABLE_CHECKS
7643 return static_cast<TypedArray*
>(value);
7647 Uint8Array* Uint8Array::Cast(
v8::Value* value) {
7648 #ifdef V8_ENABLE_CHECKS
7651 return static_cast<Uint8Array*
>(value);
7655 Int8Array* Int8Array::Cast(
v8::Value* value) {
7656 #ifdef V8_ENABLE_CHECKS
7659 return static_cast<Int8Array*
>(value);
7663 Uint16Array* Uint16Array::Cast(
v8::Value* value) {
7664 #ifdef V8_ENABLE_CHECKS
7667 return static_cast<Uint16Array*
>(value);
7671 Int16Array* Int16Array::Cast(
v8::Value* value) {
7672 #ifdef V8_ENABLE_CHECKS
7675 return static_cast<Int16Array*
>(value);
7679 Uint32Array* Uint32Array::Cast(
v8::Value* value) {
7680 #ifdef V8_ENABLE_CHECKS
7683 return static_cast<Uint32Array*
>(value);
7687 Int32Array* Int32Array::Cast(
v8::Value* value) {
7688 #ifdef V8_ENABLE_CHECKS
7691 return static_cast<Int32Array*
>(value);
7695 Float32Array* Float32Array::Cast(
v8::Value* value) {
7696 #ifdef V8_ENABLE_CHECKS
7699 return static_cast<Float32Array*
>(value);
7703 Float64Array* Float64Array::Cast(
v8::Value* value) {
7704 #ifdef V8_ENABLE_CHECKS
7707 return static_cast<Float64Array*
>(value);
7711 Uint8ClampedArray* Uint8ClampedArray::Cast(
v8::Value* value) {
7712 #ifdef V8_ENABLE_CHECKS
7715 return static_cast<Uint8ClampedArray*
>(value);
7719 DataView* DataView::Cast(
v8::Value* value) {
7720 #ifdef V8_ENABLE_CHECKS
7723 return static_cast<DataView*
>(value);
7727 Function* Function::Cast(
v8::Value* value) {
7728 #ifdef V8_ENABLE_CHECKS
7731 return static_cast<Function*
>(value);
7735 External* External::Cast(
v8::Value* value) {
7736 #ifdef V8_ENABLE_CHECKS
7739 return static_cast<External*
>(value);
7743 template<
typename T>
7744 Isolate* PropertyCallbackInfo<T>::GetIsolate()
const {
7745 return *
reinterpret_cast<Isolate**
>(&args_[kIsolateIndex]);
7749 template<
typename T>
7750 Local<Value> PropertyCallbackInfo<T>::Data()
const {
7751 return Local<Value>(
reinterpret_cast<Value*
>(&args_[kDataIndex]));
7755 template<
typename T>
7756 Local<Object> PropertyCallbackInfo<T>::This()
const {
7757 return Local<Object>(
reinterpret_cast<Object*
>(&args_[kThisIndex]));
7761 template<
typename T>
7762 Local<Object> PropertyCallbackInfo<T>::Holder()
const {
7763 return Local<Object>(
reinterpret_cast<Object*
>(&args_[kHolderIndex]));
7767 template<
typename T>
7768 ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue()
const {
7769 return ReturnValue<T>(&args_[kReturnValueIndex]);
7773 Handle<Primitive> Undefined(Isolate* isolate) {
7774 typedef internal::Object* S;
7775 typedef internal::Internals I;
7776 I::CheckInitialized(isolate);
7777 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
7778 return Handle<Primitive>(
reinterpret_cast<Primitive*
>(slot));
7782 Handle<Primitive> Null(Isolate* isolate) {
7783 typedef internal::Object* S;
7784 typedef internal::Internals I;
7785 I::CheckInitialized(isolate);
7786 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
7787 return Handle<Primitive>(
reinterpret_cast<Primitive*
>(slot));
7791 Handle<Boolean> True(Isolate* isolate) {
7792 typedef internal::Object* S;
7793 typedef internal::Internals I;
7794 I::CheckInitialized(isolate);
7795 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
7796 return Handle<Boolean>(
reinterpret_cast<Boolean*
>(slot));
7800 Handle<Boolean> False(Isolate* isolate) {
7801 typedef internal::Object* S;
7802 typedef internal::Internals I;
7803 I::CheckInitialized(isolate);
7804 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
7805 return Handle<Boolean>(
reinterpret_cast<Boolean*
>(slot));
7811 I::SetEmbedderData(
this, slot, data);
7817 return I::GetEmbedderData(
this, slot);
7823 return I::kNumIsolateDataSlots;
7828 int64_t change_in_bytes) {
7830 int64_t* amount_of_external_allocated_memory =
7831 reinterpret_cast<int64_t*
>(
reinterpret_cast<uint8_t*
>(
this) +
7832 I::kAmountOfExternalAllocatedMemoryOffset);
7833 int64_t* amount_of_external_allocated_memory_at_last_global_gc =
7834 reinterpret_cast<int64_t*
>(
7835 reinterpret_cast<uint8_t*
>(
this) +
7836 I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset);
7837 int64_t amount = *amount_of_external_allocated_memory + change_in_bytes;
7838 if (change_in_bytes > 0 &&
7839 amount - *amount_of_external_allocated_memory_at_last_global_gc >
7840 I::kExternalAllocationLimit) {
7841 CollectAllGarbage(
"external memory allocation limit reached.");
7843 *amount_of_external_allocated_memory = amount;
7844 return *amount_of_external_allocated_memory;
7848 template<
typename T>
7851 TYPE_CHECK(
Value, T);
7852 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(
object.val_),
id);
7856 template<
typename T>
7859 TYPE_CHECK(
Value, T);
7860 SetReferenceFromGroup(
id,
7861 reinterpret_cast<v8::internal::Object**>(
object.val_));
7865 template<
typename T,
typename S>
7869 TYPE_CHECK(
Value, S);
7870 SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_),
7871 reinterpret_cast<v8::internal::Object**>(child.val_));
7876 #ifndef V8_ENABLE_CHECKS
7877 typedef internal::Object O;
7878 typedef internal::HeapObject HO;
7880 HO* context = *
reinterpret_cast<HO**
>(
this);
7882 HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(
this, index));
7885 return SlowGetEmbedderData(index);
7891 #ifndef V8_ENABLE_CHECKS
7893 return I::ReadEmbedderData<void*>(
this, index);
7895 return SlowGetAlignedPointerFromEmbedderData(index);
7900 void V8::SetAllowCodeGenerationFromStringsCallback(
7909 return isolate->IsDead();
7913 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
7915 return isolate->AddMessageListener(that, data);
7919 void V8::RemoveMessageListeners(MessageCallback that) {
7921 isolate->RemoveMessageListeners(that);
7925 void V8::SetFailedAccessCheckCallbackFunction(
7926 FailedAccessCheckCallback callback) {
7928 isolate->SetFailedAccessCheckCallbackFunction(callback);
7932 void V8::SetCaptureStackTraceForUncaughtExceptions(
7935 isolate->SetCaptureStackTraceForUncaughtExceptions(capture, frame_limit,
7940 void V8::SetFatalErrorHandler(FatalErrorCallback callback) {
7942 isolate->SetFatalErrorHandler(callback);
7946 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) {
7948 isolate->RemoveGCPrologueCallback(
7949 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback));
7953 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
7955 isolate->RemoveGCEpilogueCallback(
7956 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback));
7960 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
7962 AllocationAction action) {
7964 isolate->AddMemoryAllocationCallback(callback, space, action);
7968 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
7970 isolate->RemoveMemoryAllocationCallback(callback);
7974 void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); }
7977 bool V8::IsExecutionTerminating(Isolate* isolate) {
7978 if (isolate == NULL) {
7981 return isolate->IsExecutionTerminating();
7985 void V8::CancelTerminateExecution(Isolate* isolate) {
7986 isolate->CancelTerminateExecution();
7990 void V8::VisitExternalResources(ExternalResourceVisitor* visitor) {
7992 isolate->VisitExternalResources(visitor);
7996 void V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
7998 isolate->VisitHandlesWithClassIds(visitor);
8002 void V8::VisitHandlesWithClassIds(Isolate* isolate,
8003 PersistentHandleVisitor* visitor) {
8004 isolate->VisitHandlesWithClassIds(visitor);
8008 void V8::VisitHandlesForPartialDependence(Isolate* isolate,
8009 PersistentHandleVisitor* visitor) {
8010 isolate->VisitHandlesForPartialDependence(visitor);
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:3877
size_t length() const
Definition: v8.h:4497
V8_INLINE bool IsString() const
Definition: v8.h:7427
JitCodeEventHandler code_event_handler
Definition: v8.h:4974
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:3968
V8_INLINE Unlocker(Isolate *isolate)
Definition: v8.h:6531
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
Definition: v8.h:7890
V8_INLINE Global(Isolate *isolate, Handle< S > that)
Definition: v8.h:793
V8_INLINE void Clear()
Definition: v8.h:232
V8_INLINE void * GetData(uint32_t slot)
Definition: v8.h:7815
V8_INLINE void Reset()
Definition: v8.h:6934
V8_INLINE Local< Value > GetInternalField(int index)
Definition: v8.h:7301
V8_INLINE Persistent(const Persistent &that)
Definition: v8.h:720
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
Definition: v8.h:4007
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:3886
void Set(Handle< Name > name, Handle< Data > value, PropertyAttribute attributes=None)
V8_INLINE Global(Global &&other)
Definition: v8.h:810
Definition: v8-util.h:417
Definition: v8-profiler.h:580
const char * data() const
Definition: v8.h:4496
V8_INLINE Global()
Definition: v8.h:786
void(* GenericNamedPropertyDeleterCallback)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:3923
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3856
CounterLookupCallback counter_lookup_callback
Definition: v8.h:4991
WriteOptions
Definition: v8.h:2086
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, v8::NewStringType type, int length=-1)
V8_INLINE bool operator!=(const Local< S > &that) const
Definition: v8.h:269
Flags
Definition: v8.h:3713
V8_INLINE bool operator==(const Local< S > &that) const
Definition: v8.h:245
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8.h:2730
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:2524
V8_INLINE uint16_t WrapperClassId() const
Definition: v8.h:7045
V8_INLINE void SetData(uint32_t slot, void *data)
Definition: v8.h:7809
V8_INLINE void MarkPartiallyDependent()
Definition: v8.h:7025
static Isolate * GetCurrent()
V8_INLINE void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:7035
V8_INLINE ExternalStringResource * GetExternalStringResource() const
Definition: v8.h:7353
V8_INLINE int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Definition: v8.h:7827
V8_INLINE Global & operator=(Global< S > &&rhs)
Definition: v8.h:818
V8_INLINE ~Persistent()
Definition: v8.h:741
V8_INLINE Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
Definition: v8.h:710
JitCodeEventOptions
Definition: v8.h:4902
V8_INLINE bool IsNearDeath() const
Definition: v8.h:6914
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:5675
StartupData * snapshot_blob
Definition: v8.h:4984
V8_INLINE Handle< Boolean > ResourceIsEmbedderDebugScript() const
Definition: v8.h:7245
V8_INLINE ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
Definition: v8.h:7371
virtual ~ExternalStringResource()
Definition: v8.h:2164
void(* GenericNamedPropertyQueryCallback)(Local< Name > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:3914
void(* GenericNamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:3931
virtual void Dispose()
Definition: v8.h:2141
Definition: libplatform.h:10
static void * JSStackComparableAddress(v8::TryCatch *handler)
Definition: v8.h:6231
V8_INLINE Persistent(Isolate *isolate, Handle< S > that)
Definition: v8.h:700
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
Definition: v8.h:7866
AccessType
Definition: v8.h:3984
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3939
V8_INLINE Locker(Isolate *isolate)
Definition: v8.h:6546
Definition: v8-profiler.h:424
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3847
void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback callback)
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
Definition: v8.h:7849
StackTraceOptions
Definition: v8.h:1474
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3948
EmbedderDataFields
Definition: v8.h:6365
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter=0, GenericNamedPropertySetterCallback setter=0, GenericNamedPropertyQueryCallback query=0, GenericNamedPropertyDeleterCallback deleter=0, GenericNamedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:4213
ArrayBuffer::Allocator * array_buffer_allocator
Definition: v8.h:5006
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:3977
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:3958
V8_INLINE bool IsEmpty() const
Definition: v8.h:227
static V8_INLINE v8::Local< v8::String > Empty(Isolate *isolate)
Definition: v8.h:7344
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Definition: v8.h:4914
static V8_INLINE uint32_t GetNumberOfDataSlots()
Definition: v8.h:7821
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
Definition: v8.h:7320
FunctionEntryHook entry_hook
Definition: v8.h:4968
V8_INLINE V8_DEPRECATE_SOON("use WeakCallbackInfo version", void SetWeak(P *parameter, typename WeakCallbackData< T, P >::Callback callback))
void(* GenericNamedPropertyGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3896
static V8_INLINE Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8.h:6830
Global Pass()
Definition: v8.h:830
Definition: v8-util.h:159
V8_INLINE Global(Isolate *isolate, const PersistentBase< S > &that)
Definition: v8.h:803
V8_INLINE Persistent()
Definition: v8.h:694
V8_INLINE void MarkIndependent()
Definition: v8.h:7015
GarbageCollectionType
Definition: v8.h:5092
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
Definition: v8.h:7857
virtual ~ExternalOneByteStringResource()
Definition: v8.h:2197
Definition: v8-util.h:559
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8.h:2749
GCType
Definition: v8.h:4750
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
Definition: v8.h:3997
CreateHistogramCallback create_histogram_callback
Definition: v8.h:4999
V8_INLINE Local< T > Escape(Local< T > value)
Definition: v8.h:925
V8_INLINE bool IsNull() const
Definition: v8.h:7409
V8_INLINE Local(Local< S > that)
Definition: v8.h:214
void(* GenericNamedPropertySetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3904
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:5691
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
Definition: v8.h:4739
Definition: v8-util.h:350
UseCounterFeature
Definition: v8.h:5102
AccessControl
Definition: v8.h:2551
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
Definition: v8.h:4832
V8_INLINE bool IsUndefined() const
Definition: v8.h:7391
ResourceConstraints constraints
Definition: v8.h:4979
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:3867
V8_INLINE bool IsWeak() const
Definition: v8.h:6925
V8_INLINE Local< Value > GetEmbedderData(int index)
Definition: v8.h:7875
Definition: v8-profiler.h:181
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter=0, IndexedPropertySetterCallback setter=0, IndexedPropertyQueryCallback query=0, IndexedPropertyDeleterCallback deleter=0, IndexedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:4241