This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
v8.cc
295 lines (250 loc) · 8.71 KB
/
v8.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
* This file is part of the phpv8/php-v8 PHP extension.
*
* Copyright (c) 2015-2018 Bogdan Padalko <[email protected]>
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source or visit
* http://opensource.org/licenses/MIT
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php_v8.h"
#include "php_v8_a.h"
#include "php_v8_isolate.h"
#include "php_v8_startup_data.h"
#include "php_v8_heap_statistics.h"
#include "php_v8_exceptions.h"
#include "php_v8_exception_manager.h"
#include "php_v8_try_catch.h"
#include "php_v8_message.h"
#include "php_v8_stack_frame.h"
#include "php_v8_stack_trace.h"
#include "php_v8_script_origin.h"
#include "php_v8_script_origin_options.h"
#include "php_v8_context.h"
#include "php_v8_object_template.h"
#include "php_v8_function_template.h"
#include "php_v8_script.h"
#include "php_v8_unbound_script.h"
#include "php_v8_cached_data.h"
#include "php_v8_source.h"
#include "php_v8_script_compiler.h"
#include "php_v8_undefined.h"
#include "php_v8_null.h"
#include "php_v8_boolean.h"
#include "php_v8_symbol.h"
#include "php_v8_string.h"
#include "php_v8_name.h"
#include "php_v8_number.h"
#include "php_v8_integer.h"
#include "php_v8_int32.h"
#include "php_v8_uint32.h"
#include "php_v8_primitive.h"
#include "php_v8_function.h"
#include "php_v8_array.h"
#include "php_v8_map.h"
#include "php_v8_set.h"
#include "php_v8_date.h"
#include "php_v8_regexp.h"
#include "php_v8_proxy.h"
#include "php_v8_promise_resolver.h"
#include "php_v8_promise.h"
#include "php_v8_number_object.h"
#include "php_v8_boolean_object.h"
#include "php_v8_string_object.h"
#include "php_v8_symbol_object.h"
#include "php_v8_object.h"
#include "php_v8_template.h"
#include "php_v8_return_value.h"
#include "php_v8_property_callback_info.h"
#include "php_v8_function_callback_info.h"
#include "php_v8_callback_info_interface.h"
#include "php_v8_named_property_handler_configuration.h"
#include "php_v8_indexed_property_handler_configuration.h"
#include "php_v8_json.h"
#include "php_v8_value.h"
#include "php_v8_data.h"
#include "php_v8_enums.h"
#include "php_v8_ext_mem_interface.h"
#include <v8.h>
extern "C" {
#include "ext/standard/info.h"
};
ZEND_DECLARE_MODULE_GLOBALS(v8)
/* True global resources - no need for thread safety here */
static int le_v8;
/* {{{ PHP_INI
*/
/* Remove comments and fill if you need to have entries in php.ini
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("v8.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_PHP_V8_Globals, PHP_V8_Globals)
STD_PHP_INI_ENTRY("v8.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_PHP_V8_Globals, PHP_V8_Globals)
PHP_INI_END()
*/
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(v8)
{
PHP_MINIT(php_v8_enums)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_exceptions)(INIT_FUNC_ARGS_PASSTHRU); /* Exceptions */
PHP_MINIT(php_v8_ext_mem_interface)(INIT_FUNC_ARGS_PASSTHRU); /* AdjustableExternalMemoryInterface */
PHP_MINIT(php_v8_heap_statistics)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_startup_data)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_isolate)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_context)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_script)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_unbound_script)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_cached_data)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_source)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_script_compiler)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_exception_manger)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_try_catch)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_message)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_stack_frame)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_stack_trace)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_script_origin_options)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_script_origin)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_data)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_value)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_primitive)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_undefined)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_null)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_boolean)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_name)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_string)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_symbol)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_number)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_integer)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_int32)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_uint32)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_object)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_function)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_array)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_map)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_set)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_date)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_regexp)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_promise)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_promise_resolver)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_proxy)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_number_object)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_boolean_object)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_string_object)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_symbol_object)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_template)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_object_template)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_function_template)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_return_value)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_callback_info_interface)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_property_callback_info)(INIT_FUNC_ARGS_PASSTHRU); /* PropertyCallbackInfo inherits CallbackInfo */
PHP_MINIT(php_v8_function_callback_info)(INIT_FUNC_ARGS_PASSTHRU); /* FunctionCallbackInfo inherits CallbackInfo */
PHP_MINIT(php_v8_named_property_handler_configuration)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_indexed_property_handler_configuration)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(php_v8_json)(INIT_FUNC_ARGS_PASSTHRU);
/* If you have INI entries, uncomment these lines
REGISTER_INI_ENTRIES();
*/
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(v8)
{
/* uncomment this line if you have INI entries
UNREGISTER_INI_ENTRIES();
*/
php_v8_shutdown();
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request start */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(v8)
{
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request end */
/* {{{ PHP_RSHUTDOWN_FUNCTION
*/
PHP_RSHUTDOWN_FUNCTION(v8)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(v8)
{
php_info_print_table_start();
php_info_print_table_header(2, "V8 support", "enabled");
php_info_print_table_row(2, "Version", PHP_V8_VERSION);
php_info_print_table_row(2, "Revision", PHP_V8_REVISION);
php_info_print_table_row(2, "Compiled", __DATE__ " @ " __TIME__);
php_info_print_table_end();
php_info_print_table_start();
php_info_print_table_row(2, "V8 Engine Compiled Version", PHP_V8_LIBV8_VERSION);
php_info_print_table_row(2, "V8 Engine Linked Version", v8::V8::GetVersion());
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
DISPLAY_INI_ENTRIES();
*/
}
/* }}} */
/* {{{ PHP_GINIT_FUNCTION
*/
static PHP_GINIT_FUNCTION(v8)
{
#if defined(COMPILE_DL_V8) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
v8_globals->v8_initialized = false;
v8_globals->platform = nullptr;
}
/* }}} */
/* {{{ PHP_GSHUTDOWN_FUNCTION
*/
static PHP_GSHUTDOWN_FUNCTION(v8)
{
}
/* }}} */
/* {{{ php_v8_functions[]
*
* Every user visible function must have an entry in php_v8_functions[].
*/
const zend_function_entry php_v8_functions[] = {
PHP_FE_END /* Must be the last line in php_v8_functions[] */
};
/* }}} */
/* {{{ php_v8_module_entry
*/
zend_module_entry php_v8_module_entry = {
STANDARD_MODULE_HEADER,
"v8",
php_v8_functions,
PHP_MINIT(v8),
PHP_MSHUTDOWN(v8),
PHP_RINIT(v8), /* Replace with NULL if there's nothing to do at request start */
PHP_RSHUTDOWN(v8), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(v8),
PHP_V8_VERSION,
PHP_MODULE_GLOBALS(v8),
PHP_GINIT(v8),
PHP_GSHUTDOWN(v8),
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
#ifdef COMPILE_DL_V8
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(php_v8)
#endif