2015-02-04 13:01:34 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef V8_API_NATIVES_H_
|
|
|
|
#define V8_API_NATIVES_H_
|
|
|
|
|
|
|
|
#include "src/handles.h"
|
2015-08-11 12:00:01 +00:00
|
|
|
#include "src/property-details.h"
|
2015-02-04 13:01:34 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2015-08-11 12:00:01 +00:00
|
|
|
// Forward declarations.
|
|
|
|
class ObjectTemplateInfo;
|
|
|
|
class TemplateInfo;
|
|
|
|
|
2015-02-04 13:01:34 +00:00
|
|
|
class ApiNatives {
|
|
|
|
public:
|
2015-03-09 12:26:22 +00:00
|
|
|
static const int kInitialFunctionCacheSize = 256;
|
|
|
|
|
2015-02-04 13:01:34 +00:00
|
|
|
MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
|
|
|
|
Handle<FunctionTemplateInfo> data);
|
2015-02-06 09:44:49 +00:00
|
|
|
|
2015-02-04 13:01:34 +00:00
|
|
|
MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject(
|
2016-05-11 14:21:32 +00:00
|
|
|
Handle<ObjectTemplateInfo> data,
|
|
|
|
Handle<JSReceiver> new_target = Handle<JSReceiver>());
|
2015-02-06 09:44:49 +00:00
|
|
|
|
2016-07-19 12:21:52 +00:00
|
|
|
MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(
|
|
|
|
Handle<ObjectTemplateInfo> data);
|
|
|
|
|
2016-06-27 18:03:59 +00:00
|
|
|
enum ApiInstanceType {
|
|
|
|
JavaScriptObjectType,
|
|
|
|
GlobalObjectType,
|
|
|
|
GlobalProxyType
|
|
|
|
};
|
|
|
|
|
2015-02-04 13:01:34 +00:00
|
|
|
static Handle<JSFunction> CreateApiFunction(Isolate* isolate,
|
|
|
|
Handle<FunctionTemplateInfo> obj,
|
2016-06-27 18:03:59 +00:00
|
|
|
Handle<Object> prototype,
|
|
|
|
ApiInstanceType instance_type);
|
2015-02-06 09:44:49 +00:00
|
|
|
|
|
|
|
static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
|
|
|
Handle<Name> name, Handle<Object> value,
|
|
|
|
PropertyAttributes attributes);
|
|
|
|
|
2015-10-21 20:14:27 +00:00
|
|
|
static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
|
|
|
Handle<Name> name, v8::Intrinsic intrinsic,
|
|
|
|
PropertyAttributes attributes);
|
|
|
|
|
2015-02-06 09:44:49 +00:00
|
|
|
static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
2015-11-10 20:59:58 +00:00
|
|
|
Handle<Name> name,
|
|
|
|
Handle<FunctionTemplateInfo> getter,
|
|
|
|
Handle<FunctionTemplateInfo> setter,
|
2015-02-06 09:44:49 +00:00
|
|
|
PropertyAttributes attributes);
|
|
|
|
|
|
|
|
static void AddNativeDataProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
|
|
|
Handle<AccessorInfo> property);
|
2015-02-04 13:01:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif
|