30 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
31 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
32 build configuration to ensure that at most one of these is set
35 #ifdef BUILDING_V8_SHARED
36 # define V8_EXPORT __declspec(dllexport)
38 # define V8_EXPORT __declspec(dllimport)
46 #if V8_HAS_ATTRIBUTE_VISIBILITY && defined(V8_SHARED)
47 # ifdef BUILDING_V8_SHARED
48 # define V8_EXPORT __attribute__ ((visibility("default")))
63 class AccessorSignature;
71 class DeclaredAccessorDescriptor;
74 class FunctionTemplate;
76 class ImplementationUtilities;
84 class ObjectOperationDescriptor;
88 class RawOperationDescriptor;
101 template <
class T>
class Handle;
102 template <
class T>
class Local;
103 template <
class T>
class Eternal;
104 template<
class T>
class NonCopyablePersistentTraits;
105 template<
class T>
class PersistentBase;
107 class M = NonCopyablePersistentTraits<T> >
class Persistent;
108 template<
class T>
class UniquePersistent;
109 template<
class K,
class V,
class T>
class PersistentValueMap;
110 template<
class V,
class T>
class PersistentValueVector;
123 class CallHandlerHelper;
133 struct StreamedSource;
134 template<
typename T>
class CustomArguments;
135 class PropertyCallbackArguments;
136 class FunctionCallbackArguments;
167 #define TYPE_CHECK(T, S) \
169 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
216 :
val_(reinterpret_cast<
T*>(*that)) {
248 if (a == 0)
return b == 0;
249 if (b == 0)
return false;
257 if (a == 0)
return b == 0;
258 if (b == 0)
return false;
278 #ifdef V8_ENABLE_CHECKS
291 return New(isolate, that.
val_);
295 return New(isolate, that.
val_);
303 template<
class F>
friend class Local;
338 :
Handle<
T>(reinterpret_cast<
T*>(*that)) {
349 #ifdef V8_ENABLE_CHECKS
357 :
Handle<
T>(reinterpret_cast<
T*>(*that)) {
380 template<
class F>
friend class Local;
416 template<
class T,
class P>
475 if (a == 0)
return b == 0;
476 if (b == 0)
return false;
483 if (a == 0)
return b == 0;
484 if (b == 0)
return false;
509 template<
typename S,
typename P>
562 template<
class F>
friend class Local;
591 template<
class S,
class M>
594 Uncompilable<Object>();
611 template<
class S,
class M>
647 template <
class S,
class M2>
661 template <
class S,
class M2>
669 template <
class S,
class M2>
680 if (M::kResetInDestructor) this->
Reset();
686 #ifdef V8_ENABLE_CHECKS
689 if (!that.
IsEmpty()) T::Cast(*that);
706 template<
class F>
friend class Local;
712 template<
class S,
class M2>
811 static int NumberOfHandles(
Isolate* isolate);
814 return reinterpret_cast<Isolate*
>(isolate_);
820 void Initialize(
Isolate* isolate);
834 void*
operator new(
size_t size);
835 void operator delete(
void*, size_t);
842 template<
class F>
friend class Local;
868 return Local<T>(
reinterpret_cast<T*
>(slot));
878 void*
operator new(
size_t size);
879 void operator delete(
void*, size_t);
975 int GetLineNumber(
int code_pos);
977 static const int kNoScriptId = 0;
1011 return GetUnboundScript()->GetId();
1041 BufferPolicy buffer_policy = BufferNotOwned);
1160 kNoCompileOptions = 0,
1184 Isolate* isolate, Source* source,
1185 CompileOptions options = kNoCompileOptions);
1199 Isolate* isolate, Source* source,
1200 CompileOptions options = kNoCompileOptions);
1213 static ScriptStreamingTask* StartStreamingScript(
1214 Isolate* isolate, StreamedSource* source,
1215 CompileOptions options = kNoCompileOptions);
1260 int GetLineNumber()
const;
1266 int GetStartPosition()
const;
1272 int GetEndPosition()
const;
1278 int GetStartColumn()
const;
1284 int GetEndColumn()
const;
1290 bool IsSharedCrossOrigin()
const;
1293 static void PrintCurrentStackTrace(
Isolate* isolate, FILE* out);
1295 static const int kNoLineNumberInfo = 0;
1296 static const int kNoColumnInfo = 0;
1297 static const int kNoScriptIdInfo = 0;
1314 kColumnOffset = 1 << 1 | kLineNumber,
1315 kScriptName = 1 << 2,
1316 kFunctionName = 1 << 3,
1318 kIsConstructor = 1 << 5,
1319 kScriptNameOrSourceURL = 1 << 6,
1321 kExposeFramesAcrossSecurityOrigins = 1 << 8,
1322 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
1323 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
1334 int GetFrameCount()
const;
1351 StackTraceOptions options = kOverview);
1366 int GetLineNumber()
const;
1375 int GetColumn()
const;
1383 int GetScriptId()
const;
1408 bool IsEval()
const;
1414 bool IsConstructor()
const;
1457 bool IsTrue()
const;
1462 bool IsFalse()
const;
1468 bool IsName()
const;
1480 bool IsSymbol()
const;
1485 bool IsFunction()
const;
1490 bool IsArray()
const;
1495 bool IsObject()
const;
1500 bool IsBoolean()
const;
1505 bool IsNumber()
const;
1510 bool IsExternal()
const;
1515 bool IsInt32()
const;
1520 bool IsUint32()
const;
1556 bool IsNativeError()
const;
1561 bool IsRegExp()
const;
1573 bool IsGeneratorObject()
const;
1579 bool IsPromise()
const;
1609 bool IsArrayBuffer()
const;
1615 bool IsArrayBufferView()
const;
1621 bool IsTypedArray()
const;
1681 bool IsDataView()
const;
1698 bool BooleanValue()
const;
1699 double NumberValue()
const;
1700 int64_t IntegerValue()
const;
1712 V8_INLINE bool QuickIsUndefined()
const;
1715 bool FullIsUndefined()
const;
1716 bool FullIsNull()
const;
1717 bool FullIsString()
const;
1755 UNKNOWN_ENCODING = 0x1,
1756 TWO_BYTE_ENCODING = 0x0,
1757 ASCII_ENCODING = 0x4,
1758 ONE_BYTE_ENCODING = 0x4
1776 bool IsOneByte()
const;
1782 bool ContainsOnlyOneByte()
const;
1811 HINT_MANY_WRITES_EXPECTED = 1,
1812 NO_NULL_TERMINATION = 2,
1813 PRESERVE_ASCII_NULL = 4,
1814 PRESERVE_ONE_BYTE_NULL = 4,
1818 REPLACE_INVALID_UTF8 = 8
1825 int options = NO_OPTIONS)
const;
1827 int WriteOneByte(uint8_t* buffer,
1830 int options = NO_OPTIONS)
const;
1832 int WriteUtf8(
char* buffer,
1834 int* nchars_ref =
NULL,
1835 int options = NO_OPTIONS)
const;
1845 bool IsExternal()
const;
1850 bool IsExternalOneByte()
const;
1926 virtual const char*
data()
const = 0;
1957 return GetExternalOneByteStringResource();
1969 NewStringType type = kNormalString,
1975 const uint8_t* data,
1976 NewStringType type = kNormalString,
1983 NewStringType type = kNormalString,
2001 ExternalStringResource* resource);
2012 bool MakeExternal(ExternalStringResource* resource);
2023 ExternalOneByteStringResource* resource);
2034 bool MakeExternal(ExternalOneByteStringResource* resource);
2039 bool CanMakeExternal();
2164 double Value()
const;
2180 int64_t
Value()
const;
2413 int InternalFieldCount();
2418 return object.val_->InternalFieldCount();
2432 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
2437 return object.val_->GetAlignedPointerFromInternalField(index);
2445 void SetAlignedPointerInInternalField(
int index,
void* value);
2450 bool HasRealIndexedProperty(
uint32_t index);
2467 bool HasNamedLookupInterceptor();
2470 bool HasIndexedLookupInterceptor();
2477 void TurnOnAccessCheck();
2486 int GetIdentityHash();
2525 void SetIndexedPropertiesToPixelData(uint8_t* data,
int length);
2526 bool HasIndexedPropertiesInPixelData();
2527 uint8_t* GetIndexedPropertiesPixelData();
2528 int GetIndexedPropertiesPixelDataLength();
2537 void SetIndexedPropertiesToExternalArrayData(
void* data,
2539 int number_of_elements);
2540 bool HasIndexedPropertiesInExternalArrayData();
2541 void* GetIndexedPropertiesExternalArrayData();
2543 int GetIndexedPropertiesExternalArrayDataLength();
2573 static void CheckCast(
Value* obj);
2575 void* SlowGetAlignedPointerFromInternalField(
int index);
2601 static void CheckCast(
Value* obj);
2605 template<
typename T>
2628 template <
typename S>
2649 template<
typename T>
2678 bool is_construct_call);
2690 template<
typename T>
2758 int GetScriptLineNumber()
const;
2763 int GetScriptColumnNumber()
const;
2768 bool IsBuiltin()
const;
2773 int ScriptId()
const;
2787 static void CheckCast(
Value* obj);
2820 static void CheckCast(
Value* obj);
2837 static void CheckCast(
Value* obj);
2841 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
2843 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
2878 virtual void Free(
void* data,
size_t length) = 0;
2895 void*
Data()
const {
return data_; }
2909 size_t ByteLength()
const;
2926 size_t byte_length);
2932 bool IsExternal()
const;
2959 static void CheckCast(
Value* obj);
2963 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
2965 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
2984 size_t ByteOffset();
2988 size_t ByteLength();
2992 static const int kInternalFieldCount =
2997 static void CheckCast(
Value* obj);
3018 static void CheckCast(
Value* obj);
3029 size_t byte_offset,
size_t length);
3045 size_t byte_offset,
size_t length);
3060 size_t byte_offset,
size_t length);
3076 size_t byte_offset,
size_t length);
3092 size_t byte_offset,
size_t length);
3108 size_t byte_offset,
size_t length);
3124 size_t byte_offset,
size_t length);
3140 size_t byte_offset,
size_t length);
3156 size_t byte_offset,
size_t length);
3172 size_t byte_offset,
size_t length);
3177 static void CheckCast(
Value* obj);
3192 double ValueOf()
const;
3208 static void DateTimeConfigurationChangeNotification(
Isolate* isolate);
3222 double ValueOf()
const;
3238 bool ValueOf()
const;
3318 Flags GetFlags()
const;
3335 void*
Value()
const;
3354 void SetAccessorProperty(
3662 void SetLength(
int length);
3695 void SetHiddenPrototype(
bool value);
3701 void ReadOnlyPrototype();
3707 void RemovePrototype();
3801 void SetNamedPropertyHandler(
3825 void SetIndexedPropertyHandler(
3850 void MarkAsUndetectable();
3866 bool turned_on_by_default =
true);
3872 int InternalFieldCount();
3878 void SetInternalFieldCount(
int value);
3931 int internal_field);
3953 void* compare_value);
3957 uint8_t bool_offset = 0);
3960 uint8_t compare_value);
3996 : data_(data), length_(length) {}
3997 const char*
data()
const {
return data_; }
4013 const char* source = 0,
4015 const char** deps = 0,
4016 int source_length = -1);
4023 const char*
name()
const {
return name_; }
4081 void ConfigureDefaults(uint64_t physical_memory,
4082 uint64_t virtual_memory_limit,
4097 max_available_threads_ = value;
4101 code_range_size_ = value;
4142 typedef int* (*CounterLookupCallback)(
const char*
name);
4144 typedef void* (*CreateHistogramCallback)(
const char*
name,
4364 code_event_handler(
NULL),
4365 enable_serializer(
false) {}
4478 kMinorGarbageCollection
4488 kUseCounterFeatureCount
4491 typedef void (*UseCounterCallback)(
Isolate* isolate,
4576 AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
4626 template<
typename T>
void SetObjectGroupId(
const Persistent<T>&
object,
4636 template<
typename T>
void SetReferenceFromGroup(
UniqueId id,
4645 template<
typename T,
typename S>
4664 void AddGCPrologueCallback(
4682 void AddGCEpilogueCallback(
4706 void ClearInterrupt();
4742 void RunMicrotasks();
4758 void SetAutorunMicrotasks(
bool autorun);
4764 bool WillAutorunMicrotasks()
const;
4769 void SetUseCounterCallback(UseCounterCallback callback);
4798 bool IdleNotification(
int idle_time_in_ms);
4804 void LowMemoryNotification();
4812 int ContextDisposedNotification();
4848 void SetStackLimit(
uintptr_t stack_limit);
4860 void GetCodeRange(
void** start,
size_t* length_in_bytes);
4870 void operator delete(
void*, size_t);
4875 void CollectAllGarbage(
const char* gc_reason);
4908 const char* compressed_data,
4909 int compressed_data_size) = 0;
4973 static void SetAllowCodeGenerationFromStringsCallback(
4988 static bool IsDead();
5010 static int GetCompressedStartupDataCount();
5011 static void GetCompressedStartupData(
StartupData* compressed_data);
5012 static void SetDecompressedStartupData(
StartupData* decompressed_data);
5029 static void SetNativesDataBlob(
StartupData* startup_blob);
5030 static void SetSnapshotDataBlob(
StartupData* startup_blob);
5053 static void SetCaptureStackTraceForUncaughtExceptions(
5055 int frame_limit = 10,
5066 static void SetFlagsFromCommandLine(
int* argc,
5071 static const char* GetVersion();
5086 static void AddGCPrologueCallback(
5105 static void AddGCEpilogueCallback(
5131 static bool Initialize();
5143 static void SetReturnAddressLocationResolver(
5155 static void TerminateExecution(
Isolate* isolate);
5167 static bool IsExecutionTerminating(
Isolate* isolate =
NULL);
5185 static void CancelTerminateExecution(
Isolate* isolate);
5196 static bool Dispose();
5218 static void VisitHandlesForPartialDependence(
5234 static void InitializePlatform(
Platform* platform);
5240 static void ShutdownPlatform();
5254 static void Eternalize(
Isolate* isolate,
5288 bool HasCaught()
const;
5298 bool CanContinue()
const;
5312 bool HasTerminated()
const;
5366 void SetVerbose(
bool value);
5373 void SetCaptureMessage(
bool value);
5392 void ResetInternal();
5398 void operator delete(
void*, size_t);
5428 : name_count_(name_count), names_(names) { }
5430 const char**
begin()
const {
return &names_[0]; }
5431 const char**
end()
const {
return &names_[name_count_]; }
5463 void DetachGlobal();
5496 void UseDefaultSecurityToken();
5538 V8_INLINE void* GetAlignedPointerFromEmbedderData(
int index);
5545 void SetAlignedPointerInEmbedderData(
int index,
void* value);
5560 void AllowCodeGenerationFromStrings(
bool allow);
5566 bool IsCodeGenerationFromStringsAllowed();
5573 void SetErrorMessageForCodeGenerationFromStrings(
Handle<String> message);
5597 void* SlowGetAlignedPointerFromEmbedderData(
int index);
5686 void Initialize(
Isolate* isolate);
5705 static bool IsLocked(
Isolate* isolate);
5710 static bool IsActive();
5713 void Initialize(
Isolate* isolate);
5730 namespace internal {
5748 template<
int kSmiShiftSize>
5764 return static_cast<int>(
reinterpret_cast<intptr_t
>(value)) >> shift_bits;
5767 return internal::IntToSmi<kSmiShiftSize>(value);
5781 return static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U;
5793 return static_cast<int>(
reinterpret_cast<intptr_t
>(value) >> shift_bits);
5796 return internal::IntToSmi<kSmiShiftSize>(value);
5800 return (value ==
static_cast<int32_t>(value));
5874 #ifdef V8_ENABLE_CHECKS
5885 return PlatformSmiTagging::SmiToInt(value);
5893 return PlatformSmiTagging::IsValidSmi(value);
5916 return *addr &
static_cast<uint8_t
>(1U <<
shift);
5920 bool value,
int shift) {
5922 uint8_t mask =
static_cast<uint8_t
>(1U <<
shift);
5923 *addr =
static_cast<uint8_t
>((*addr & ~mask) | (value <<
shift));
5940 uint8_t *addr =
reinterpret_cast<uint8_t *
>(isolate) +
5942 *
reinterpret_cast<void**
>(addr) = data;
5947 const uint8_t* addr =
reinterpret_cast<const uint8_t*
>(isolate) +
5949 return *
reinterpret_cast<void* const*
>(addr);
5958 template <
typename T>
5960 const uint8_t* addr =
5962 return *
reinterpret_cast<const T*
>(addr);
5965 template <
typename T>
5969 O* ctx = *
reinterpret_cast<O* const*
>(context);
5970 int embedder_data_offset = I::kContextHeaderSize +
5972 O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset);
5975 return I::ReadField<T>(embedder_data, value_offset);
5988 return New(isolate, that.
val_);
5993 return New(isolate, that.
val_);
6034 return reinterpret_cast<T*
>(
6040 template <
class T,
class M>
6041 template <
class S,
class M2>
6048 M::Copy(that,
this);
6055 if (this->IsEmpty())
return false;
6057 I::kNodeIsIndependentShift);
6064 if (this->IsEmpty())
return false;
6065 uint8_t node_state =
6067 return node_state == I::kNodeStateIsNearDeathValue ||
6068 node_state == I::kNodeStateIsPendingValue;
6075 if (this->IsEmpty())
return false;
6076 return I::GetNodeState(
reinterpret_cast<internal::Object**
>(this->val_)) ==
6077 I::kNodeStateIsWeakValue;
6083 if (this->IsEmpty())
return;
6095 this->val_ = New(isolate, other.
val_);
6106 this->val_ = New(isolate, other.
val_);
6111 template <
typename S,
typename P>
6119 reinterpret_cast<Callback
>(callback));
6124 template <
typename P>
6128 SetWeak<T, P>(parameter, callback);
6133 template<
typename P>
6135 return reinterpret_cast<P*
>(
6143 if (this->IsEmpty())
return;
6146 I::kNodeIsIndependentShift);
6153 if (this->IsEmpty())
return;
6156 I::kNodeIsPartiallyDependentShift);
6160 template <
class T,
class M>
6172 if (this->IsEmpty())
return;
6174 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
6175 *
reinterpret_cast<uint16_t*
>(addr) = class_id;
6182 if (this->IsEmpty())
return 0;
6184 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
6185 return *
reinterpret_cast<uint16_t*
>(addr);
6189 template<
typename T>
6192 template<
typename T>
6193 template<
typename S>
6197 *value_ = GetDefaultValue();
6203 template<
typename T>
6204 template<
typename S>
6208 *value_ = GetDefaultValue();
6214 template<
typename T>
6220 template<
typename T>
6231 template<
typename T>
6235 bool fits_into_int32_t = (
i & (1U << 31)) == 0;
6243 template<
typename T>
6249 root_index = I::kTrueValueRootIndex;
6251 root_index = I::kFalseValueRootIndex;
6253 *value_ = *I::GetRoot(GetIsolate(), root_index);
6256 template<
typename T>
6260 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
6263 template<
typename T>
6267 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
6270 template<
typename T>
6274 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
6277 template<
typename T>
6280 return *
reinterpret_cast<Isolate**
>(&value_[-2]);
6283 template<
typename T>
6284 template<
typename S>
6290 template<
typename T>
6297 template<
typename T>
6301 bool is_construct_call)
6302 : implicit_args_(implicit_args),
6305 is_construct_call_(is_construct_call) { }
6308 template<
typename T>
6315 template<
typename T>
6318 &implicit_args_[kCalleeIndex]));
6322 template<
typename T>
6328 template<
typename T>
6331 &implicit_args_[kHolderIndex]));
6335 template<
typename T>
6341 template<
typename T>
6343 return *
reinterpret_cast<Isolate**
>(&implicit_args_[kIsolateIndex]);
6347 template<
typename T>
6353 template<
typename T>
6355 return is_construct_call_;
6359 template<
typename T>
6392 : source_string(string),
6393 resource_name(origin.ResourceName()),
6394 resource_line_offset(origin.ResourceLineOffset()),
6395 resource_column_offset(origin.ResourceColumnOffset()),
6396 resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
6397 cached_data(data) {}
6402 : source_string(string), cached_data(data) {}
6417 return value ?
True(isolate) :
False(isolate);
6427 #ifndef V8_ENABLE_CHECKS
6431 O* obj = *
reinterpret_cast<O**
>(
this);
6434 if (I::GetInstanceType(obj) == I::kJSObjectType) {
6436 O* value = I::ReadField<O*>(obj, offset);
6441 return SlowGetInternalField(index);
6446 #ifndef V8_ENABLE_CHECKS
6449 O* obj = *
reinterpret_cast<O**
>(
this);
6452 if (
V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
6454 return I::ReadField<void*>(obj, offset);
6457 return SlowGetAlignedPointerFromInternalField(index);
6462 #ifdef V8_ENABLE_CHECKS
6465 return static_cast<String*
>(value);
6472 I::CheckInitialized(isolate);
6473 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
6481 O* obj = *
reinterpret_cast<O* const*
>(
this);
6483 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
6484 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
6489 #ifdef V8_ENABLE_CHECKS
6490 VerifyExternalStringResource(result);
6500 O* obj = *
reinterpret_cast<O* const*
>(
this);
6501 int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
6504 if (type == I::kExternalOneByteRepresentationTag ||
6505 type == I::kExternalTwoByteRepresentationTag) {
6506 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
6509 #ifdef V8_ENABLE_CHECKS
6510 VerifyExternalStringResourceBase(resource, *encoding_out);
6517 #ifdef V8_ENABLE_CHECKS
6518 return FullIsUndefined();
6520 return QuickIsUndefined();
6527 O* obj = *
reinterpret_cast<O* const*
>(
this);
6528 if (!I::HasHeapObjectTag(obj))
return false;
6529 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
6530 return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
6535 #ifdef V8_ENABLE_CHECKS
6536 return FullIsNull();
6538 return QuickIsNull();
6545 O* obj = *
reinterpret_cast<O* const*
>(
this);
6546 if (!I::HasHeapObjectTag(obj))
return false;
6547 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
6548 return (I::GetOddballKind(obj) == I::kNullOddballKind);
6553 #ifdef V8_ENABLE_CHECKS
6554 return FullIsString();
6556 return QuickIsString();
6563 O* obj = *
reinterpret_cast<O* const*
>(
this);
6564 if (!I::HasHeapObjectTag(obj))
return false;
6565 return (I::GetInstanceType(obj) < I::kFirstNonstringType);
6570 return static_cast<Value*
>(value);
6575 #ifdef V8_ENABLE_CHECKS
6578 return static_cast<Name*
>(value);
6583 #ifdef V8_ENABLE_CHECKS
6586 return static_cast<Symbol*
>(value);
6591 #ifdef V8_ENABLE_CHECKS
6594 return static_cast<Number*
>(value);
6599 #ifdef V8_ENABLE_CHECKS
6602 return static_cast<Integer*
>(value);
6607 #ifdef V8_ENABLE_CHECKS
6610 return static_cast<Date*
>(value);
6615 #ifdef V8_ENABLE_CHECKS
6623 #ifdef V8_ENABLE_CHECKS
6631 #ifdef V8_ENABLE_CHECKS
6639 #ifdef V8_ENABLE_CHECKS
6647 #ifdef V8_ENABLE_CHECKS
6650 return static_cast<RegExp*
>(value);
6655 #ifdef V8_ENABLE_CHECKS
6658 return static_cast<Object*
>(value);
6663 #ifdef V8_ENABLE_CHECKS
6666 return static_cast<Array*
>(value);
6671 #ifdef V8_ENABLE_CHECKS
6674 return static_cast<Promise*
>(value);
6679 #ifdef V8_ENABLE_CHECKS
6687 #ifdef V8_ENABLE_CHECKS
6695 #ifdef V8_ENABLE_CHECKS
6703 #ifdef V8_ENABLE_CHECKS
6711 #ifdef V8_ENABLE_CHECKS
6719 #ifdef V8_ENABLE_CHECKS
6727 #ifdef V8_ENABLE_CHECKS
6735 #ifdef V8_ENABLE_CHECKS
6743 #ifdef V8_ENABLE_CHECKS
6751 #ifdef V8_ENABLE_CHECKS
6759 #ifdef V8_ENABLE_CHECKS
6767 #ifdef V8_ENABLE_CHECKS
6775 #ifdef V8_ENABLE_CHECKS
6783 #ifdef V8_ENABLE_CHECKS
6786 return static_cast<DataView*
>(value);
6791 #ifdef V8_ENABLE_CHECKS
6794 return static_cast<Function*
>(value);
6799 #ifdef V8_ENABLE_CHECKS
6802 return static_cast<External*
>(value);
6806 template<
typename T>
6808 return *
reinterpret_cast<Isolate**
>(&args_[kIsolateIndex]);
6812 template<
typename T>
6818 template<
typename T>
6824 template<
typename T>
6830 template<
typename T>
6839 I::CheckInitialized(isolate);
6840 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
6848 I::CheckInitialized(isolate);
6849 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
6857 I::CheckInitialized(isolate);
6858 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
6866 I::CheckInitialized(isolate);
6867 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
6874 I::SetEmbedderData(
this, slot, data);
6880 return I::GetEmbedderData(
this, slot);
6886 return I::kNumIsolateDataSlots;
6891 int64_t change_in_bytes) {
6893 int64_t* amount_of_external_allocated_memory =
6894 reinterpret_cast<int64_t*
>(
reinterpret_cast<uint8_t*
>(
this) +
6895 I::kAmountOfExternalAllocatedMemoryOffset);
6896 int64_t* amount_of_external_allocated_memory_at_last_global_gc =
6897 reinterpret_cast<int64_t*
>(
6898 reinterpret_cast<uint8_t*
>(
this) +
6899 I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset);
6900 int64_t amount = *amount_of_external_allocated_memory + change_in_bytes;
6901 if (change_in_bytes > 0 &&
6902 amount - *amount_of_external_allocated_memory_at_last_global_gc >
6903 I::kExternalAllocationLimit) {
6904 CollectAllGarbage(
"external memory allocation limit reached.");
6906 *amount_of_external_allocated_memory = amount;
6908 return *amount_of_external_allocated_memory;
6912 template<
typename T>
6920 template<
typename T>
6924 SetReferenceFromGroup(
id,
6929 template<
typename T,
typename S>
6940 #ifndef V8_ENABLE_CHECKS
6944 HO* context = *
reinterpret_cast<HO**
>(
this);
6949 return SlowGetEmbedderData(index);
6955 #ifndef V8_ENABLE_CHECKS
6957 return I::ReadEmbedderData<void*>(
this, index);
6959 return SlowGetAlignedPointerFromEmbedderData(index);
An AccessorSignature specifies which receivers are valid parameters to an accessor callback.
A base class for an instance of one of "views" over ArrayBuffer, including TypedArrays and DataView (...
static ArrayBufferView * Cast(Value *obj)
Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
virtual void * Allocate(size_t length)=0
Allocate |length| bytes.
virtual void Free(void *data, size_t length)=0
Free the memory block of size |length|, pointed to by |data|.
virtual void * AllocateUninitialized(size_t length)=0
Allocate |length| bytes.
The contents of an |ArrayBuffer|.
size_t ByteLength() const
An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
static ArrayBuffer * Cast(Value *obj)
An instance of the built-in array constructor (ECMA-262, 15.4.2).
static Array * Cast(Value *obj)
A Boolean object (ECMA-262, 4.3.15).
static BooleanObject * Cast(v8::Value *obj)
A primitive boolean value (ECMA-262, 4.3.14).
static Handle< Boolean > New(Isolate *isolate, bool value)
Stack-allocated class which sets the execution context for all operations executed within a local sco...
Handle< Context > context_
Scope(Handle< Context > context)
A sandboxed execution context with its own set of built-in objects and functions.
Local< Value > GetEmbedderData(int index)
Gets the embedder data with the given index, which must have been set by a previous call to SetEmbedd...
void * GetAlignedPointerFromEmbedderData(int index)
Gets a 2-byte-aligned native pointer from the embedder data with the given index, which must have bee...
Interface for controlling CPU profiling.
An instance of DataView constructor (ES6 draft 15.13.7).
static DataView * Cast(Value *obj)
The superclass of values and API object templates.
An instance of the built-in Date constructor (ECMA-262, 15.9).
static Date * Cast(v8::Value *obj)
DeclaredAccessorDescriptor()
A HandleScope which first allocates a handle in the current scope which will be later filled with the...
EscapableHandleScope(const EscapableHandleScope &)
Local< T > Escape(Local< T > value)
Pushes the value into the previous scope and returns a handle to it.
void operator=(const EscapableHandleScope &)
internal::Object ** escape_slot_
void Set(Isolate *isolate, Local< S > handle)
static const int kInitialValue
Local< T > Get(Isolate *isolate)
Eternal(Isolate *isolate, Local< S > handle)
Create new error objects by calling the corresponding error object constructor with the message.
static Local< Value > RangeError(Handle< String > message)
static Local< Value > TypeError(Handle< String > message)
static Local< Value > SyntaxError(Handle< String > message)
static Local< Value > ReferenceError(Handle< String > message)
static Local< Value > Error(Handle< String > message)
A container for extension names.
ExtensionConfiguration(int name_count, const char *names[])
const char ** begin() const
const char ** end() const
Extension(const Extension &)
const char * name() const
const String::ExternalOneByteStringResource * source() const
size_t source_length() const
void operator=(const Extension &)
ExternalOneByteStringResourceImpl source_
virtual v8::Handle< v8::FunctionTemplate > GetNativeFunctionTemplate(v8::Isolate *isolate, v8::Handle< v8::String > name)
const char ** dependencies()
void set_auto_enable(bool value)
size_t length() const
The number of Latin-1 characters in the string.
const char * data() const
The string data from the underlying buffer.
ExternalOneByteStringResourceImpl(const char *data, size_t length)
ExternalOneByteStringResourceImpl()
Interface for iterating through all external resources in the heap.
virtual ~ExternalResourceVisitor()
virtual void VisitExternalString(Handle< String > string)
A JavaScript value that wraps a C++ void*.
static External * Cast(Value *obj)
An instance of Float32Array constructor (ES6 draft 15.13.6).
static void CheckCast(Value *obj)
static Local< Float32Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static Float32Array * Cast(Value *obj)
An instance of Float64Array constructor (ES6 draft 15.13.6).
static Float64Array * Cast(Value *obj)
static Local< Float64Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
The argument information given to function call callbacks.
static const int kHolderIndex
static const int kCalleeIndex
static const int kReturnValueDefaultValueIndex
static const int kIsolateIndex
static const int kDataIndex
static const int kArgsLength
internal::Object ** values_
ReturnValue< T > GetReturnValue() const
Local< Object > This() const
Local< Object > Holder() const
Local< Value > operator[](int i) const
Isolate * GetIsolate() const
FunctionCallbackInfo(internal::Object **implicit_args, internal::Object **values, int length, bool is_construct_call)
static const int kContextSaveIndex
Local< Value > Data() const
internal::Object ** implicit_args_
static const int kReturnValueIndex
bool IsConstructCall() const
Local< Function > Callee() const
A FunctionTemplate is used to create functions at runtime.
A JavaScript function object (ECMA-262, 15.3).
static const int kLineOffsetNotFound
static Function * Cast(Value *obj)
A stack-allocated class that governs a number of local handles.
void operator=(const HandleScope &)
internal::Isolate * isolate_
internal::Object ** prev_next_
HandleScope(const HandleScope &)
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
internal::Object ** prev_limit_
Isolate * GetIsolate() const
An object reference managed by the v8 garbage collector.
static Handle< T > New(Isolate *isolate, Handle< T > that)
static Handle< T > New(Isolate *isolate, const PersistentBase< T > &that)
bool operator==(const Handle< S > &that) const
Checks whether two handles are the same.
friend Handle< Boolean > True(Isolate *isolate)
bool operator==(const PersistentBase< S > &that) const
static Handle< T > New(Isolate *isolate, T *that)
bool IsEmpty() const
Returns true if the handle is empty.
void Clear()
Sets the handle to be empty.
friend Handle< Primitive > Null(Isolate *isolate)
friend Handle< Primitive > Undefined(Isolate *isolate)
Handle(Handle< S > that)
Creates a handle for the contents of the specified handle.
static Handle< T > Cast(Handle< S > that)
bool operator!=(const Persistent< S > &that) const
Handle()
Creates an empty handle.
Handle(T *val)
Creates a new handle for the specified value.
bool operator!=(const Handle< S > &that) const
Checks whether two handles are different.
friend Handle< Boolean > False(Isolate *isolate)
Interface for controlling heap profiling.
Collection of V8 heap information.
size_t total_physical_size()
size_t total_heap_size_executable_
size_t total_heap_size_executable()
size_t total_physical_size_
An instance of Int16Array constructor (ES6 draft 15.13.6).
static void CheckCast(Value *obj)
static Int16Array * Cast(Value *obj)
static Local< Int16Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
An instance of Int32Array constructor (ES6 draft 15.13.6).
static Local< Int32Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
static Int32Array * Cast(Value *obj)
A JavaScript value representing a 32-bit signed integer.
An instance of Int8Array constructor (ES6 draft 15.13.6).
static Int8Array * Cast(Value *obj)
static Local< Int8Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
A JavaScript value representing a signed integer.
static Integer * Cast(v8::Value *obj)
static Local< Integer > New(Isolate *isolate, int32_t value)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
Introduce exception to DisallowJavascriptExecutionScope.
AllowJavascriptExecutionScope & operator=(const AllowJavascriptExecutionScope &)
AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope &)
Assert that no Javascript code is invoked.
DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope &)
DisallowJavascriptExecutionScope & operator=(const DisallowJavascriptExecutionScope &)
Stack-allocated class which sets the isolate for all operations executed within a local scope.
Scope & operator=(const Scope &)
Do not run microtasks while this scope is active, even if microtasks are automatically executed other...
internal::Isolate * isolate_
SuppressMicrotaskExecutionScope & operator=(const SuppressMicrotaskExecutionScope &)
SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope &)
Isolate represents an isolated instance of the V8 engine.
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
Allows the host application to declare implicit references from an object to another object.
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
Allows the host application to declare implicit references from an object group to an object.
void SetData(uint32_t slot, void *data)
Associate embedder-specific data with the isolate.
GarbageCollectionType
Types of garbage collections that can be requested via RequestGarbageCollectionForTesting.
Isolate & operator=(const Isolate &)
static uint32_t GetNumberOfDataSlots()
Returns the maximum number of available embedder data slots.
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Adjusts the amount of registered external memory.
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
Allows the host application to group objects together.
void Enter()
Methods below this point require holding a lock (using Locker) in a multi-threaded environment.
UseCounterFeature
Features reported via the SetUseCounterCallback callback.
void * GetData(uint32_t slot)
Retrieve embedder-specific data from the isolate.
A light-weight stack-allocated object handle.
static Local< T > New(Isolate *isolate, T *that)
static Local< T > Cast(Local< S > that)
static Local< T > New(Isolate *isolate, const PersistentBase< T > &that)
static Local< T > New(Isolate *isolate, Handle< T > that)
Create a local handle for the content of another handle.
Locker(Isolate *isolate)
Initialize Locker for a given Isolate.
internal::Isolate * isolate_
void operator=(const Locker &)
A superclass for symbols and strings.
static Name * Cast(v8::Value *obj)
Default traits for Persistent.
static void Uncompilable()
static const bool kResetInDestructor
static void Copy(const Persistent< S, M > &source, NonCopyablePersistent *dest)
Persistent< T, NonCopyablePersistentTraits< T > > NonCopyablePersistent
A Number object (ECMA-262, 4.3.21).
static NumberObject * Cast(v8::Value *obj)
A JavaScript number value (ECMA-262, 4.3.20)
static Number * Cast(v8::Value *obj)
static Local< Number > New(Isolate *isolate, double value)
ObjectOperationDescriptor()
An ObjectTemplate is used to create objects at runtime.
A JavaScript object (ECMA-262, 4.3.3)
static Object * Cast(Value *obj)
void * GetAlignedPointerFromInternalField(int index)
Gets a 2-byte-aligned native pointer from an internal field.
static int InternalFieldCount(const PersistentBase< Object > &object)
Same as above, but works for Persistents.
static void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Same as above, but works for Persistents.
Local< Value > GetInternalField(int index)
Gets the value from an internal field.
An object reference that is independent of any handle scope.
void Reset()
If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call.
bool operator==(const Handle< S > &that) const
PersistentBase(PersistentBase &other)
bool IsWeak() const
Returns true if the handle's reference is weak.
void MarkPartiallyDependent()
Marks the reference to this object partially dependent.
bool IsIndependent() const
bool IsNearDeath() const
Checks if the handle holds the only reference to an object.
bool operator!=(const Handle< S > &that) const
bool operator!=(const PersistentBase< S > &that) const
void SetWeak(P *parameter, typename WeakCallbackData< T, P >::Callback callback)
Install a finalization callback on this object.
void operator=(PersistentBase &)
bool operator==(const PersistentBase< S > &that) const
void SetWrapperClassId(uint16_t class_id)
Assigns a wrapper class ID to the handle.
uint16_t WrapperClassId() const
Returns the class ID previously assigned to this handle or 0 if no class ID was previously assigned.
static T * New(Isolate *isolate, T *that)
void MarkIndependent()
Marks the reference to this object independent.
Interface for iterating through all the persistent handles in the heap.
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
virtual ~PersistentHandleVisitor()
A map wrapper that allows using UniquePersistent as a mapped value.
A vector wrapper that safely stores UniquePersistent values.
A PersistentBase which allows copy and assignment.
Persistent(Isolate *isolate, Handle< S > that)
Construct a Persistent from a Handle.
~Persistent()
The destructor will dispose the Persistent based on the kResetInDestructor flags in the traits class.
Persistent(const Persistent< S, M2 > &that)
Persistent()
A Persistent with no storage cell.
Persistent & operator=(const Persistent &that)
Persistent & operator=(const Persistent< S, M2 > &that)
static Persistent< T > & Cast(Persistent< S > &that)
void Copy(const Persistent< S, M2 > &that)
Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
Construct a Persistent from a Persistent.
Persistent(const Persistent &that)
The copy constructors and assignment operator create a Persistent exactly as the Persistent construct...
The superclass of primitive values.
static Resolver * Cast(Value *obj)
An instance of the built-in Promise constructor (ES6 draft).
static Promise * Cast(Value *obj)
The information passed to a property callback about the context of the property access.
static const int kReturnValueDefaultValueIndex
Local< Value > Data() const
static const int kDataIndex
PropertyCallbackInfo(internal::Object **args)
internal::Object ** args_
static const int kIsolateIndex
Local< Object > Holder() const
static const int kThisIndex
static const int kHolderIndex
static const int kArgsLength
ReturnValue< T > GetReturnValue() const
static const int kReturnValueIndex
friend class MacroAssembler
Local< Object > This() const
Isolate * GetIsolate() const
An instance of the built-in RegExp constructor (ECMA-262, 15.10).
Flags
Regular expression flag bits.
static RegExp * Cast(v8::Value *obj)
A set of constraints that specifies the limits of the runtime's memory use.
void set_max_available_threads(int value)
void set_stack_limit(uint32_t *value)
int max_semi_space_size() const
void set_max_executable_size(int value)
int max_old_space_size() const
int max_available_threads_
void set_max_old_space_size(int value)
int max_available_threads() const
int max_executable_size() const
uint32_t * stack_limit() const
void set_max_semi_space_size(int value)
size_t code_range_size() const
void set_code_range_size(size_t value)
Interface for providing information about embedder's objects held by global handles.
void Set(const Persistent< S > &handle)
ReturnValue(const ReturnValue< S > &that)
void SetInternal(internal::Object *value)
internal::Object ** value_
internal::Object * GetDefaultValue()
For streaming incomplete script data to V8.
virtual ~ExternalSourceStream()
virtual size_t GetMoreData(const uint8_t **src)=0
V8 calls this to request the next chunk of data from the embedder.
A streaming task which the embedder must run on a background thread to stream scripts into V8.
virtual ~ScriptStreamingTask()
Source code which can be then compiled to a UnboundScript or Script.
Local< String > source_string
Handle< Integer > resource_column_offset
const CachedData * GetCachedData() const
Handle< Value > resource_name
Handle< Integer > resource_line_offset
Handle< Boolean > resource_is_shared_cross_origin
Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=NULL)
Source & operator=(const Source &)
Source code which can be streamed into V8 in pieces.
StreamedSource & operator=(const StreamedSource &)
internal::StreamedSource * impl_
internal::StreamedSource * impl() const
StreamedSource(const StreamedSource &)
The origin, within a file, of a script.
Handle< Boolean > resource_is_shared_cross_origin_
Handle< Integer > resource_line_offset_
Handle< Boolean > ResourceIsSharedCrossOrigin() const
Handle< Integer > ScriptID() const
Handle< Integer > ResourceColumnOffset() const
Handle< Integer > ResourceLineOffset() const
Handle< Integer > script_id_
ScriptOrigin(Handle< Value > resource_name, Handle< Integer > resource_line_offset=Handle< Integer >(), Handle< Integer > resource_column_offset=Handle< Integer >(), Handle< Boolean > resource_is_shared_cross_origin=Handle< Boolean >(), Handle< Integer > script_id=Handle< Integer >())
Handle< Value > ResourceName() const
Handle< Value > resource_name_
Handle< Integer > resource_column_offset_
A compiled JavaScript script, tied to a Context which was active when the script was compiled.
V8_DEPRECATED("Use GetUnboundScript()->GetId()", int GetId())
A Signature specifies which receivers and arguments are valid parameters to a function.
A single JavaScript stack frame.
Representation of a JavaScript stack trace.
StackTraceOptions
Flags that determine what information is placed captured for each StackFrame when grabbing the curren...
A helper class for driving V8 startup data decompression.
virtual int DecompressData(char *raw_data, int *raw_data_size, const char *compressed_data, int compressed_data_size)=0
A String object (ECMA-262, 4.3.18).
static StringObject * Cast(v8::Value *obj)
An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V...
virtual ~ExternalOneByteStringResource()
Override the destructor to manage the life cycle of the underlying buffer.
ExternalOneByteStringResource()
virtual const char * data() const =0
The string data from the underlying buffer.
virtual size_t length() const =0
The number of Latin-1 characters in the string.
ExternalStringResourceBase(const ExternalStringResourceBase &)
virtual ~ExternalStringResourceBase()
ExternalStringResourceBase()
void operator=(const ExternalStringResourceBase &)
virtual void Dispose()
Internally V8 will call this Dispose method when the external string resource is no longer needed.
An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap...
virtual ~ExternalStringResource()
Override the destructor to manage the life cycle of the underlying buffer.
virtual const uint16_t * data() const =0
The string data from the underlying buffer.
virtual size_t length() const =0
The length of the string.
Converts an object to a UTF-8-encoded character array.
Utf8Value(const Utf8Value &)
void operator=(const Utf8Value &)
const char * operator*() const
Converts an object to a two-byte string.
const uint16_t * operator*() const
void operator=(const Value &)
A JavaScript string value (ECMA-262, 4.3.17).
bool IsExternalAscii() const
ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
If the string is an external string, return the ExternalStringResourceBase regardless of the encoding...
static String * Cast(v8::Value *obj)
WriteOptions
Write the contents of the string to an external buffer.
static v8::Local< v8::String > Empty(Isolate *isolate)
A zero length string.
ExternalStringResource * GetExternalStringResource() const
Get the ExternalStringResource for an external string.
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-8 data.
const ExternalAsciiStringResource * GetExternalAsciiStringResource() const
ExternalOneByteStringResource ExternalAsciiStringResource
A Symbol object (ECMA-262 edition 6).
static SymbolObject * Cast(v8::Value *obj)
A JavaScript symbol (ECMA-262 edition 6)
static Symbol * Cast(v8::Value *obj)
The superclass of object and function templates.
void Set(Handle< Name > name, Handle< Data > value, PropertyAttribute attributes=None)
Adds a property to each instance created by this template.
An external exception handler.
void * js_stack_comparable_address_
TryCatch(const TryCatch &)
v8::internal::Isolate * isolate_
static void * JSStackComparableAddress(v8::TryCatch *handler)
There are cases when the raw address of C++ TryCatch object cannot be used for comparisons with addre...
void operator=(const TryCatch &)
A utility for determining the type of objects based on the template they were constructed from.
A base class for an instance of TypedArray series of constructors (ES6 draft 15.13....
static TypedArray * Cast(Value *obj)
An instance of Uint16Array constructor (ES6 draft 15.13.6).
static Local< Uint16Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static Uint16Array * Cast(Value *obj)
static void CheckCast(Value *obj)
An instance of Uint32Array constructor (ES6 draft 15.13.6).
static Local< Uint32Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
static Uint32Array * Cast(Value *obj)
A JavaScript value representing a 32-bit unsigned integer.
An instance of Uint8Array constructor (ES6 draft 15.13.6).
static Uint8Array * Cast(Value *obj)
static Local< Uint8Array > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
static void CheckCast(Value *obj)
static Uint8ClampedArray * Cast(Value *obj)
static Local< Uint8ClampedArray > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
A compiled JavaScript script, not yet tied to a Context.
General purpose unique identifier.
bool operator<(const UniqueId &other) const
bool operator==(const UniqueId &other) const
bool operator!=(const UniqueId &other) const
A PersistentBase which has move semantics.
UniquePersistent & operator=(UniquePersistent< S > rhs)
Move via assignment.
void operator=(UniquePersistent &)
UniquePersistent(RValue rvalue)
Move constructor.
UniquePersistent(UniquePersistent &)
UniquePersistent()
A UniquePersistent with no storage cell.
UniquePersistent(Isolate *isolate, Handle< S > that)
Construct a UniquePersistent from a Handle.
UniquePersistent Pass()
Pass allows returning uniques from functions, etc.
UniquePersistent(Isolate *isolate, const PersistentBase< S > &that)
Construct a UniquePersistent from a PersistentBase.
Multiple threads in V8 are allowed, but only one thread at a time is allowed to use any given V8 isol...
internal::Isolate * isolate_
Unlocker(Isolate *isolate)
Initialize Unlocker for a given Isolate.
Container class for static utility functions.
WeakCallbackData< Value, void >::Callback WeakCallback
static Local< Value > GetEternal(Isolate *isolate, int index)
static void Eternalize(Isolate *isolate, Value *handle, int *index)
static internal::Object ** GlobalizeReference(internal::Isolate *isolate, internal::Object **handle)
static void MakeWeak(internal::Object **global_handle, void *data, WeakCallback weak_callback)
static void DisposeGlobal(internal::Object **global_handle)
static internal::Object ** CopyPersistent(internal::Object **handle)
static void * ClearWeak(internal::Object **global_handle)
The superclass of all JavaScript values and objects.
bool IsSet() const
Returns true if this value is a Set.
bool IsSymbolObject() const
Returns true if this value is a Symbol object.
static Value * Cast(T *value)
bool IsStringObject() const
Returns true if this value is a String object.
bool IsWeakMap() const
Returns true if this value is a WeakMap.
bool IsNumberObject() const
Returns true if this value is a Number object.
bool IsBooleanObject() const
Returns true if this value is a Boolean object.
bool IsUint32Array() const
Returns true if this value is an Uint32Array.
bool QuickIsUndefined() const
bool IsUint8ClampedArray() const
Returns true if this value is an Uint8ClampedArray.
bool IsWeakSet() const
Returns true if this value is a WeakSet.
bool IsString() const
Returns true if this value is an instance of the String type.
bool IsNull() const
Returns true if this value is the null value.
bool IsFloat64Array() const
Returns true if this value is a Float64Array.
bool IsMap() const
Returns true if this value is a Map.
bool IsInt16Array() const
Returns true if this value is an Int16Array.
bool QuickIsString() const
bool IsDate() const
Returns true if this value is a Date.
bool IsFloat32Array() const
Returns true if this value is a Float32Array.
bool IsUndefined() const
Returns true if this value is the undefined value.
bool IsInt8Array() const
Returns true if this value is an Int8Array.
bool IsArgumentsObject() const
Returns true if this value is an Arguments object.
bool IsUint8Array() const
Returns true if this value is an Uint8Array.
bool IsUint16Array() const
Returns true if this value is an Uint16Array.
bool IsInt32Array() const
Returns true if this value is an Int32Array.
Isolate * GetIsolate() const
void(* Callback)(const WeakCallbackData< T, P > &data)
WeakCallbackData(Isolate *isolate, Local< T > handle, P *parameter)
Local< T > GetValue() const
This class exports constants and functionality from within v8 that is necessary to implement inline f...
static internal::Object ** GetRoot(v8::Isolate *isolate, int index)
static bool IsExternalTwoByteString(int instance_type)
static const int kHeapObjectMapOffset
static int GetOddballKind(const internal::Object *obj)
static const int kOddballType
static const int kNodeStateIsNearDeathValue
static const int kStringEncodingMask
static const int kNodeIsIndependentShift
static const uint32_t kNumIsolateDataSlots
static uint8_t GetNodeFlag(internal::Object **obj, int shift)
static const int kForeignType
static int GetInstanceType(const internal::Object *obj)
static const int kIsolateRootsOffset
static T ReadEmbedderData(const v8::Context *context, int index)
static const int kUndefinedOddballKind
static void UpdateNodeState(internal::Object **obj, uint8_t value)
static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset
static void CheckInitialized(v8::Isolate *isolate)
static const int kJSObjectType
static const int kFullStringRepresentationMask
static T ReadField(const internal::Object *ptr, int offset)
static const int kFirstNonstringType
static const int kEmptyStringRootIndex
static const int kAmountOfExternalAllocatedMemoryOffset
static const int kFixedArrayHeaderSize
static const int kNullOddballKind
static const int kUndefinedValueRootIndex
static const int kExternalTwoByteRepresentationTag
static void CheckInitializedImpl(v8::Isolate *isolate)
static const int kNodeStateIsPendingValue
static const int kNodeStateMask
static uint8_t GetNodeState(internal::Object **obj)
static const int kNodeStateIsWeakValue
static const int kStringResourceOffset
static const int kFalseValueRootIndex
static const int kTrueValueRootIndex
static internal::Object * IntToSmi(int value)
static const int kOddballKindOffset
static int SmiValue(const internal::Object *value)
static const int kContextHeaderSize
static const int kExternalAllocationLimit
static void UpdateNodeFlag(internal::Object **obj, bool value, int shift)
static const int kNullValueRootIndex
static void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
static const int kExternalOneByteRepresentationTag
static bool IsValidSmi(intptr_t value)
static const int kForeignAddressOffset
static const int kIsolateEmbedderDataOffset
static void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
static const int kMapInstanceTypeAndBitFieldOffset
static const int kNodeIsPartiallyDependentShift
static const int kNodeFlagsOffset
static const int kNodeClassIdOffset
static const int kJSObjectHeaderSize
static bool HasHeapObjectTag(const internal::Object *value)
static const int kContextEmbedderDataIndex
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions true
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi space(in MBytes)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
enable harmony numeric enable harmony object literal extensions Optimize object Array shift
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
HANDLE HANDLE LPSTACKFRAME64 StackFrame
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
Handle< ObjectTemplateInfo > GetEternal(Isolate *isolate)
bool Equals(Node *a, Node *b)
static void Parse(Handle< JSFunction > function, CompilationInfoWithZone *info)
const intptr_t kHeapObjectTagMask
const uint32_t kStringEncodingMask
bool InitializeICU(const char *icu_data_file)
SmiTagging< kApiPointerSize > PlatformSmiTagging
static int min(int a, int b)
bool IsGeneratorFunction(FunctionKind kind)
const int kApiPointerSize
int ToNumber(Register reg)
kSerializedDataOffset Object
Handle< T > handle(T *t, Isolate *isolate)
static bool SmiValuesAre32Bits()
internal::Object * IntToSmi(int value)
static bool SmiValuesAre31Bits()
const intptr_t kSmiTagMask
const int kHeapObjectTagSize
Debugger support for the V8 JavaScript engine.
JitCodeEventOptions
Option flags passed to the SetJitCodeEventHandler function.
@ kJitCodeEventEnumExisting
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
static void SetFlagsFromString(const char *flags)
static int Utf8Length(i::String *str, i::Isolate *isolate)
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
void(* LogEventCallback)(const char *name, int event)
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
@ kGCCallbackFlagConstructRetainedObjectInfos
@ kGCCallbackFlagCompacted
void(* MessageCallback)(Handle< Message > message, Handle< Value > error)
AccessControl
Access control specifications.
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Callback function passed to SetJitCodeEventHandler.
DeclaredAccessorDescriptorDataType
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Returns the value of the property if the getter intercepts the request.
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
NamedProperty[Getter|Setter] are used as interceptors on object.
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
Callback to check if code generation from strings is allowed.
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
void(* AddHistogramSampleCallback)(void *histogram, int sample)
int *(* CounterLookupCallback)(const char *name)
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the names of the properties the named property getter intercepts.
void(* MicrotaskCallback)(void *data)
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Accessor[Getter|Setter] are used as callback functions when setting|getting a particular property.
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a r...
void(* CallCompletedCallback)()
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
Handle< Boolean > False(Isolate *isolate)
void RegisterExtension(Extension *that)
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
@ kExternalUnsignedByteArray
@ kExternalUnsignedIntArray
@ kExternalUint8ClampedArray
@ kExternalUnsignedShortArray
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
FunctionEntryHook is the type of the profile entry hook called at entry to any generated function whe...
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
Returns true if cross-context access should be allowed to the named property with the given key on th...
bool(* EntropySource)(unsigned char *buffer, size_t length)
EntropySource is used as a callback function when v8 needs a source of entropy.
void(* FatalErrorCallback)(const char *location, const char *message)
GCType
Applications can register callback functions which will be called before and after a garbage collecti...
@ kGCTypeMarkSweepCompact
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
Handle< Boolean > True(Isolate *isolate)
Handle< Primitive > Null(Isolate *isolate)
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the indices of the properties the indexed property getter intercepts.
AccessType
Access type specification.
@ kAllocationActionAllocate
@ kObjectSpaceOldDataSpace
@ kObjectSpaceOldPointerSpace
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
Returns true if cross-context access should be allowed to the indexed property with the given index o...
void(* InterruptCallback)(Isolate *isolate, void *data)
Handle< Primitive > Undefined(Isolate *isolate)
#define P(name, number_of_args, result_size)
#define I(name, number_of_args, result_size)
Helper class traits to allow copying and assignment of Persistent.
static const bool kResetInDestructor
Persistent< T, CopyablePersistentTraits< T > > CopyablePersistent
static void Copy(const Persistent< S, M > &source, CopyablePersistent *dest)
Initial configuration parameters for a new Isolate.
ResourceConstraints constraints
ResourceConstraints to use for the new Isolate.
bool enable_serializer
This flag currently renders the Isolate unusable.
JitCodeEventHandler code_event_handler
Allows the host application to provide the address of a function that is notified each time code is a...
FunctionEntryHook entry_hook
The optional entry_hook allows the host application to provide the address of a function that's invok...
PositionType position_type
A JIT code event is issued each time code is added, moved or removed.
Handle< UnboundScript > script
struct line_info_t line_info
@ CODE_END_LINE_INFO_RECORDING
@ CODE_START_LINE_INFO_RECORDING
A simple Maybe type, representing an object which may or may not have a value.
Compilation data that the embedder can cache and pass back to speed up future compilations.
CachedData(const CachedData &)
BufferPolicy buffer_policy
CachedData & operator=(const CachedData &)
RValue(UniquePersistent *obj)
UniquePersistent * object
static int SmiValueSize()
static bool IsValidSmi(intptr_t value)
static internal::Object * IntToSmi(int value)
static int SmiShiftSize()
static int SmiToInt(const internal::Object *value)
static int SmiShiftSize()
static internal::Object * IntToSmi(int value)
static int SmiValueSize()
static int SmiToInt(const internal::Object *value)
static bool IsValidSmi(intptr_t value)
#define T(name, string, precedence)
#define V8_LIKELY(condition)
#define V8_UNLIKELY(condition)