11cb0ef41Sopenharmony_ci// Copyright 2015 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_API_API_NATIVES_H_
61cb0ef41Sopenharmony_ci#define V8_API_API_NATIVES_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "include/v8-template.h"
91cb0ef41Sopenharmony_ci#include "src/base/macros.h"
101cb0ef41Sopenharmony_ci#include "src/handles/handles.h"
111cb0ef41Sopenharmony_ci#include "src/handles/maybe-handles.h"
121cb0ef41Sopenharmony_ci#include "src/objects/objects.h"
131cb0ef41Sopenharmony_ci#include "src/objects/property-details.h"
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_cinamespace v8 {
161cb0ef41Sopenharmony_cinamespace internal {
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci// Forward declarations.
191cb0ef41Sopenharmony_cienum InstanceType : uint16_t;
201cb0ef41Sopenharmony_ciclass ObjectTemplateInfo;
211cb0ef41Sopenharmony_ciclass TemplateInfo;
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ciclass ApiNatives {
241cb0ef41Sopenharmony_ci public:
251cb0ef41Sopenharmony_ci  static const int kInitialFunctionCacheSize = 256;
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
281cb0ef41Sopenharmony_ci      Isolate* isolate, Handle<NativeContext> native_context,
291cb0ef41Sopenharmony_ci      Handle<FunctionTemplateInfo> data,
301cb0ef41Sopenharmony_ci      MaybeHandle<Name> maybe_name = MaybeHandle<Name>());
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
331cb0ef41Sopenharmony_ci      Handle<FunctionTemplateInfo> data,
341cb0ef41Sopenharmony_ci      MaybeHandle<Name> maybe_name = MaybeHandle<Name>());
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateObject(
371cb0ef41Sopenharmony_ci      Isolate* isolate, Handle<ObjectTemplateInfo> data,
381cb0ef41Sopenharmony_ci      Handle<JSReceiver> new_target = Handle<JSReceiver>());
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(
411cb0ef41Sopenharmony_ci      Handle<ObjectTemplateInfo> data);
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci  static Handle<JSFunction> CreateApiFunction(
441cb0ef41Sopenharmony_ci      Isolate* isolate, Handle<NativeContext> native_context,
451cb0ef41Sopenharmony_ci      Handle<FunctionTemplateInfo> obj, Handle<Object> prototype,
461cb0ef41Sopenharmony_ci      InstanceType type, MaybeHandle<Name> name = MaybeHandle<Name>());
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci  static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
491cb0ef41Sopenharmony_ci                              Handle<Name> name, Handle<Object> value,
501cb0ef41Sopenharmony_ci                              PropertyAttributes attributes);
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci  static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
531cb0ef41Sopenharmony_ci                              Handle<Name> name, v8::Intrinsic intrinsic,
541cb0ef41Sopenharmony_ci                              PropertyAttributes attributes);
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci  static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info,
571cb0ef41Sopenharmony_ci                                  Handle<Name> name,
581cb0ef41Sopenharmony_ci                                  Handle<FunctionTemplateInfo> getter,
591cb0ef41Sopenharmony_ci                                  Handle<FunctionTemplateInfo> setter,
601cb0ef41Sopenharmony_ci                                  PropertyAttributes attributes);
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci  static void AddNativeDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
631cb0ef41Sopenharmony_ci                                    Handle<AccessorInfo> property);
641cb0ef41Sopenharmony_ci};
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ci}  // namespace internal
671cb0ef41Sopenharmony_ci}  // namespace v8
681cb0ef41Sopenharmony_ci
691cb0ef41Sopenharmony_ci#endif  // V8_API_API_NATIVES_H_
70