mirror of
https://github.com/phpv8/v8js.git
synced 2025-01-03 15:41:55 +00:00
conditionally compile in snapshot functionality
This commit is contained in:
parent
39062b4248
commit
2c8ef2aa66
@ -207,9 +207,11 @@ static void v8js_free_storage(void *object TSRMLS_DC) /* {{{ */
|
|||||||
c->modules_stack.~vector();
|
c->modules_stack.~vector();
|
||||||
c->modules_base.~vector();
|
c->modules_base.~vector();
|
||||||
|
|
||||||
|
#ifdef PHP_V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
if (c->snapshot_blob.data) {
|
if (c->snapshot_blob.data) {
|
||||||
efree((void*)c->snapshot_blob.data);
|
efree((void*)c->snapshot_blob.data);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
efree(object);
|
efree(object);
|
||||||
}
|
}
|
||||||
@ -368,14 +370,16 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
c->create_params.array_buffer_allocator = &array_buffer_allocator;
|
c->create_params.array_buffer_allocator = &array_buffer_allocator;
|
||||||
|
|
||||||
new (&c->snapshot_blob) v8::StartupData();
|
new (&c->snapshot_blob) v8::StartupData();
|
||||||
|
#ifdef PHP_V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
if (snapshot_blob && snapshot_blob_len) {
|
if (snapshot_blob && snapshot_blob_len) {
|
||||||
c->snapshot_blob.data = snapshot_blob;
|
c->snapshot_blob.data = snapshot_blob;
|
||||||
c->snapshot_blob.raw_size = snapshot_blob_len;
|
c->snapshot_blob.raw_size = snapshot_blob_len;
|
||||||
c->create_params.snapshot_blob = &c->snapshot_blob;
|
c->create_params.snapshot_blob = &c->snapshot_blob;
|
||||||
}
|
}
|
||||||
|
#endif /* PHP_V8_USE_EXTERNAL_STARTUP_DATA */
|
||||||
|
|
||||||
c->isolate = v8::Isolate::New(c->create_params);
|
c->isolate = v8::Isolate::New(c->create_params);
|
||||||
#else
|
#else /* PHP_V8_API_VERSION < 4004044 */
|
||||||
c->isolate = v8::Isolate::New();
|
c->isolate = v8::Isolate::New();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1077,6 +1081,7 @@ static PHP_METHOD(V8Js, getExtensions)
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
#ifdef PHP_V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
/* {{{ proto string|bool V8Js::createSnapshot(string embed_source)
|
/* {{{ proto string|bool V8Js::createSnapshot(string embed_source)
|
||||||
*/
|
*/
|
||||||
static PHP_METHOD(V8Js, createSnapshot)
|
static PHP_METHOD(V8Js, createSnapshot)
|
||||||
@ -1107,6 +1112,8 @@ static PHP_METHOD(V8Js, createSnapshot)
|
|||||||
delete[] snapshot_blob.data;
|
delete[] snapshot_blob.data;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
#endif /* PHP_V8_USE_EXTERNAL_STARTUP_DATA */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ arginfo */
|
/* {{{ arginfo */
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_construct, 0, 0, 0)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_construct, 0, 0, 0)
|
||||||
@ -1171,9 +1178,11 @@ ZEND_END_ARG_INFO()
|
|||||||
ZEND_BEGIN_ARG_INFO(arginfo_v8js_getextensions, 0)
|
ZEND_BEGIN_ARG_INFO(arginfo_v8js_getextensions, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
#ifdef PHP_V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_createsnapshot, 0, 0, 1)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_createsnapshot, 0, 0, 1)
|
||||||
ZEND_ARG_INFO(0, script)
|
ZEND_ARG_INFO(0, script)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
#endif
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_settimelimit, 0, 0, 1)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_settimelimit, 0, 0, 1)
|
||||||
ZEND_ARG_INFO(0, time_limit)
|
ZEND_ARG_INFO(0, time_limit)
|
||||||
@ -1196,11 +1205,13 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
|
|||||||
PHP_ME(V8Js, clearPendingException, arginfo_v8js_clearpendingexception, ZEND_ACC_PUBLIC)
|
PHP_ME(V8Js, clearPendingException, arginfo_v8js_clearpendingexception, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(V8Js, setModuleNormaliser, arginfo_v8js_setmodulenormaliser, ZEND_ACC_PUBLIC)
|
PHP_ME(V8Js, setModuleNormaliser, arginfo_v8js_setmodulenormaliser, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(V8Js, setModuleLoader, arginfo_v8js_setmoduleloader, ZEND_ACC_PUBLIC)
|
PHP_ME(V8Js, setModuleLoader, arginfo_v8js_setmoduleloader, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
|
||||||
PHP_ME(V8Js, getExtensions, arginfo_v8js_getextensions, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
|
||||||
PHP_ME(V8Js, createSnapshot, arginfo_v8js_createsnapshot, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
|
||||||
PHP_ME(V8Js, setTimeLimit, arginfo_v8js_settimelimit, ZEND_ACC_PUBLIC)
|
PHP_ME(V8Js, setTimeLimit, arginfo_v8js_settimelimit, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(V8Js, setMemoryLimit, arginfo_v8js_setmemorylimit, ZEND_ACC_PUBLIC)
|
PHP_ME(V8Js, setMemoryLimit, arginfo_v8js_setmemorylimit, ZEND_ACC_PUBLIC)
|
||||||
|
PHP_ME(V8Js, registerExtension, arginfo_v8js_registerextension, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||||
|
PHP_ME(V8Js, getExtensions, arginfo_v8js_getextensions, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||||
|
#ifdef PHP_V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
|
PHP_ME(V8Js, createSnapshot, arginfo_v8js_createsnapshot, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||||
|
#endif
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
Loading…
Reference in New Issue
Block a user