OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_API_NATIVES_H_ | 5 #ifndef V8_API_NATIVES_H_ |
6 #define V8_API_NATIVES_H_ | 6 #define V8_API_NATIVES_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/objects.h" |
9 #include "src/property-details.h" | 10 #include "src/property-details.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
15 class ObjectTemplateInfo; | 16 class ObjectTemplateInfo; |
16 class TemplateInfo; | 17 class TemplateInfo; |
17 | 18 |
18 class ApiNatives { | 19 class ApiNatives { |
19 public: | 20 public: |
20 static const int kInitialFunctionCacheSize = 256; | 21 static const int kInitialFunctionCacheSize = 256; |
21 | 22 |
22 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction( | 23 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction( |
23 Handle<FunctionTemplateInfo> data); | 24 Handle<FunctionTemplateInfo> data); |
24 | 25 |
25 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject( | 26 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject( |
26 Handle<ObjectTemplateInfo> data, | 27 Handle<ObjectTemplateInfo> data, |
27 Handle<JSReceiver> new_target = Handle<JSReceiver>()); | 28 Handle<JSReceiver> new_target = Handle<JSReceiver>()); |
28 | 29 |
29 enum ApiInstanceType { | |
30 JavaScriptObjectType, | |
31 GlobalObjectType, | |
32 GlobalProxyType | |
33 }; | |
34 | |
35 static Handle<JSFunction> CreateApiFunction(Isolate* isolate, | 30 static Handle<JSFunction> CreateApiFunction(Isolate* isolate, |
36 Handle<FunctionTemplateInfo> obj, | 31 Handle<FunctionTemplateInfo> obj, |
37 Handle<Object> prototype, | 32 InstanceType type); |
38 ApiInstanceType instance_type); | |
39 | 33 |
40 static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info, | 34 static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info, |
41 Handle<Name> name, Handle<Object> value, | 35 Handle<Name> name, Handle<Object> value, |
42 PropertyAttributes attributes); | 36 PropertyAttributes attributes); |
43 | 37 |
44 static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info, | 38 static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info, |
45 Handle<Name> name, v8::Intrinsic intrinsic, | 39 Handle<Name> name, v8::Intrinsic intrinsic, |
46 PropertyAttributes attributes); | 40 PropertyAttributes attributes); |
47 | 41 |
48 static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info, | 42 static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info, |
49 Handle<Name> name, | 43 Handle<Name> name, |
50 Handle<FunctionTemplateInfo> getter, | 44 Handle<FunctionTemplateInfo> getter, |
51 Handle<FunctionTemplateInfo> setter, | 45 Handle<FunctionTemplateInfo> setter, |
52 PropertyAttributes attributes); | 46 PropertyAttributes attributes); |
53 | 47 |
54 static void AddNativeDataProperty(Isolate* isolate, Handle<TemplateInfo> info, | 48 static void AddNativeDataProperty(Isolate* isolate, Handle<TemplateInfo> info, |
55 Handle<AccessorInfo> property); | 49 Handle<AccessorInfo> property); |
56 }; | 50 }; |
57 | 51 |
58 } // namespace internal | 52 } // namespace internal |
59 } // namespace v8 | 53 } // namespace v8 |
60 | 54 |
61 #endif | 55 #endif |
OLD | NEW |