v8eval 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bc796827b31875adb19bac6160324a239cc8183
4
- data.tar.gz: f9ca3808367a62bc6fd3faeebcdceec9ae162d49
3
+ metadata.gz: 5f734c4e621931bf36e036033f04fe51e02e692e
4
+ data.tar.gz: d56033a1844dda51e71f9b3294b2d6e7e2918ea1
5
5
  SHA512:
6
- metadata.gz: adbeb2fcbec1a4efc82896284670625bb10b3feb8637324014e2807b45452c1adb55cb0d7e7367c7778941224160a863c7b3d60ca8609389479fdfe0cc3a04b3
7
- data.tar.gz: 31330901707a0c19eb9c4761825883ace6feebad783ef7274bc7b096b9b524c8754297a467e39efdac01c0c4675baf14cc2755c5f2edced82f509f272e0d9ed6
6
+ metadata.gz: acbf5043b09426f0eacbcd197210a12ea80f67c681aba71805dcff54dcab9385d9861097ff713cd221e6241a2f7525b1d3e13a60ad6afa86e8d15bbd25e5b998
7
+ data.tar.gz: b8db3d93434102b0afa999198a7640a83804fb73946b99f6026cb2800e50bf5df7e695651c23a327cd9191db2431491dfa52c83afc35bd5f1283023403a92e45
data/CMakeLists.txt CHANGED
@@ -26,7 +26,7 @@ endif(APPLE)
26
26
 
27
27
  if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
28
28
  link_directories(
29
- v8/out/x64.release/obj.target/tools/gyp
29
+ v8/out/x64.release/obj.target/src
30
30
  v8/out/x64.release/obj.target/third_party/icu
31
31
  )
32
32
  endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Multi-language bindings to JavaScript engine V8.
8
8
 
9
- Currently v8eval provides Go, Python and Ruby bindings to the latest V8 5.1 and supports Linux and Mac OS X.
9
+ Currently v8eval provides Go, Python and Ruby bindings to the latest V8 5.2 and supports Linux and Mac OS X.
10
10
  v8eval uses SWIG and can be extended easily for other languages.
11
11
 
12
12
  ## Pre-installation
data/build.sh CHANGED
@@ -4,7 +4,7 @@ V8EVAL_ROOT=`cd $(dirname $0) && pwd`
4
4
 
5
5
  PLATFORM=`uname`
6
6
  if [ $PLATFORM = "Linux" ] ; then
7
- NUM_CPU_CORES=`cat /proc/cpuinfo | grep cores | grep -o '[0-9]\+'`
7
+ NUM_CPU_CORES=`cat /proc/cpuinfo | grep cores | grep -o '[0-9]\+' | awk '{total=total+$1}; END{print total}'`
8
8
 
9
9
  export CC=$V8EVAL_ROOT/v8/third_party/llvm-build/Release+Asserts/bin/clang
10
10
  export CXX=$V8EVAL_ROOT/v8/third_party/llvm-build/Release+Asserts/bin/clang++
@@ -53,8 +53,8 @@ install_v8() {
53
53
  cd $V8EVAL_ROOT
54
54
  fetch v8
55
55
  cd v8
56
- git checkout 5.1.117
57
- CFLAGS="-fPIC" CXXFLAGS="-fPIC" make x64.release -j$NUM_CPU_CORES V=1
56
+ git checkout 5.2.163
57
+ CFLAGS="-fPIC -Wno-unknown-warning-option" CXXFLAGS="-fPIC -Wno-unknown-warning-option" make x64.release -j$NUM_CPU_CORES V=1
58
58
  }
59
59
 
60
60
  install_libuv() {
@@ -39,7 +39,7 @@ if RUBY_PLATFORM =~ /darwin/
39
39
  ]
40
40
  elsif RUBY_PLATFORM =~ /linux/
41
41
  lib_dirs += [
42
- v8_dir + '/out/x64.release/obj.target/tools/gyp',
42
+ v8_dir + '/out/x64.release/obj.target/src',
43
43
  v8_dir + '/out/x64.release/obj.target/third_party/icu'
44
44
  ]
45
45
 
data/v8eval.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new 'v8eval', '1.0' do |s|
2
2
  s.name = 'v8eval'
3
- s.version = '0.2.3'
3
+ s.version = '0.2.4'
4
4
  s.licenses = ['MIT']
5
5
  s.description = 'Run JavaScript engine V8 in Ruby'
6
6
  s.summary = 'v8eval gem is ruby binding to the latest V8 4.7 and supports
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: v8eval
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prateek Papriwal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -74,17 +74,10 @@ files:
74
74
  - ruby/Rakefile
75
75
  - ruby/build.sh
76
76
  - ruby/example/js_add.rb
77
- - ruby/ext/v8eval/Makefile
78
77
  - ruby/ext/v8eval/extconf.rb
79
- - ruby/ext/v8eval/v8eval.h
80
78
  - ruby/ext/v8eval/v8eval.i
81
- - ruby/ext/v8eval/v8eval_wrap.cxx
82
79
  - ruby/lib/setup/extension_builder.rb
83
80
  - ruby/lib/v8eval.rb
84
- - ruby/lib/v8eval/Makefile
85
- - ruby/lib/v8eval/extconf.rb
86
- - ruby/lib/v8eval/v8eval.h
87
- - ruby/lib/v8eval/v8eval_wrap.cxx
88
81
  - ruby/spec/v8eval_spec.rb
89
82
  - src/dbgsrv.cxx
90
83
  - src/dbgsrv.h
@@ -118,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
111
  version: '0'
119
112
  requirements: []
120
113
  rubyforge_project:
121
- rubygems_version: 2.5.1
114
+ rubygems_version: 2.4.6
122
115
  signing_key:
123
116
  specification_version: 4
124
117
  summary: v8eval gem is ruby binding to the latest V8 4.7 and supports Linux and Mac
@@ -1,261 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@:)
9
- ECHO = $(ECHO1:0=@echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /usr/local/Cellar/ruby/2.3.0/include/ruby-2.3.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /usr/local/Cellar/ruby/2.3.0/include/ruby-2.3.0/x86_64-darwin15
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/usr/local/Cellar/ruby/2.3.0
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(DESTDIR)/usr/local/lib/ruby/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(DESTDIR)/usr/local/lib/ruby/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(prefix)/var
56
- sharedstatedir = $(prefix)/com
57
- sysconfdir = $(prefix)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(exec_prefix)/libexec
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = clang
67
- CXX = clang++
68
- LIBRUBY = $(LIBRUBY_SO)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
71
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
-
76
- RUBY_EXTCONF_H =
77
- cflags = $(optflags) $(debugflags) $(warnflags)
78
- cxxflags = $(optflags) $(debugflags) $(warnflags)
79
- optflags = -O3 -fno-fast-math
80
- debugflags = -ggdb3
81
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens
82
- CCDLFLAGS = -fno-common
83
- CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe $(ARCH_FLAG)
84
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
85
- DEFS =
86
- CPPFLAGS = -I/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/v8 -I/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/v8/include -I/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/uv/include -I/usr/local/Cellar/ruby/2.3.0/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags) -g -O3 -std=c++11
87
- CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
88
- ldflags = -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lv8eval -lv8_libplatform -lv8_base -lv8_libbase -lv8_nosnapshot -licui18n -licuuc -licudata -luv
89
- dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib
90
- ARCH_FLAG =
91
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
92
- LDSHARED = $(CC) -dynamic -bundle
93
- LDSHAREDXX = $(CXX) -dynamic -bundle
94
- AR = ar
95
- EXEEXT =
96
-
97
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
98
- RUBY_SO_NAME = ruby.2.3.0
99
- RUBYW_INSTALL_NAME =
100
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
101
- RUBYW_BASE_NAME = rubyw
102
- RUBY_BASE_NAME = ruby
103
-
104
- arch = x86_64-darwin15
105
- sitearch = $(arch)
106
- ruby_version = 2.3.0
107
- ruby = $(bindir)/$(RUBY_BASE_NAME)
108
- RUBY = $(ruby)
109
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
110
-
111
- RM = rm -f
112
- RM_RF = $(RUBY) -run -e rm -- -rf
113
- RMDIRS = rmdir -p
114
- MAKEDIRS = mkdir -p
115
- INSTALL = /usr/bin/install -c
116
- INSTALL_PROG = $(INSTALL) -m 0755
117
- INSTALL_DATA = $(INSTALL) -m 644
118
- COPY = cp
119
- TOUCH = exit >
120
-
121
- #### End of system configuration section. ####
122
-
123
- preload =
124
-
125
- libpath = . $(libdir) /Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/build /Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/uv/.libs /usr/local/Cellar/ruby/2.3.0/lib /Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/v8/out/x64.release /usr/local/opt/libyaml/lib /usr/local/opt/openssl/lib /usr/local/opt/readline/lib
126
- LIBPATH = -L. -L$(libdir) -L/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/build -L/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/uv/.libs -L/usr/local/Cellar/ruby/2.3.0/lib -L/Users/prateekpapriwal/gocodes/src/github.com/sony/v8eval/v8/out/x64.release -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix = /v8eval
136
- LOCAL_LIBS =
137
- LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
138
- ORIG_SRCS = v8eval_wrap.cxx
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = v8eval_wrap.o
141
- HDRS = $(srcdir)/v8eval.h
142
- TARGET = v8eval
143
- TARGET_NAME = v8eval
144
- TARGET_ENTRY = Init_$(TARGET_NAME)
145
- DLLIB = $(TARGET).bundle
146
- EXTSTATIC =
147
- STATIC_LIB =
148
-
149
- TIMESTAMP_DIR = .
150
- BINDIR = $(bindir)
151
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
152
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
153
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
154
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
155
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
156
-
157
- TARGET_SO = $(DLLIB)
158
- CLEANLIBS = $(TARGET).bundle
159
- CLEANOBJS = *.o *.bak
160
-
161
- all: $(DLLIB)
162
- static: $(STATIC_LIB) install-rb
163
- .PHONY: all install static install-so install-rb
164
- .PHONY: clean clean-so clean-static clean-rb
165
-
166
- clean-static::
167
- clean-rb-default::
168
- clean-rb::
169
- clean-so::
170
- clean: clean-so clean-static clean-rb-default clean-rb
171
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
172
-
173
- distclean-rb-default::
174
- distclean-rb::
175
- distclean-so::
176
- distclean-static::
177
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
178
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
179
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
180
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
181
-
182
- realclean: distclean
183
- install: install-so install-rb
184
-
185
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.v8eval.time
186
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
187
- clean-static::
188
- -$(Q)$(RM) $(STATIC_LIB)
189
- install-rb: pre-install-rb install-rb-default
190
- install-rb-default: pre-install-rb-default
191
- pre-install-rb: Makefile
192
- pre-install-rb-default: Makefile
193
- pre-install-rb-default:
194
- @$(NULLCMD)
195
- $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.v8eval.time:
196
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
197
- $(Q) $(TOUCH) $@
198
-
199
- site-install: site-install-so site-install-rb
200
- site-install-so: install-so
201
- site-install-rb: install-rb
202
-
203
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
204
-
205
- .cc.o:
206
- $(ECHO) compiling $(<)
207
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
208
-
209
- .cc.S:
210
- $(ECHO) translating $(<)
211
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
212
-
213
- .mm.o:
214
- $(ECHO) compiling $(<)
215
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
216
-
217
- .mm.S:
218
- $(ECHO) translating $(<)
219
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
220
-
221
- .cxx.o:
222
- $(ECHO) compiling $(<)
223
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
224
-
225
- .cxx.S:
226
- $(ECHO) translating $(<)
227
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
228
-
229
- .cpp.o:
230
- $(ECHO) compiling $(<)
231
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
232
-
233
- .cpp.S:
234
- $(ECHO) translating $(<)
235
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
236
-
237
- .c.o:
238
- $(ECHO) compiling $(<)
239
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
240
-
241
- .c.S:
242
- $(ECHO) translating $(<)
243
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
244
-
245
- .m.o:
246
- $(ECHO) compiling $(<)
247
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
248
-
249
- .m.S:
250
- $(ECHO) translating $(<)
251
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
252
-
253
- $(DLLIB): $(OBJS) Makefile
254
- $(ECHO) linking shared-object v8eval/$(DLLIB)
255
- -$(Q)$(RM) $(@)
256
- $(Q) $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
257
- $(Q) $(POSTLINK)
258
-
259
-
260
-
261
- $(OBJS): $(HDRS) $(ruby_headers)
@@ -1,99 +0,0 @@
1
- #ifndef V8EVAL_H_
2
- #define V8EVAL_H_
3
-
4
- #include <string>
5
-
6
- #include "v8.h"
7
- #include "v8-debug.h"
8
-
9
- /// \file
10
- namespace v8eval {
11
-
12
- class DbgSrv;
13
-
14
- typedef void (*debugger_cb)(std::string&, void *opq);
15
-
16
- /// \brief Initialize the V8 runtime environment
17
- /// \return success or not as boolean
18
- ///
19
- /// This method initializes the V8 runtime environment. It must be called before creating any V8 instance.
20
- bool initialize();
21
-
22
- /// \brief Dispose the V8 runtime environment
23
- /// \return success or not as boolean
24
- ///
25
- /// This method disposes the V8 runtime environment.
26
- bool dispose();
27
-
28
- /// \class _V8
29
- ///
30
- /// _V8 instances can be used in multiple threads.
31
- /// But each _V8 instance can be used in only one thread at a time.
32
- class _V8 {
33
- public:
34
- _V8();
35
- virtual ~_V8();
36
-
37
- /// \brief Evaluate JavaScript code
38
- /// \param src JavaScript code
39
- /// \return JSON-encoded result or exception message
40
- ///
41
- /// This method evaluates the given JavaScript code 'src' and returns the result in JSON.
42
- /// If some JavaScript exception happens in runtime, the exception message is returned.
43
- std::string eval(const std::string& src);
44
-
45
- /// \brief Call a JavaScript function
46
- /// \param func Name of a JavaScript function
47
- /// \param args JSON-encoded argument array
48
- /// \return JSON-encoded result or exception message
49
- ///
50
- /// This method calls the JavaScript function specified by 'func'
51
- /// with the JSON-encoded argument array 'args'
52
- /// and returns the result in JSON.
53
- /// If some JavaScript exception happens in runtime, the exception message is returned.
54
- std::string call(const std::string& func, const std::string& args);
55
-
56
- /// \brief Start a debug server associated with the V8 instance
57
- /// \param port The TCP/IP port the debugger will listen, at localhost
58
- /// \return success or not as boolean
59
- ///
60
- /// After the debugger is successfully started, it will be possible to
61
- /// send commands and receive events at the specified port. When the
62
- /// debugger is started, the Javascript's "debugger" statement will
63
- /// cause the V8 instance to halt and wait for instructions through
64
- /// the debugger port.
65
- bool enable_debugger(int port);
66
-
67
- /// \brief Stop the debug server, if running.
68
- ///
69
- /// The debug server, if currently running, will be stopped, causing
70
- /// connections to remote debuggers to be dropped.
71
- void disable_debugger();
72
-
73
- private:
74
- static void debugger_message_handler(const v8::Debug::Message& message);
75
- v8::Local<v8::Context> new_context();
76
- v8::Local<v8::String> new_string(const char* str);
77
- v8::Local<v8::Value> json_parse(v8::Local<v8::Context> context, v8::Local<v8::String> str);
78
- v8::Local<v8::String> json_stringify(v8::Local<v8::Context> context, v8::Local<v8::Value> value);
79
-
80
- bool debugger_init(debugger_cb cb, void *cbopq);
81
- bool debugger_send(const std::string& cmd);
82
- void debugger_process();
83
- void debugger_stop();
84
-
85
- private:
86
- v8::Isolate* isolate_;
87
- v8::Persistent<v8::Context> context_;
88
-
89
- DbgSrv* dbg_server_;
90
- v8::Isolate* dbg_isolate_;
91
- debugger_cb callback_;
92
- void* callback_opq_;
93
-
94
- friend class DbgSrv;
95
- };
96
-
97
- } // namespace v8eval
98
-
99
- #endif // V8EVAL_H_