Home | History | Annotate | Download | only in include

Lines Matching defs:V8

1 // Copyright 2012 the V8 project authors. All rights reserved.
5 /** \mainpage V8 API Reference Guide
7 * V8 is Google's open source JavaScript engine.
10 * V8 header file, include/v8.h.
12 * For other documentation see http://code.google.com/apis/v8/
25 #include "v8-version.h" // NOLINT(build/include)
28 // We reserve the V8_* prefix for macros defined in V8 public API and
33 // Setup for Windows DLL export/import. When building the V8 DLL the
35 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
36 // static library or building a program which uses the V8 static library neither
62 * The v8 JavaScript engine.
64 namespace v8 {
191 * An object reference managed by the v8 garbage collector.
193 * All objects returned from v8 have to be tracked by the garbage
443 // callback. The Global itself is unusable for anything else. No v8 other api
472 * the v8 engine which holds an object value and which is updated by
562 * Allows the embedder to tell the v8 garbage collector that a certain object
593 * description in v8-profiler.h for details.
1170 // which will be called when V8 no longer needs the data.
1223 * For streaming incomplete script data to V8. The embedder should implement a
1231 * V8 calls this to request the next chunk of data from the embedder. This
1237 * When streaming UTF-8 data, V8 handles multi-byte characters split between
1243 * GetMoreData call return 0. V8 will interpret it as end of data (and most
1245 * V8 has parsed the data it received so far.
1250 * V8 calls this method to set a 'bookmark' at the current position in
1262 * V8 calls this to return to a previously set bookmark.
1269 * Source code which can be streamed into V8 in pieces. It will be parsed
1298 * stream scripts into V8. Returned by ScriptCompiler::StartStreamingScript.
1321 * produced by the same version of V8.
1355 * Returns a task which streams script data into V8, or NULL if the script
1373 * (ScriptStreamingTask has been run). V8 doesn't construct the source string
1386 * Return a version tag for CachedData for the current V8 version & flags.
1392 * V8 version number or currently compiler flags. This means when
1394 * data from another V8 version, or the same version with different
1515 * this Message was generated to V8.
1565 * Returns StackTrace as a v8::Array that contains StackFrame objects.
1714 * clone spec. Other V8 embedders may throw some other appropriate exception
1918 * but can be created without entering a v8::Context and hence shouldn't
2295 V8_INLINE static Boolean* Cast(v8::Value* obj);
2299 static void CheckCast(v8::Value* obj);
2440 * Internally V8 will call this Dispose method when the external string
2453 friend class v8::String;
2458 * buffer that resides outside V8's heap. Implement an
2487 * string buffer that resides outside V8's heap. Implement an
2531 V8_INLINE static String* Cast(v8::Value* obj);
2535 kNormalString = static_cast<int>(v8::NewStringType::kNormal),
2536 kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
2549 Isolate* isolate, const char* data, v8::NewStringType type,
2562 Isolate* isolate, const uint8_t* data, v8::NewStringType type,
2575 Isolate* isolate, const uint16_t* data, v8::NewStringType type,
2586 * resource. When the external string is no longer live on V8's heap the
2611 * resource. When the external string is no longer live on V8's heap the
2649 explicit Utf8Value(Local<v8::Value> obj);
2672 explicit Value(Local<v8::Value> obj);
2691 static void CheckCast(v8::Value* obj);
2768 V8_INLINE static Number* Cast(v8::Value* obj);
2771 static void CheckCast(v8::Value* obj);
2783 V8_INLINE static Integer* Cast(v8::Value* obj);
2786 static void CheckCast(v8::Value* obj);
2796 V8_INLINE static Int32* Cast(v8::Value* obj);
2800 static void CheckCast(v8::Value* obj);
2810 V8_INLINE static Uint32* Cast(v8::Value* obj);
2814 static void CheckCast(v8::Value* obj);
3012 * See also v8::Object::HasOwnProperty() and
3013 * v8::Object::HasRealNamedProperty().
3183 * See also v8::Object::Has() and v8::Object::HasRealNamedProperty().
3195 * This function is similar to v8::Object::HasOwnProperty(), but it does not
3200 * `v8::PropertyHandlerFlags::kNonMasking`.
3202 * See also v8::Object::Has().
3560 * const v8::PropertyCallbackInfo<v8::Value>& info) {
3563 * v8::Local<v8::Value> a_this =
3567 * v8::Local<v8::Value> a_holder =
3578 * v8::Local<v8::FunctionTemplate> templ =
3579 * v8::FunctionTemplate::New(isolate);
3581 * v8::NamedPropertyHandlerConfiguration(GetterCallback));
3731 * v8::Undefined.
3845 * v8::PropertyDescriptor d(Local<Value>()), false);
3852 * v8::PropertyDescriptor d(v8::Undefined(isolate));
3855 * v8::PropertyDescriptor d(v8::Undefined(isolate), Local<Value>()));
3973 * A thread-safe allocator that V8 uses to allocate |ArrayBuffer|'s memory.
3974 * The allocator is a global V8 setting. It has to be set via
3977 * Memory allocated through this allocator by V8 is accounted for as external
3978 * memory by V8. Note that V8 keeps track of the memory for all internalized
3984 * Note that it is unsafe to call back into V8 from any of the allocator
4371 * v8::Isolate::CreateParams::array_buffer_allocator.
4428 * v8::Isolate::CreateParams::array_buffer_allocator.
4443 * v8::Isolate::CreateParams::array_buffer_allocator.
4478 * parameters. V8 keeps a cache of various values used for
4583 * RegExp::New(v8::String::New("foo"),
4622 static void CheckCast(v8::Value* obj);
4707 * Like SetNativeDataProperty, but V8 will replace the native data property
4750 * The result is an integer encoding property attributes (like v8::None,
4751 * v8::DontEnum, etc.)
4794 * const v8::PropertyCallbackInfo<v8::Value>& info) {
4798 * v8::Local<v8::FunctionTemplate> templ =
4799 * v8::FunctionTemplate::New(isolate);
4801 * v8::NamedPropertyHandlerConfiguration(GetterCallback));
4809 * v8::Local<v8::Value> result = CompileRun("obj.a = 17; obj.a");
4849 * value is an interger encoding a `v8::PropertyAttribute`.
4928 * can be converted to a PropertyDescriptor, e.g., a `v8::value` returned from
4929 * `v8::Object::getOwnPropertyDescriptor`.
4946 * See `v8::GenericNamedPropertyGetterCallback`.
4953 * See `v8::GenericNamedPropertySetterCallback`.
4961 * See `v8::GenericNamedPropertyQueryCallback`.
4968 * See `v8::GenericNamedPropertyDeleterCallback`.
4975 * See `v8::GenericNamedPropertyEnumeratorCallback`.
4981 * See `v8::GenericNamedPropertyDefinerCallback`.
4988 * See `v8::GenericNamedPropertyDescriptorCallback`.
5038 * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
5039 * t->Set(isolate, "func_property", v8
5041 * v8::Local<v8::Template> proto_t = t->PrototypeTemplate();
5044 * v8::FunctionTemplate::New(isolate, InvokeCallback));
5045 * proto_t->Set(isolate, "proto_const", v8::Number::New(isolate, 2));
5047 * v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate();
5054 * v8::Local<v8::Function> function = t->GetFunction();
5055 * v8::Local<v8::Object> instance = function->NewInstance();
5246 * Configuration flags for v8::NamedPropertyHandlerConfiguration or
5247 * v8::IndexedPropertyHandlerConfiguration.
5694 * If you are using threads then you should hold the V8::Locker lock while
5867 V8_DEPRECATED("Use v8::Exception::CreateMessage(GetValue())->GetStackTrace()",
5898 * is used on Isolate. In this mode every non-primitive call to V8 should be
5992 * in a phase where V8 is trying to collect all available garbage
6010 * Collection of V8 heap information.
6012 * Instances of this class can be passed to v8::V8::HeapStatistics to
6013 * get heap statistics from V8.
6039 friend class V8;
6182 // is provided. V8 will try to avoid JavaScript execution interruptions.
6186 // provided. V8 will try to avoid as many JavaScript execution interruptions
6189 // Idle performance mode: The embedder is idle. V8 can complete deferred work
6192 // Load performance mode: In this mode high throughput is provided. V8 may
6237 * kNone hints V8 that there is no memory pressure.
6238 * kModerate hints V8 to speed up incremental garbage collection at the cost of
6240 * kCritical hints V8 to free memory as soon as possible. Garbage collection
6246 * Interface for tracing through the embedder heap. During a v8 garbage
6247 * collection, v8 collects hidden fields of all potential wrappers, and at the
6268 * Called by v8 to register internal fields of found wrappers.
6354 * Isolate represents an isolated instance of the V8 engine. V8 isolates have
6380 * address of a function that's invoked on entry to every V8-generated
6382 * generated function. Furthermore, if an entry_hook is given, V8 will
6427 * embedder that V8 can match against during serialization and use for
6603 * V8::Initialize() must have run prior to this.
6611 * This method must not be invoked before V8::Initialize() was invoked.
6616 * Custom callback used by embedders to help V8 determine if it should abort
6619 * then V8 will abort if either:
6622 * Otherwise, the custom callback will not be called and V8 will not abort.
6630 * V8 uses these notifications to guide heuristics.
6664 * Discards all V8 thread-specific data for the Isolate. Should be used
6754 * Adjusts the amount of registered external memory. Used to give V8 an
6756 * by JavaScript objects. V8 uses this to decide when to perform global
6808 /** Returns the last context entered through V8's C++ API. */
6812 * Returns either the last context entered through V8's C++ API, or the
6915 * acquired the V8 lock with a Locker object.
6920 * Is V8 terminating JavaScript execution.
6941 * acquired the V8 lock with a Locker object.
6946 * Request V8 to interrupt long running JavaScript code and invoke
7069 * Sets a callback for counting the number of times a feature of V8 is used.
7090 * V8 uses the notification to perform garbage collection.
7093 * until real work has been done. This indicates that V8 has done
7096 * The deadline_in_seconds argument specifies the deadline V8 has to finish
7109 * V8 uses these notifications to attempt to free memory.
7114 * Optional notification that a context has been disposed. V8 uses
7117 * V8 had a chance to clean up.
7126 * V8 uses these notifications to guide heuristics.
7132 * V8 uses these notifications to guide heuristics.
7137 * Optional notification to tell V8 the current performance requirements
7139 * V8 uses these notifications to guide heuristics.
7146 * Optional notification to tell V8 the current isolate is used for debugging
7192 * \note If you are using threads then you should hold the V8::Locker lock
7209 * https://code.google.com/p/v8/issues/detail?id=3598
7237 * Check if V8 is dead and therefore unusable. This is the case after
7278 * Tells V8 to capture current stack trace when uncaught exception occurs
7345 * EntropySource is used as a callback function when v8 needs a source
7351 * ReturnAddressLocationResolver is used as a callback function when v8 is
7370 class V8_EXPORT V8 {
7386 * Check if V8 is dead and therefore unusable. This is the case after
7392 * Hand startup data to V8, in case the embedder has chosen to build
7393 * V8 with external startup data.
7396 * - By default the startup data is linked into the V8 library, in which
7398 * - If this needs to be called, it needs to be called before V8
7400 * - To avoid unnecessary copies of data, V8 will point directly into the
7401 * given data blob, so pretty please keep it around until V8 exit.
7449 * Tells V8 to capture current stack trace when uncaught exception occurs
7459 * Sets V8 flags from a string.
7464 * Sets V8 flags from the command line.
7525 * Initializes V8. This function needs to be called before the first Isolate
7537 * Allows the host application to provide a callback that allows v8 to
7548 * acquired the V8 lock with a Locker object.
7556 * Is V8 terminating JavaScript execution.
7581 * acquired the V8 lock with a Locker object.
7589 * Releases any resources used by v8 and stops any utility threads
7590 * that may be running. Note that disposing v8 is permanent, it
7593 * It should generally not be necessary to dispose v8 before exiting
7595 * to use if the process needs the resources taken up by v8.
7638 * Initialize the ICU library bundled with V8. The embedder should only
7641 * If V8 was compiled with the ICU data in an external file, the location
7649 * Initialize the ICU library bundled with V8. The embedder should only
7650 * invoke this method when using the bundled ICU. If V8 was compiled with
7667 * If V8 was compiled with the startup data in an external file, then
7668 * V8 needs to be given those external files during startup. There are
7683 * Sets the v8::Platform to use. This should be invoked before V8 is
7689 * Clears all references to the v8::Platform. This should be invoked after
7690 * V8 was disposed.
7695 V8();
7833 if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
7882 * Creates a new try/catch block and registers it with v8. Note that
7889 * Creates a new try/catch block and registers it with v8. Note that
7961 Local<v8::Message> Message() const;
8066 * would break VM---v8 expects only global object as a prototype of global
8105 * \param isolate See v8::Context::New.
8108 * deserialize from. Use v8::Context::New for the default snapshot.
8114 * \param extensions See v8::Context::New.
8116 * \param global_object See v8::Context::New.
8177 * The field at kDebugIdIndex is reserved for V8 debugger implementation.
8191 * Gets the binding object used by V8 extras. Extra natives get a reference
8194 * properties added by the embedder using the V8 API.
8227 * V8::AllowCodeGenerationFromStrings callback will be invoked if
8280 * Multiple threads in V8 are allowed, but only one thread at a time is allowed
8281 * to use any given V8 isolate, see the comments in the Isolate class. The
8282 * definition of 'using a V8 isolate' includes accessing handles or holding onto
8283 * object pointers obtained from V8 handles while in the particular V8 isolate.
8284 * It is up to the user of V8 to ensure, perhaps with locking, that this
8286 * mechanism that may be used, the v8::Locker and v8::Unlocker classes must be
8287 * used to signal thread switches to V8.
8289 * v8::Locker is a scoped lock object. While it's active, i.e. between its
8291 * isolate. V8 guarantees that an isolate can be locked by at most one thread at
8292 * any time. In other words, the scope of a v8::Locker is a critical section.
8298 * v8::Locker locker(isolate);
8299 * v8::Isolate::Scope isolate_scope(isolate);
8301 * // Code using V8 and isolate goes here.
8306 * If you wish to stop using V8 in a thread A you can do this either by
8307 * destroying the v8::Locker object as above or by constructing a v8::Unlocker
8313 * v8::Unlocker unlocker(isolate);
8315 * // Code not using V8 goes here while V8 can run in another thread.
8321 * The Unlocker object is intended for use in a long-running callback from V8,
8322 * where you want to release the V8 lock for other threads to use.
8324 * The v8::Locker is a recursive lock, i.e. you can lock more than once in a
8334 * // V8 not locked.
8336 * v8::Locker locker(isolate);
8338 * // V8 locked.
8340 * v8::Locker another_locker(isolate);
8341 * // V8 still locked (2 levels).
8344 * v8::Unlocker unlocker(isolate);
8345 * // V8 not locked.
8348 * // V8 locked again (2 levels).
8350 * // V8 still locked (1 level).
8352 * // V8 Now no longer locked.
8386 * Returns whether v8::Locker is being used by this V8 instance.
8487 * This class exports constants and functionality from within v8 that
8488 * is necessary to implement inline functions in the v8 api. Don't
8494 // the implementation of v8.
8545 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
8546 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
8610 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate,
8618 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate,
8625 V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate,
8639 V8_INLINE static T ReadEmbedderData(const v8::Context* context, int index) {
8680 V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
8686 return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
8692 if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
8701 V8::InternalFieldOutOfBounds(index);
8713 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
8725 this->val_ = reinterpret_cast<T*>(V8::CopyPersistent(p));
8762 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
8794 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
8800 V8::MakeWeak(reinterpret_cast<internal::Object***>(&this->val_));
8807 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
8813 V8::RegisterExternallyReferencedObject(
9166 String* String::Cast(v8::Value* value) {
9344 Boolean* Boolean::Cast(v8::Value* value) {
9352 Name* Name::Cast(v8::Value* value) {
9360 Symbol* Symbol::Cast(v8::Value* value) {
9368 Number* Number::Cast(v8::Value* value) {
9376 Integer* Integer::Cast(v8::Value* value) {
9384 Int32* Int32::Cast(v8::Value* value) {
9392 Uint32* Uint32::Cast(v8::Value* value) {
9400 Date* Date::Cast(v8::Value* value) {
9408 StringObject* StringObject::Cast(v8::Value* value) {
9416 SymbolObject* SymbolObject::Cast(v8::Value* value) {
9424 NumberObject* NumberObject::Cast(v8::Value* value) {
9432 BooleanObject* BooleanObject::Cast(v8::Value* value) {
9440 RegExp* RegExp::Cast(v8::Value* value) {
9448 Object* Object::Cast(v8::Value* value) {
9456 Array* Array::Cast(v8::Value* value) {
9464 Map* Map::Cast(v8::Value* value) {
9472 Set* Set::Cast(v8::Value* value) {
9480 Promise* Promise::Cast(v8::Value* value) {
9488 Proxy* Proxy::Cast(v8::Value* value) {
9495 WasmCompiledModule* WasmCompiledModule::Cast(v8::Value* value) {
9502 Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) {
9510 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) {
9518 ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) {
9526 TypedArray* TypedArray::Cast(v8::Value* value) {
9534 Uint8Array* Uint8Array::Cast(v8::Value* value) {
9542 Int8Array* Int8Array::Cast(v8::Value* value) {
9550 Uint16Array* Uint16Array::Cast(v8::Value* value) {
9558 Int16Array* Int16Array::Cast(v8::Value* value) {
9566 Uint32Array* Uint32Array::Cast(v8::Value* value) {
9574 Int32Array* Int32Array::Cast(v8::Value* value) {
9582 Float32Array* Float32Array::Cast(v8::Value* value) {
9590 Float64Array* Float64Array::Cast(v8::Value* value) {
9598 Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) {
9606 DataView* DataView::Cast(v8::Value* value) {
9614 SharedArrayBuffer* SharedArrayBuffer::Cast(v8::Value* value) {
9622 Function* Function::Cast(v8::Value* value) {
9630 External* External::Cast(v8::Value* value) {
9795 void V8::SetAllowCodeGenerationFromStringsCallback(
9802 bool V8::IsDead() {
9808 bool V8::AddMessageListener(MessageCallback that, Local<Value> data) {
9814 void V8::RemoveMessageListeners(MessageCallback that) {
9820 void V8::SetFailedAccessCheckCallbackFunction(
9827 void V8::SetCaptureStackTraceForUncaughtExceptions(
9835 void V8::SetFatalErrorHandler(FatalErrorCallback callback) {
9840 void V8::RemoveGCPrologueCallback(GCCallback callback) {
9847 void V8::RemoveGCEpilogueCallback(GCCallback callback) {
9853 void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); }
9856 bool V8::IsExecutionTerminating(Isolate* isolate) {
9864 void V8::CancelTerminateExecution(Isolate* isolate) {
9869 void V8::VisitExternalResources(ExternalResourceVisitor* visitor) {
9875 void V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
9881 void V8::VisitHandlesWithClassIds(Isolate* isolate,
9887 void V8::VisitHandlesForPartialDependence(Isolate* isolate,
9904 } // namespace v8