Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit f3c1af8

Browse files
Merge pull request #20 from pinepain/add-harmony-modules-support
Add missed features, cleanup
2 parents 78cd420 + 2bb166f commit f3c1af8

File tree

131 files changed

+3473
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+3473
-589
lines changed

‎.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ env:
1717
- NO_INTERACTION=1
1818
- TEST_TIMEOUT=120
1919
matrix:
20-
- V8=5.7
21-
- V8=5.7 TEST_PHP_ARGS=-m
20+
- V8=5.8
21+
- V8=5.8 TEST_PHP_ARGS=-m
2222

2323
before_install:
2424
- sudo add-apt-repository ppa:pinepain/libv8-${V8} -y

‎CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project(php_v8)
33

44
# NOTE: This CMake file is just for syntax highlighting in CLion
55

6-
include_directories(/usr/local/opt/v8@5.7/include)
7-
include_directories(/usr/local/opt/v8@5.7/include/libplatform)
6+
include_directories(/usr/local/opt/v8@5.8/include)
7+
include_directories(/usr/local/opt/v8@5.8/include/libplatform)
88

99
include_directories(/usr/local/include/php)
1010
include_directories(/usr/local/include/php/TSRM)

‎README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ in your IDE and other code-analysis tools.
7373
### Requirements
7474

7575
#### V8
76-
You will need a recent v8 Google JavaScript engine version installed. At this time the extension is tested on 5.7.514.
76+
You will need a recent v8 Google JavaScript engine version installed. At this time the extension is tested on 5.8.168.
7777

7878
#### PHP
7979
This extension is PHP7-only. It works and tested with both PHP 7.0 and PHP 7.1.
@@ -96,7 +96,7 @@ $ php --ri v8
9696

9797
While [pinepain/php](https://launchpad.net/~pinepain/+archive/ubuntu/php) PPA targets to contain all necessary
9898
extensions with dependencies, you may find
99-
[pinepain/libv8-5.7](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-5.7),
99+
[pinepain/libv8-5.8](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-5.8),
100100
[pinepain/libv8-experimental](https://launchpad.net/~pinepain/+archive/ubuntu/libv8-experimental) and
101101
[pinepain/php-v8](https://launchpad.net/~pinepain/+archive/ubuntu/php-v8) standalone PPAs useful.
102102

@@ -108,7 +108,7 @@ $ brew tap homebrew/dupes
108108
$ brew tap homebrew/php
109109
$ brew tap pinepain/devtools
110110
$ brew install php70
111-
$ brew install v8@5.7
111+
$ brew install v8@5.8
112112
$ brew install php70-v8
113113
$ php --ri v8
114114
```
@@ -134,6 +134,7 @@ $ sudo make install
134134
- to be able to customize some tests make sure you have `variables_order = "EGPCS"` in your php.ini
135135
- `export DEV_TESTS=1` allows to run tests that are made for development reasons (e.g. test some weird behavior or for debugging)
136136
- To prevent the test suite from asking you to send results to the PHP QA team do `export NO_INTERACTION=1`
137+
- To run tests with memory leaaks check, install `valgrind` and do `export TEST_PHP_ARGS="-m"`
137138

138139
- To track memory usage you may want to use `smem`, `pmem` or even `lsof` to see what shared object are loaded
139140
and `free` to display free and used memory in the system.

‎config.m4

Lines changed: 52 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if test "$PHP_V8" != "no"; then
88
SEARCH_PATH="/usr/local /usr"
99
SEARCH_FOR="include/v8.h"
1010

11-
V8_MIN_API_VERSION_STR=5.7.514
11+
V8_MIN_API_VERSION_STR=5.8.168
1212

1313
DESIRED_V8_VERSION=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%s.%s", [$]1, [$]2;}'`
1414

@@ -18,53 +18,39 @@ if test "$PHP_V8" != "no"; then
1818
SEARCH_PATH="${PRIORITY_SEARCH_PATH} /usr/local /usr"
1919

2020
if test -r $PHP_V8/$SEARCH_FOR; then
21-
case $host_os in
22-
darwin* )
23-
# MacOS does not support --rpath
24-
;;
25-
* )
26-
LDFLAGS="$LDFLAGS -Wl,--rpath=$PHP_V8/$PHP_LIBDIR"
27-
;;
28-
esac
29-
V8_LIB_DIR=$PHP_V8/$PHP_LIBDIR
30-
V8_INCLUDE_DIR=$PHP_V8/include
21+
V8_ROOT_DIR=$PHP_V8
3122
else
3223
AC_MSG_CHECKING([for V8 files in default path])
3324
for i in $SEARCH_PATH ; do
3425
if test -r $i/$SEARCH_FOR; then
3526
AC_MSG_RESULT(found in $i)
36-
V8_LIB_DIR=$i/$PHP_LIBDIR
37-
V8_INCLUDE_DIR=$i/include
27+
V8_ROOT_DIR=$i
28+
break
3829
fi
3930
done
4031
fi
4132

42-
if test -z "$V8_LIB_DIR"; then
33+
if test -z "$V8_ROOT_DIR"; then
4334
AC_MSG_RESULT([not found])
4435
AC_MSG_ERROR([Please reinstall the v8 distribution or provide valid path to it])
4536
fi
4637

47-
AC_DEFINE_UNQUOTED([PHP_V8_LIB_DIR], ["$V8_LIB_DIR/"], [Root directory with libraries (and icu data file)])
38+
V8_LIB_DIR=$V8_ROOT_DIR/$PHP_LIBDIR
39+
V8_INCLUDE_DIR=$V8_ROOT_DIR/include
4840

49-
PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
50-
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_LIB_DIR, V8_SHARED_LIBADD)
51-
PHP_SUBST(V8_SHARED_LIBADD)
52-
PHP_REQUIRE_CXX()
41+
AC_MSG_CHECKING([for ICU data file icudtl.dat])
5342

54-
AC_CACHE_CHECK(for C standard version, ac_cv_v8_cstd, [
55-
ac_cv_v8_cstd="c++11"
56-
old_CPPFLAGS=$CPPFLAGS
57-
AC_LANG_PUSH([C++])
58-
CPPFLAGS="-std="$ac_cv_v8_cstd
59-
AC_TRY_RUN([int main() { return 0; }],[],[ac_cv_v8_cstd="c++0x"],[])
60-
AC_LANG_POP([C++])
61-
CPPFLAGS=$old_CPPFLAGS
62-
]);
43+
if test -r "$V8_LIB_DIR/icudtl.dat"; then
44+
PHP_V8_ICU_DATA_DIR="$V8_LIB_DIR/" # trailing slash is required
45+
AC_MSG_RESULT(found in $PHP_V8_ICU_DATA_DIR)
46+
fi
6347

48+
if test -z "PHP_V8_ICU_DATA_DIR"; then
49+
AC_MSG_RESULT([not found])
50+
AC_MSG_ERROR([ICU data file icudtl.dat not found])
51+
fi
6452

65-
old_LIBS=$LIBS
66-
old_LDFLAGS=$LDFLAGS
67-
old_CPPFLAGS=$CPPFLAGS
53+
AC_DEFINE_UNQUOTED([PHP_V8_ICU_DATA_DIR], ["$PHP_V8_ICU_DATA_DIR"], [ICU data path (trailing slash is required)])
6854

6955
case $host_os in
7056
darwin* )
@@ -76,35 +62,24 @@ if test "$PHP_V8" != "no"; then
7662
;;
7763
esac
7864

79-
PHP_ADD_INCLUDE($V8_DIR)
65+
AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
66+
if test -z "$V8_INCLUDE_DIR/v8-version.h"; then
67+
AC_MSG_RESULT([not found])
68+
AC_MSG_ERROR([Please reinstall the v8 distribution or provide valid path to it])
69+
fi
8070
81-
LDFLAGS="$LDFLAGS -lv8_libbase -lv8_libplatform"
82-
LIBS="-lv8 -lv8_libbase -lv8_libplatform"
83-
CPPFLAGS="-I$V8_INCLUDE_DIR -std=$ac_cv_v8_cstd"
84-
AC_LANG_SAVE
85-
AC_LANG_CPLUSPLUS
71+
major=`cat $V8_INCLUDE_DIR/v8-version.h | grep V8_MAJOR_VERSION | awk '{print 3ドル}'`
72+
minor=`cat $V8_INCLUDE_DIR/v8-version.h | grep V8_MINOR_VERSION | awk '{print 3ドル}'`
73+
build=`cat $V8_INCLUDE_DIR/v8-version.h | grep V8_BUILD_NUMBER | awk '{print 3ドル}'`
74+
patch=`cat $V8_INCLUDE_DIR/v8-version.h | grep V8_PATCH_LEVEL | awk '{print 3ドル}'`
75+
candidate=`cat $V8_INCLUDE_DIR/v8-version.h | grep V8_IS_CANDIDATE_VERSION | awk '{print 3ドル}'`
8676
77+
version="$major.$minor.$build"
8778
88-
# NOTE: it is possible to get version string from headers with simple regexp match
89-
AC_CACHE_CHECK(for V8 version, ac_cv_v8_version, [
90-
AC_TRY_RUN([
91-
#include <v8.h>
92-
#include <iostream>
93-
#include <fstream>
94-
using namespace std;
95-
96-
int main ()
97-
{
98-
ofstream testfile ("conftestval");
99-
if (testfile.is_open()) {
100-
testfile << v8::V8::GetVersion();
101-
testfile << "\n";
102-
testfile.close();
103-
return 0;
104-
}
105-
return 1;
106-
}
107-
], [ac_cv_v8_version=`cat ./conftestval|awk '{print 1ドル}'`], [ac_cv_v8_version=NONE], [ac_cv_v8_version=NONE])
79+
if test $patch -gt 0; then version="$version.$patch"; fi
80+
if test $candidate -gt 0; then version="$version (candidate)"; fi
81+
82+
ac_cv_v8_version=$version
10883
])
10984

11085
V8_MIN_API_VERSION_NUM=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%d", [$]1 * 1000000 + [$]2 * 1000 + [$]3;}'`
@@ -121,23 +96,30 @@ if test "$PHP_V8" != "no"; then
12196
AC_MSG_ERROR([could not determine libv8 version])
12297
fi
12398

99+
PHP_ADD_INCLUDE($V8_DIR)
100+
PHP_ADD_INCLUDE($V8_INCLUDE_DIR)
101+
102+
PHP_ADD_LIBRARY_WITH_PATH(v8, $V8_LIB_DIR, V8_SHARED_LIBADD)
103+
PHP_ADD_LIBRARY_WITH_PATH(v8_libbase, $V8_LIB_DIR, V8_SHARED_LIBADD)
104+
PHP_ADD_LIBRARY_WITH_PATH(v8_libplatform, $V8_LIB_DIR, V8_SHARED_LIBADD)
105+
106+
PHP_SUBST(V8_SHARED_LIBADD)
107+
PHP_REQUIRE_CXX()
108+
109+
CPPFLAGS="$CPPFLAGS -std=c++11"
110+
124111
# On OS X clang reports warnings in zeng_strings.h, like
125112
# php/Zend/zend_string.h:326:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
126113
# also
127114
# php/Zend/zend_operators.h:128:18: warning: 'finite' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
128115
# but as we want to track also deprecated methods from v8 we won't ignore -Wdeprecated-declarations warnings
129116
# We want to make building log cleaner, so let's suppress only -Wdeprecated-register warning
130-
PHP_V8_COMPILER_OPTIONS="-Wno-deprecated-register"
131-
#PHP_V8_COMPILER_OPTIONS="-Wno-deprecated-register -Wno-deprecated-declarations"
117+
CPPFLAGS="$CPPFLAGS -Wno-deprecated-register -Wno-unicode"
118+
#CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations"
132119

133120
AC_DEFINE([V8_DEPRECATION_WARNINGS], [1], [Enable compiler warnings when using V8_DEPRECATED apis.])
134121
AC_DEFINE([V8_IMMINENT_DEPRECATION_WARNINGS], [1], [Enable compiler warnings to make it easier to see what v8 apis will be deprecated (V8_DEPRECATED) soon.])
135122

136-
AC_LANG_RESTORE
137-
LIBS=$old_LIBS
138-
#LDFLAGS=$old_LDFLAGS # we have to links some libraries
139-
CPPFLAGS=$old_CPPFLAGS
140-
141123
if test -z "$TRAVIS" ; then
142124
type git &>/dev/null
143125

@@ -185,6 +167,11 @@ if test "$PHP_V8" != "no"; then
185167
src/php_v8_object_template.cc \
186168
src/php_v8_function_template.cc \
187169
src/php_v8_script.cc \
170+
src/php_v8_unbound_script.cc \
171+
src/php_v8_cached_data.cc \
172+
src/php_v8_compile_options.cc \
173+
src/php_v8_script_compiler.cc \
174+
src/php_v8_source.cc \
188175
src/php_v8_data.cc \
189176
src/php_v8_value.cc \
190177
src/php_v8_primitive.cc \
@@ -220,7 +207,7 @@ if test "$PHP_V8" != "no"; then
220207
src/php_v8_named_property_handler_configuration.cc \
221208
src/php_v8_indexed_property_handler_configuration.cc \
222209
src/php_v8_access_type.cc \
223-
], $ext_shared, , "$PHP_V8_COMPILER_OPTIONS -std="$ac_cv_v8_cstd -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
210+
], $ext_shared, , -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
224211

225212
PHP_ADD_BUILD_DIR($ext_builddir/src)
226213

‎php_v8.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ extern "C" {
2929
extern zend_module_entry php_v8_module_entry;
3030
#define phpext_v8_ptr &php_v8_module_entry
3131

32-
#ifndef PHP_V8_LIB_DIR
33-
#define PHP_V8_LIB_DIR NULL
32+
#ifndef PHP_V8_ICU_DATA_DIR
33+
#define PHP_V8_ICU_DATA_DIR NULL
3434
#endif
3535

3636
#ifndef PHP_V8_VERSION

‎src/php_v8_a.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void php_v8_init()
2727
return;
2828
}
2929

30-
v8::V8::InitializeICUDefaultLocation(PHP_V8_LIB_DIR);
30+
v8::V8::InitializeICUDefaultLocation(PHP_V8_ICU_DATA_DIR);
3131

3232
// NOTE: if we use snapshot and extenal startup data then we have to initialize it (see https://codereview.chromium.org/315033002/)
3333
// v8::V8::InitializeExternalStartupData(NULL);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /