2014-12-12 22:59:28 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2017-03-11 11:33:49 +00:00
|
|
|
| PHP Version 7 |
|
2014-12-12 22:59:28 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2016-02-28 19:17:56 +00:00
|
|
|
| Copyright (c) 1997-2016 The PHP Group |
|
2014-12-12 22:59:28 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| http://www.opensource.org/licenses/mit-license.php MIT License |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Author: Jani Taskinen <jani.taskinen@iki.fi> |
|
|
|
|
| Author: Patrick Reilly <preilly@php.net> |
|
2016-02-28 19:17:56 +00:00
|
|
|
| Author: Stefan Siegl <stesie@php.net> |
|
2014-12-12 22:59:28 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef V8JS_CLASS_H
|
|
|
|
#define V8JS_CLASS_H
|
|
|
|
|
2014-12-12 23:43:19 +00:00
|
|
|
|
|
|
|
/* Abbreviate long type names */
|
|
|
|
typedef v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > v8js_tmpl_t;
|
|
|
|
typedef v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > v8js_persistent_obj_t;
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
struct v8js_v8object;
|
2014-12-13 00:15:29 +00:00
|
|
|
struct v8js_accessor_ctx;
|
2015-08-02 21:35:47 +00:00
|
|
|
struct _v8js_script;
|
2014-12-12 23:43:19 +00:00
|
|
|
|
2015-08-01 15:49:11 +00:00
|
|
|
struct cmp_str {
|
|
|
|
bool operator()(char const *a, char const *b) const {
|
|
|
|
return strcmp(a, b) < 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-12-12 23:43:19 +00:00
|
|
|
/* {{{ Context container */
|
2014-12-13 00:15:29 +00:00
|
|
|
struct v8js_ctx {
|
2014-12-12 23:43:19 +00:00
|
|
|
v8::Persistent<v8::String> object_name;
|
|
|
|
v8::Persistent<v8::Context> context;
|
|
|
|
zend_bool report_uncaught;
|
2015-08-24 20:05:27 +00:00
|
|
|
zval pending_exception;
|
2014-12-12 23:43:19 +00:00
|
|
|
int in_execution;
|
|
|
|
v8::Isolate *isolate;
|
|
|
|
|
2015-08-21 14:12:12 +00:00
|
|
|
long flags;
|
|
|
|
|
2014-12-12 23:43:19 +00:00
|
|
|
long time_limit;
|
|
|
|
bool time_limit_hit;
|
|
|
|
long memory_limit;
|
|
|
|
bool memory_limit_hit;
|
2016-03-08 08:28:16 +00:00
|
|
|
long average_object_size;
|
2014-12-12 23:43:19 +00:00
|
|
|
|
2015-09-01 13:53:21 +00:00
|
|
|
v8js_tmpl_t global_template;
|
|
|
|
v8js_tmpl_t array_tmpl;
|
2014-12-12 23:43:19 +00:00
|
|
|
|
2015-12-31 19:25:24 +00:00
|
|
|
zval module_normaliser;
|
2015-08-24 20:05:27 +00:00
|
|
|
zval module_loader;
|
2015-12-31 19:25:24 +00:00
|
|
|
|
2014-12-12 23:43:19 +00:00
|
|
|
std::vector<char *> modules_stack;
|
|
|
|
std::vector<char *> modules_base;
|
2015-08-01 15:49:11 +00:00
|
|
|
std::map<char *, v8js_persistent_obj_t, cmp_str> modules_loaded;
|
2015-08-29 09:57:53 +00:00
|
|
|
std::map<const zend_string *,v8js_tmpl_t> template_cache;
|
2014-12-12 23:43:19 +00:00
|
|
|
|
2015-08-24 20:05:27 +00:00
|
|
|
std::map<zend_object *, v8js_persistent_obj_t> weak_objects;
|
2014-12-12 23:43:19 +00:00
|
|
|
std::map<v8js_tmpl_t *, v8js_persistent_obj_t> weak_closures;
|
2015-08-27 12:46:27 +00:00
|
|
|
std::map<v8js_tmpl_t *, v8js_tmpl_t> call_impls;
|
|
|
|
std::map<zend_function *, v8js_tmpl_t> method_tmpls;
|
2014-12-12 23:43:19 +00:00
|
|
|
|
|
|
|
std::list<v8js_v8object *> v8js_v8objects;
|
|
|
|
|
2014-12-13 00:15:29 +00:00
|
|
|
std::vector<v8js_accessor_ctx *> accessor_list;
|
2015-08-02 21:35:47 +00:00
|
|
|
std::vector<struct _v8js_script *> script_objects;
|
2014-12-12 23:43:19 +00:00
|
|
|
char *tz;
|
2016-02-28 16:00:47 +00:00
|
|
|
|
|
|
|
v8::Isolate::CreateParams create_params;
|
2016-03-05 21:21:42 +00:00
|
|
|
zval zval_snapshot_blob;
|
2016-02-28 16:00:47 +00:00
|
|
|
v8::StartupData snapshot_blob;
|
2016-02-28 19:17:56 +00:00
|
|
|
|
2015-08-24 20:19:15 +00:00
|
|
|
zend_object std;
|
2014-12-12 23:43:19 +00:00
|
|
|
};
|
|
|
|
/* }}} */
|
|
|
|
|
2015-08-24 22:24:04 +00:00
|
|
|
static inline struct v8js_ctx *v8js_ctx_fetch_object(zend_object *obj) {
|
|
|
|
return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std));
|
|
|
|
}
|
|
|
|
|
|
|
|
#define Z_V8JS_CTX_OBJ_P(zv) v8js_ctx_fetch_object(Z_OBJ_P(zv));
|
|
|
|
|
2014-12-12 23:43:19 +00:00
|
|
|
|
2014-12-12 22:59:28 +00:00
|
|
|
PHP_MINIT_FUNCTION(v8js_class);
|
|
|
|
|
|
|
|
#endif /* V8JS_CLASS_H */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
2016-07-02 20:41:01 +00:00
|
|
|
* indent-tabs-mode: t
|
2014-12-12 22:59:28 +00:00
|
|
|
* End:
|
|
|
|
* vim600: noet sw=4 ts=4 fdm=marker
|
|
|
|
* vim<600: noet sw=4 ts=4
|
|
|
|
*/
|