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(
|
|
|
|
Handle<ObjectTemplateInfo> data);
|
2015-02-06 09:44:49 +00:00
|
|
|
|
2015-02-04 13:01:34 +00:00
|
|
|
MUST_USE_RESULT static MaybeHandle<FunctionTemplateInfo> ConfigureInstance(
|
|
|
|
Isolate* isolate, Handle<FunctionTemplateInfo> instance,
|
|
|
|
Handle<JSObject> data);
|
|
|
|
|
|
|
|
enum ApiInstanceType {
|
|
|
|
JavaScriptObjectType,
|
|
|
|
GlobalObjectType,
|
|
|
|
GlobalProxyType
|
|
|
|
};
|
|
|
|
|
|
|
|
static Handle<JSFunction> CreateApiFunction(Isolate* isolate,
|
|
|
|
Handle<FunctionTemplateInfo> obj,
|
|
|
|
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);
|
|
|
|
|
|
|
|
static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info,
|
2015-09-29 11:15:59 +00:00
|
|
|
Handle<Name> name, Handle<Object> getter,
|
|
|
|
Handle<Object> 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
|