V8 Project
v8::Private Class Reference

A private symbol. More...

#include <v8.h>

+ Inheritance diagram for v8::Private:
+ Collaboration diagram for v8::Private:

Public Member Functions

Local< ValueName () const
 

Static Public Member Functions

static Local< PrivateNew (Isolate *isolate, Local< String > name=Local< String >())
 
static Local< PrivateForApi (Isolate *isolate, Local< String > name)
 

Private Member Functions

 Private ()
 

Detailed Description

A private symbol.

This is an experimental feature. Use at your own risk.

Definition at line 2136 of file v8.h.

Constructor & Destructor Documentation

◆ Private()

v8::Private::Private ( )
private

Member Function Documentation

◆ ForApi()

Local< Private > v8::Private::ForApi ( Isolate isolate,
Local< String name 
)
static

Definition at line 6247 of file api.cc.

6247  {
6248  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6250  i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry();
6251  i::Handle<i::String> part = i_isolate->factory()->private_api_string();
6252  i::Handle<i::JSObject> privates =
6254  i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
6255  i::Handle<i::Object> symbol =
6256  i::Object::GetPropertyOrElement(privates, i_name).ToHandleChecked();
6257  if (!symbol->IsSymbol()) {
6258  DCHECK(symbol->IsUndefined());
6259  symbol = i_isolate->factory()->NewPrivateSymbol();
6260  i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
6261  i::JSObject::SetProperty(privates, i_name, symbol, i::STRICT).Assert();
6262  }
6263  Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
6264  return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
6265 }
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Handle< JSObject > GetSymbolRegistry()
Definition: isolate.cc:2228
Factory * factory()
Definition: isolate.h:982
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
Definition: objects-inl.h:1124
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
Definition: objects.cc:2798
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
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::Handle< T >::cast(), DCHECK, v8::internal::Isolate::factory(), v8::internal::Object::GetPropertyOrElement(), v8::internal::Isolate::GetSymbolRegistry(), name, v8::Utils::OpenHandle(), v8::internal::Object::SetProperty(), v8::internal::STRICT, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ Name()

Local< Value > v8::Private::Name ( ) const

Definition at line 4939 of file api.cc.

4939  {
4940  return reinterpret_cast<const Symbol*>(this)->Name();
4941 }
Local< Value > Name() const
Definition: api.cc:4939
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol

◆ New()

Local< Private > v8::Private::New ( Isolate isolate,
Local< String name = Local<String>() 
)
static

Definition at line 6236 of file api.cc.

6236  {
6237  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6238  LOG_API(i_isolate, "Private::New()");
6239  ENTER_V8(i_isolate);
6240  i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol();
6241  if (!name.IsEmpty()) symbol->set_name(*Utils::OpenHandle(*name));
6242  Local<Symbol> result = Utils::ToLocal(symbol);
6243  return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
6244 }
#define LOG_API(isolate, expr)
Definition: api.cc:52
#define ENTER_V8(isolate)
Definition: api.cc:54

References ENTER_V8, v8::internal::Isolate::factory(), LOG_API, name, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: