v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
api-natives.h
Go to the documentation of this file.
1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_API_API_NATIVES_H_
6#define V8_API_API_NATIVES_H_
7
11#include "src/objects/objects.h"
13
14namespace v8 {
15namespace internal {
16
17// Forward declarations.
19class ObjectTemplateInfo;
20class TemplateInfo;
21
23 public:
24 static const int kInitialFunctionCacheSize = 256;
25
26 // A convenient internal wrapper around FunctionTemplate::New() for creating
27 // getter/setter callback function templates.
29 Isolate* isolate, FunctionCallback callback, int length,
30 v8::SideEffectType side_effect_type);
31
35 MaybeDirectHandle<Name> maybe_name = {});
36
39 MaybeDirectHandle<Name> maybe_name = {});
40
41 V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateObject(
42 Isolate* isolate, DirectHandle<ObjectTemplateInfo> data,
43 DirectHandle<JSReceiver> new_target = {});
44
45 V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(
46 DirectHandle<ObjectTemplateInfo> data);
47
49 Isolate* isolate, DirectHandle<NativeContext> native_context,
50 DirectHandle<FunctionTemplateInfo> obj, DirectHandle<Object> prototype,
51 InstanceType type, MaybeDirectHandle<Name> name = {});
52
53 static void AddDataProperty(Isolate* isolate,
54 DirectHandle<TemplateInfoWithProperties> info,
55 DirectHandle<Name> name,
56 DirectHandle<Object> value,
57 PropertyAttributes attributes);
58
59 static void AddDataProperty(Isolate* isolate,
60 DirectHandle<TemplateInfoWithProperties> info,
61 DirectHandle<Name> name, v8::Intrinsic intrinsic,
62 PropertyAttributes attributes);
63
64 static void AddAccessorProperty(Isolate* isolate,
65 DirectHandle<TemplateInfoWithProperties> info,
66 DirectHandle<Name> name,
67 DirectHandle<FunctionTemplateInfo> getter,
68 DirectHandle<FunctionTemplateInfo> setter,
69 PropertyAttributes attributes);
70
71 static void AddNativeDataProperty(
72 Isolate* isolate, DirectHandle<TemplateInfoWithProperties> info,
73 DirectHandle<AccessorInfo> property);
74};
75
76} // namespace internal
77} // namespace v8
78
79#endif // V8_API_API_NATIVES_H_
PropertyT * getter
static void AddDataProperty(Isolate *isolate, DirectHandle< TemplateInfoWithProperties > info, DirectHandle< Name > name, DirectHandle< Object > value, PropertyAttributes attributes)
static DirectHandle< FunctionTemplateInfo > CreateAccessorFunctionTemplateInfo(Isolate *isolate, FunctionCallback callback, int length, v8::SideEffectType side_effect_type)
static Handle< JSFunction > CreateApiFunction(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< FunctionTemplateInfo > obj, DirectHandle< Object > prototype, InstanceType type, MaybeDirectHandle< Name > name={})
static V8_WARN_UNUSED_RESULT MaybeHandle< JSObject > InstantiateRemoteObject(DirectHandle< ObjectTemplateInfo > data)
static V8_WARN_UNUSED_RESULT MaybeHandle< JSFunction > InstantiateFunction(Isolate *isolate, DirectHandle< NativeContext > native_context, DirectHandle< FunctionTemplateInfo > data, MaybeDirectHandle< Name > maybe_name={})
static V8_WARN_UNUSED_RESULT MaybeHandle< JSObject > InstantiateObject(Isolate *isolate, DirectHandle< ObjectTemplateInfo > data, DirectHandle< JSReceiver > new_target={})
static const int kInitialFunctionCacheSize
Definition api-natives.h:24
static void AddAccessorProperty(Isolate *isolate, DirectHandle< TemplateInfoWithProperties > info, DirectHandle< Name > name, DirectHandle< FunctionTemplateInfo > getter, DirectHandle< FunctionTemplateInfo > setter, PropertyAttributes attributes)
static void AddNativeDataProperty(Isolate *isolate, DirectHandle< TemplateInfoWithProperties > info, DirectHandle< AccessorInfo > property)
DirectHandle< Object > new_target
Definition execution.cc:75
TNode< Object > callback
unsigned short uint16_t
Definition unicode.cc:39
!IsContextMap !IsContextMap native_context
Definition map-inl.h:877
Local< T > Handle
SideEffectType
Definition v8-object.h:198
Intrinsic
Definition v8-template.h:41
void(*)(const FunctionCallbackInfo< Value > &info) FunctionCallback
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671