Re: [v8-users] Executing JS within an android app
Hey, I don't know much about Android APIs and whether or not they include v8, sorry. You might have better luck asking on an Android related forum Best Jochen Poorna schrieb am Sa., 2. Juli 2016, 00:05: > Hello folks, > > We are writing an android app in which we want to execute javascript from > app. Since v8 is in-built into android, can we use v8 through JNI/NDK to > execute javascript? > > While searching through Internet I found this SO question( > http://stackoverflow.com/questions/6880778/android-utilize-v8-without-webview) > in which developers used to access v8 functionality through webkit (which > is present as a shared library libwebcore.so). Since webkit is replaced > with blink in recent android versions, is there any way I an execute > javascript through blink or directly v8? > > I know we can statically link v8 engine (embed) to the app, but the app > size increases by lot of megs. v8 or any js engine is not available as a > shared library. Is there any way we can access v8 functionality either > directly or indirectly? > > Thanks, > Poorna > > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Right way to access ArrayBufferView and ArrayBuffer.
Hi all, I'm trying to access data inside an ArrayBufferView. This is my simple javascript code: const myAddon = require('addon location'); const myObj = myAddon.MyObj(); const data = Buffer.from('test'); myObj = doSomething(data); After that in my c++ I have this: void MyObj::doSomething(const v8::FunctionCallbackInfo &args) {) { Local dataBufferView = Local::Cast(args[1]); std::cout << "Lenght on dataBufferView: " << dataBufferView->ByteLength() << std::endl; std::cout << "Byte offset on dataBufferView: " << dataBufferView->ByteOffset() << std::endl; Local dataBuffer = dataBufferView->Buffer(); std::cout << "Lenght dataBuffer: " << dataBuffer->ByteLength() << std::endl; ArrayBuffer::Contents dataContent = dataBuffer->Externalize(); uint8_t* startData = static_cast(dataContent.Data()); std::cout << "Content of "ByteLength() is 8192 and if I print out the data content what I see is my full javascript code and some other binary data. So.. what is the right way to access data? -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Right way to access ArrayBufferView and ArrayBuffer.
On Mon, Jul 4, 2016 at 12:00 PM, Elia Mazzuoli wrote: > Hi all, I'm trying to access data inside an ArrayBufferView. This is my > simple javascript code: > > const myAddon = require('addon location'); > > const myObj = myAddon.MyObj(); > > const data = Buffer.from('test'); > myObj = doSomething(data); > > After that in my c++ I have this: > > void MyObj::doSomething(const v8::FunctionCallbackInfo &args) {) > { > > Local dataBufferView = > Local::Cast(args[1]); > > std::cout << "Lenght on dataBufferView: " << > dataBufferView->ByteLength() << std::endl; > > std::cout << "Byte offset on dataBufferView: " << > dataBufferView->ByteOffset() << std::endl; > > Local dataBuffer = dataBufferView->Buffer(); > > std::cout << "Lenght dataBuffer: " << dataBuffer->ByteLength() << > std::endl; > > ArrayBuffer::Contents dataContent = dataBuffer->Externalize(); > > > uint8_t* startData = static_cast(dataContent.Data()); > > std::cout << "Content of " < > for(unsigned int i = 0; i < dataContent->ByteLength(); i++) { > > std::cout << *(startData + i); > > } > > std::cout << std::endl; > > > } > > > What is strange in this simple code is that dataBuffer->ByteLength() is 8192 > and if I print out the data content what I see is my full javascript code > and some other binary data. > > So.. what is the right way to access data? node::Buffer::Data() and node::Buffer::Length() from node_buffer.h. Using v8::ArrayBufferView won't work in node.js versions where Buffer is not an instance of Uint8Array. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Right way to access ArrayBufferView and ArrayBuffer.
Umm thank you for the response... but isn't clear for me. Now I develop on version 6.2.1 seems that "ArrayBufferView" have an instance of Uint8Array.. but how this help for my questions? 1. Why I see inside my "ArrayBuffer" the entire js code and other binary content? 2. What is the right way for access to data? Il giorno lunedì 4 luglio 2016 12:06:43 UTC+2, Ben Noordhuis ha scritto: > > On Mon, Jul 4, 2016 at 12:00 PM, Elia Mazzuoli > wrote: > > Hi all, I'm trying to access data inside an ArrayBufferView. This is my > > simple javascript code: > > > > const myAddon = require('addon location'); > > > > const myObj = myAddon.MyObj(); > > > > const data = Buffer.from('test'); > > myObj = doSomething(data); > > > > After that in my c++ I have this: > > > > void MyObj::doSomething(const v8::FunctionCallbackInfo &args) > {) > > { > > > > Local dataBufferView = > > Local::Cast(args[1]); > > > > std::cout << "Lenght on dataBufferView: " << > > dataBufferView->ByteLength() << std::endl; > > > > std::cout << "Byte offset on dataBufferView: " << > > dataBufferView->ByteOffset() << std::endl; > > > > Local dataBuffer = dataBufferView->Buffer(); > > > > std::cout << "Lenght dataBuffer: " << dataBuffer->ByteLength() << > > std::endl; > > > > ArrayBuffer::Contents dataContent = dataBuffer->Externalize(); > > > > > > uint8_t* startData = static_cast(dataContent.Data()); > > > > std::cout << "Content of " < "; > > > > for(unsigned int i = 0; i < dataContent->ByteLength(); i++) { > > > > std::cout << *(startData + i); > > > > } > > > > std::cout << std::endl; > > > > > > } > > > > > > What is strange in this simple code is that dataBuffer->ByteLength() is > 8192 > > and if I print out the data content what I see is my full javascript > code > > and some other binary data. > > > > So.. what is the right way to access data? > > node::Buffer::Data() and node::Buffer::Length() from node_buffer.h. > > Using v8::ArrayBufferView won't work in node.js versions where Buffer > is not an instance of Uint8Array. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] linux-tick-processors produces error "Code move event for unknown code"
I found out what is causing the crash in d8. One of the "shared-library" lines my log file points to a very large library (157M). The line looks like this: shared-library,"/path/to/my/file/name.so",0x7fdf1f909000,0x7fdf23d2b000,0 Once it's removed, everything works fine. Is there a size limit? On Monday, May 2, 2016 at 4:50:51 PM UTC+3, Ben Noordhuis wrote: > > On Mon, May 2, 2016 at 2:14 PM, Danny Dorfman > wrote: > > I tried moving SetFlagsFromCommandLine() to be the first V8 API call > (before > > any initialization takes place), and running my application again. > > > > After executing linux-tick-processor on the new log file, it looks like > d8 > > is crashing after 5 seconds into its run. > > > > # tools/linux-tick-processor /mydir/isolate-0x7f566004dbb0-v8.log > > which: no d8 in > > > (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/depot_tools:/usr/lib/vslick/bin:/usr/lib/jvm/java-1.7.0/bin) > > > > tools/linux-tick-processor: line 41: 2855 Broken pipe cat > > $log_file > > 2856 Segmentation fault | $d8_exec $tools_path/splaytree.js > > $tools_path/codemap.js $tools_path/csvparser.js $tools_path/consarray.js > > $tools_path/profile.js $tools_path/profile_view.js > $tools_path/logreader.js > > $tools_path/tickprocessor.js $tools_path/SourceMap.js > > $tools_path/tickprocessor-driver.js -- $@ 2> /dev/null > > > > Adding --nocompact_code_space makes no difference. The crash is still > > there. Please assist. > > Try setting the D8_PATH environment variable to the directory where d8 > can be found. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Right way to access ArrayBufferView and ArrayBuffer.
On Mon, Jul 4, 2016 at 2:24 PM, Elia Mazzuoli wrote: > Umm thank you for the response... but isn't clear for me. Now I develop on > version 6.2.1 seems that "ArrayBufferView" have an instance of Uint8Array.. > but how this help for my questions? > > 1. Why I see inside my "ArrayBuffer" the entire js code and other binary > content? Buffers can be sliced off a larger buffer. The ArrayBuffer is that larger buffer. > 2. What is the right way for access to data? I already told you. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] linux-tick-processors produces error "Code move event for unknown code"
On Mon, Jul 4, 2016 at 2:47 PM, Danny Dorfman wrote: > I found out what is causing the crash in d8. One of the "shared-library" > lines my log file points to a very large library (157M). The line looks like > this: > > shared-library,"/path/to/my/file/name.so",0x7fdf1f909000,0x7fdf23d2b000,0 > > Once it's removed, everything works fine. Is there a size limit? Effectively, yes. The tick processor parses the output of nm(1) into a list. It sounds like it's running out of memory. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.