0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-20 05:25:19 +00:00
Commit Graph

512 Commits

Author SHA1 Message Date
Christiaan
b6a923c949 Change the invalid php stub with valid php code that can be used for type hinting 2015-01-01 21:43:26 +01:00
Christiaan
e52e6a3617 Update the Readme
section about the public API with the two new functions setTimeLimit and setMemoryLimit
2015-01-01 21:20:26 +01:00
Stefan Siegl
5b4aaa64f1 More php_v8js_ prefix cleanup 2014-12-13 01:37:25 +01:00
Stefan Siegl
294a5c8d1f php_v8js_create_v8 -> v8js_v8object_create 2014-12-13 01:21:02 +01:00
Stefan Siegl
2954de2db5 Remove php_ prefix to struct & type names 2014-12-13 01:18:42 +01:00
Stefan Siegl
3efec8d428 Remove CVS $Id$ comment lines 2014-12-13 00:45:05 +01:00
Stefan Siegl
d269809d8b Move types from php_v8js_macros.h to new headers 2014-12-13 00:43:19 +01:00
Stefan Siegl
6869d318b3 Rename V8Object stuff to v8js_v8object_XXX 2014-12-13 00:28:09 +01:00
Stefan Siegl
f987cc7b4c Rename php_v8js_objects -> v8js_v8objects
* drop php_ prefix, currently used inconsistently anyways
* change "object" to "v8object" to clarify it's a JS object wrapped
  to a V8Object instance
2014-12-13 00:13:03 +01:00
Stefan Siegl
5ea36016fe code cleanup, part 1
Splits longish v8js.cc file into pieces.  It used to contain the
definitions of all V8Js exception classes, the V8Js class itself as
well as the V8Object/V8Function classes... besides the module setup
code itself.

This change factors out all exception class definitions into a
seperate pair of files (v8js_exceptions.*).

The V8Js class definition itself is moved to v8js_class.* pair,
with the v8 init & call code moved to v8js_v8.* pair
and the watchdog timer to v8js_timer.* pair.

The V8Object/V8Function code was moved to v8js_v8object_class.*
pair, not differentiating between the two like before.
2014-12-13 00:11:02 +01:00
Stefan Siegl
af58f4ec9e Catch serialization of V8Function instances 2014-12-11 22:28:01 +01:00
Stefan Siegl
73d022cca1 Test unserialization with properties 2014-12-11 22:15:38 +01:00
Stefan Siegl
c0d1e2fa6d Catch serialization of V8Object instances 2014-12-11 20:58:53 +01:00
Stefan Siegl
dfb6b1db46 Handle absent isolate in V8Js::__destruct 2014-12-11 19:14:33 +00:00
Stefan Siegl
1386c96d26 Catch serialization of V8Js object, closes #119 2014-12-11 19:30:06 +01:00
Stefan Siegl
0ea210f94e Throw V8JsException if source is not a script 2014-12-11 18:05:37 +01:00
Stefan Siegl
c28c9f50f1 introduce V8JsException class 2014-12-11 18:00:43 +01:00
Stefan Siegl
2b4750748e Merge branch 'array-access'
Conflicts:
	v8js_convert.cc
2014-12-10 20:02:33 +01:00
Stefan Siegl
a7fbe9dde4 Fix path seperator for Windows 2014-12-10 19:46:15 +01:00
Stefan Siegl
603790f3dd Don't redefine default parameter
This compiles fine with gcc, but Visual C++ doesn't support it but
throws C2572 error instead.
See http://msdn.microsoft.com/en-us/library/acahh3ba.aspx
2014-12-10 19:41:59 +01:00
Stefan Siegl
8b89a7b691 increase time limit to start engine 2014-12-10 19:27:04 +01:00
Stefan Siegl
1613570ced Add test on die() call, refs #122 2014-12-10 01:10:30 +01:00
Stefan Siegl
a2a9c30a11 Use zend_try/zend_catch to unwind v8 stack 2014-12-09 23:56:46 +00:00
Simon Best
dbea6fc122 Correct name of memory limit test. 2014-12-09 22:53:06 +01:00
Stefan Siegl
7ac12c4fbd Unwind stack after fatal error in V8Function, closes #130 2014-12-09 22:40:53 +01:00
Stefan Siegl
2252169a98 Use isolate->RequestInterrupt to get heap size 2014-12-09 01:08:16 +01:00
Stefan Siegl
0004626015 Make time limit tests pass more safely 2014-12-09 01:06:46 +01:00
Stefan Siegl
b6fb9acc65 Remove set_memory_limit_002 test
The test is unfortunately unstable as it somehow depends on CPU speed.
v8 seems to precompute the result even so it hasn't reached the for
loop consuming the memory.

This can be proved easily by adding a sleep(1) call at the start of the
prolongTimeLimit function.  Then the memory limit is always tripped
even so v8 didn't have to do much until there
2014-12-07 16:52:10 +01:00
Stefan Siegl
e85b095282 Add test showing that time limits can be prolonged 2014-12-07 16:44:54 +01:00
Stefan Siegl
c17208c9c0 Allow to impose memory & time limits 2014-12-07 16:44:54 +01:00
Stefan Siegl
8945357d76 Allow to change & reset memory limits 2014-12-07 16:44:52 +01:00
Stefan Siegl
daf8788e0f Allow to change & reset time limits 2014-12-07 16:05:58 +01:00
Stefan Siegl
ab6df6f14f Use std::deque for timer_stack
In order to update limits at runtime we need the stack to be iterable.
2014-12-07 15:54:37 +01:00
Stefan Siegl
e617662293 Always push timer on stack to allow updates 2014-12-07 15:49:56 +01:00
Stefan Siegl
2a1ae43496 Use prologues for V8Function calls, closes #129 2014-12-07 15:19:47 +01:00
Stefan Siegl
acd00af78a Refactor v8 call prologue/epilogue into function 2014-12-07 14:08:01 +01:00
Stefan Siegl
3a1f3e5237 Add setMemoryLimit & setTimeLimit setter methods 2014-12-07 13:25:52 +01:00
Stefan Siegl
0023c03280 Use v8::TryCatch if calling V8Function, refs #127 2014-12-01 22:12:22 +01:00
Stefan Siegl
38bc89e10a Once more fix ZTS build 2014-11-30 22:34:24 +00:00
Stefan Siegl
dba4da9b8b Refactor PHP method call code 2014-11-30 23:30:28 +01:00
Stefan Siegl
901268994a Implement isset behaviour on ArrayAccess objects 2014-11-30 22:43:56 +01:00
Stefan Siegl
1b027a525f Implement delete behaviour on ArrayAccess objects 2014-11-30 22:31:27 +01:00
Stefan Siegl
6399b49b3f Improve ArrayAccess enumeration
When enumerating an ArrayAccess-style object the array keys should be
returned, not the method names & properties of the PHP object.
2014-11-30 21:00:42 +01:00
Stefan Siegl
8550dcb5ca Mention array & object mapping 2014-11-30 19:25:08 +01:00
Stefan Siegl
35350f7642 Test __invoke handling on ArrayAccess objects 2014-11-29 21:34:17 +01:00
Stefan Siegl
d21896ab33 Test export of properties on ArrayAccess object
Private & protected properties shouldn't be accessible, also the
length property should not be overwritten by a length property of
the PHP object.
2014-11-29 21:30:44 +01:00
Stefan Siegl
5a11ef2468 Test ArrayAccess prototype method overwriting
If the PHP object implementing ArrayAccess has a method,
that has the same name as one of the Array.prototype methods,
the PHP method shall be called, i.e. overwrite the JS method.
2014-11-29 21:28:21 +01:00
Stefan Siegl
b25960786d Remove count() echo statements
These cause the test to fail on old v8 versions like 3.24.10
since the Array.prototype.push implementation calls count() twice
with that version (causing a second echo-line that makes the
test fail).
2014-11-29 20:23:23 +00:00
Stefan Siegl
27d326a196 Fix ZTS build 2014-11-29 19:49:44 +00:00
Stefan Siegl
2b897e8bc4 Export extra methods on ArrayAccess
This merges the distinct code path for the export of ArrayAccess
capable PHP objects back into the "common" PHP object export code.
Sole difference is that the ArrayAccess-style object has index
property handlers as well as property bridging to Array.prototype.
2014-11-29 20:35:32 +01:00