C. Scott Ananian
879d1d54a2
Fix memory leak in zend_read_property; also pass correct scope object.
2013-10-27 02:49:24 -04:00
C. Scott Ananian
1c3a919ae8
Don't leak if PHP constructor is called from JavaScript.
...
Register the weak reference callback to deref and do memory limit
accounting for wrapped PHP objects created from within JavaScript.
2013-10-27 02:49:23 -04:00
C. Scott Ananian
39cc821f91
Store tsrm_ls in php_v8js_ctx.
...
This avoids the need to ever do a (slow) TSRMLS_FETCH().
2013-10-26 02:07:12 -04:00
C. Scott Ananian
011e517cfe
Fix ZTS errors in v8js_convert.cc.
2013-10-26 02:07:00 -04:00
C. Scott Ananian
303f3f52b5
Refactor template cache into php_v8js_ctx.
...
Reduce map lookups by adding internal object field pointing to function
template. Use hidden field to allow easy unwrapping of PHP objects.
2013-10-25 17:40:51 -04:00
C. Scott Ananian
c341511b36
PHP 5.3 compatibility fixes.
2013-10-25 17:40:51 -04:00
C. Scott Ananian
f6a6d1e4b5
Rework JavaScript wrapper for PHP objects.
...
Use the NamedPropertyHandler feature of v8 to wrap accesses to PHP properties
and methods from JavaScript. This enables us to support property
set/delete/query.
The `in` and `delete` operators in JavaScript work like the `isset()` and
`unset()` functions in PHP. In particular, a PHP property with a null
value will not be `in` the JavaScript object. (This holds when enumerating
all properties of an object as well.)
Because JavaScript has a single namespace for both properties and methods,
we allow the use of the `__call` method on a PHP object (even if the
PHP class does not natively define the `__call` magic function) in order
to unambiguously invoke a method. Similarly, you can prefix a property
name with `$` to unambiguously access the property. (When enumerating all
properties, properties are `$`-prefixed in order to ensure they are not
conflated with method names.)
2013-10-25 16:47:15 -04:00
C. Scott Ananian
52d8946b89
Add isolate parameter to V8JS_* macros.
...
This avoids unnecessary calls to Isolate::GetCurrent() in the implementation.
By standardizing on the V8JS_SYM and V8JS_STR macros we also standardize on
UTF-8 encoding for v8 strings.
2013-10-25 16:46:07 -04:00
C. Scott Ananian
2516e76ff8
Unwrap PHP objects when passing them back from JavaScript to PHP.
2013-10-25 14:17:40 -04:00
Stefan Siegl
bd9483080d
Don't re-wrap PHP objects from V8 to V8Object
2013-10-21 20:00:58 +02:00
Stefan Siegl
61eee4cbd6
TSRM/ZTS fixes.
2013-10-19 23:04:35 +00:00
Stefan Siegl
3f049d3b91
Unlock isolate on JS->PHP transition.
2013-10-13 11:36:57 +02:00
C. Scott Ananian
f85675f169
Make JavaScript function wrappers typesafe.
...
Use the v8::Signature parameter to FunctionTemplate::New to guarantee that
the info->Holder() is of the proper type when `php_v8js_php_callback` is
invoked.
Add test case demonstrating the segfault (which is now prevented).
2013-10-11 23:28:21 -04:00
Stefan Siegl
988691d2dc
Fix CopyablePersistentTraits for v8 3.21.15 .. 3.21.18.x
2013-10-04 00:05:11 +02:00
Stefan Siegl
386465570d
Use v8's CopyablePersistentTraits for v8 >= 3.22.0
2013-10-03 16:27:41 +02:00
Stefan Siegl
619231913c
Adapt to new v8::Persistent API, support V8 >= 3.21.12
2013-10-03 16:27:04 +02:00
Stefan Siegl
662e491e1f
Pass back v8 functions, don't re-wrap
2013-10-03 00:34:50 +02:00
Stefan Siegl
bc82d13658
Add isolate to key of template cache.
2013-10-02 23:38:26 +02:00
Patrick Reilly
dc1475a3ad
updated package for beta release and switch license to MIT
2013-09-28 10:17:33 -07:00
Stefan Siegl
286b0d8ac0
Handle non-construct call
2013-07-12 20:23:12 +02:00
Stefan Siegl
5987d5d3da
Throw exception if __construct is not public
2013-07-12 20:23:12 +02:00
Stefan Siegl
49be9aafa1
Call __construct function, if available.
2013-07-12 20:23:12 +02:00
Stefan Siegl
765666ae65
Add constructor call callback and create PHP objects as needed.
2013-07-12 20:23:12 +02:00
Patrick Reilly
347442c471
Merge pull request #17 from stesie/fix-object-creation-leak-master
...
v8js leaks memory if objects are returned to javascript (fix)
2013-07-11 14:22:20 -07:00
Stefan Siegl
ffa42cdfaf
Replaced deprecated v8 api calls with newer equivalents
2013-07-08 00:58:19 +02:00
Stefan Siegl
ee659bdf41
Correctly attach hidden values to objects from cached templates.
2013-06-12 17:29:00 +02:00
Stefan Siegl
bc1cf7c5bb
Use weak persistent handles and DELREF zval.
2013-06-12 17:26:36 +02:00
Stefan Siegl
90ed152f40
Cache and re-use v8::FunctionTemplate on object wrapping
2013-06-12 17:07:48 +02:00
Patrick Reilly
6f44220328
fix merge conflict
2013-05-09 15:55:30 -07:00
Patrick Reilly
ec8444cfda
Use the Z_ADDREF_P macro to increasing the refcount of PHP values assigned to V8
2013-05-09 15:43:27 -07:00
Patrick Reilly
de2d78a144
Always increase the zval reference count before storing it in a V8 internal field
2013-05-09 15:38:37 -07:00
Patrick Reilly
edb8609cfe
Fix for https://github.com/preillyme/v8js/issues/6 . This is probably …
...
… horrible hack but it works for now until we have a better solution.
2013-05-09 15:34:25 -07:00
Simon Best
8d8c671aa0
V8 isolates need to be passed into all variable accessor and conversion functions.
2013-04-14 00:36:05 +01:00
Simon Best
79444ce76a
Use the Z_ADDREF_P macro to increasing the refcount of PHP values assigned to V8.
2013-03-24 16:30:57 +00:00
Simon Best
a23ecda69f
Always increase the zval reference count before storing it in a V8 internal field.
2013-03-22 14:46:52 +00:00
Simon Best
06527cf1d9
Fix for https://github.com/preillyme/v8js/issues/6 . This is probably a horrible hack but it works for now until we have a better solution.
2013-03-20 17:09:23 +00:00
Chris Johnson
b89f085888
Replaced deprecated v8 functions with newer equivalents
2013-03-17 20:46:03 -07:00
Patrick Reilly
dfbd5f0c0c
Fixed build in 5.4+
2012-07-06 17:12:53 -07:00
Dylan Arnold
157fe13c0e
Fixes to build in PHP 5.4.3
2012-05-10 22:47:39 +12:00
Patrick Reilly
7593cbcc59
Update copyright information
2012-04-27 16:41:32 +00:00
preilly
30e1d22863
Initial import
2012-04-27 16:26:15 +00:00