问题标签 [embedded-v8]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1835 浏览

node.js - Undefined symbol on node.js addon

I'm trying to create some node.js addons. Inside the addon i have a call to a static lib. Everything compiles ok, but when i call my addon function from javascript, i get the following:

My addon code is the following:

Can someone help?

Thanks

0 投票
1 回答
977 浏览

gcc - 无法在 Mac OSX 上使用 GYP 成功构建 V8

我从这里按照 V8 Build Instructions

以下是我在 Mac OSX 上构建 V8 所遵循的步骤。

但我没有看到out/x64.release/obj.target/tools/gyp/libv8_base.x64.a (or snapshot.a)

该文件夹仅包含js2c.stamp

这是Gist: 构建输出

我究竟做错了什么 ..

0 投票
6 回答
6523 浏览

php - PHP 中 V8 的用例是什么?

PHP 已嵌入 V8 JavaScript 引擎,http://www.php.net/manual/en/book.v8js.php。我想知道什么是可能的用例,尤其是。考虑到 PHP 是同步的,而 JavaScript 是异步的。

0 投票
1 回答
7217 浏览

v8 - Correct way to create a V8::Persistent from a V8::Handle

I just upgraded my V8 version to 3.20.16 (from some very old version). I can no longer use

Handle<Object> obj /* = ... */;
Persistent<Obje

I just upgraded my V8 version to 3.20.16 (from some very old version). I can no longer use

to create a persistent handle to an object. The compiler suggests using static T* v8::Persistent<T>::New(v8::Isolate*, T*) [with T = v8::Object] instead. However, if I change my code to

the compiler complains that this function is private. How do I create a Persistent<Object> handle from a normal Handle<Object> now?

I've googled and the only thing I found was that the documentations seem to contradict each other:

thanks for any help in advance


How to stop logcat messages

I occasionally the following scenario when trying to debug my multi-threaded app. I run the program and then a bug occurs causing a useful message to appear in the log cat... but only for about a quarter of a second before scrolling off the top of the window because a seemingly never-ending stream of of not-so useful error messages floods into the window. I am then left desperately trying to grab the vertical scroll bar (which is now jiggling around) so as to position the original error message into the window before the window buffer becomes so full that it is discarded.

There must be a better way... Is there a "stop-logging-now" command/button that I can hit as soon as the errors start appearing?

0 投票
0 回答
389 浏览

c++ - V8 拦截器代码不起作用

我开始学习 V8,但一直坚持实施拦截器。我在这段代码中有运行时错误。

当我注释掉拦截器部分时,它工作得很好。NewInstance()它在拦截器的调用中失败。由于我是 V8 新手,如果您发现任何其他错误,也请指出。

谢谢。

0 投票
1 回答
422 浏览

c++ - V8::IdleNotification() 永远不会返回 true

由于某些原因,有时 IdleNotification 的调用永远不会返回 true。该文件指出

嵌入器空闲的可选通知。V8 使用通知来减少内存占用。如果嵌入器保持空闲,则可以重复使用此调用。如果嵌入器应该在实际工作完成之前停止调用 IdleNotification,则返回 true。这表明 V8 已经完成了尽可能多的清理工作。

所以当 IdelNotifcation 永远不会返回 true 时,这意味着 V8 的垃圾收集器永远不会完成它的工作。

因为我真的找不到这种行为的原因,如果有人能给我提示可能导致这种情况的原因,我会很高兴。

0 投票
1 回答
161 浏览

c++ - 节点插件和 v8 GlobalTemplate

我正在使用节点构建节点插件,0.10.17并且在我的一堂课中我正在制作 v8 的上下文。我有这个代码:

->Set()这在函数调用中给了我例外。该应用程序正在崩溃。

我应该怎么办 ?

0 投票
0 回答
778 浏览

c++ - Nodejs 在单独的线程中创建 v8 上下文

我正在使用v8 version 3.14.5.9. 和那个nodejs is 0.10.17

在我的 c++ 插件中,我启动了一个单独的线程,然后我尝试创建一个对象,其构造函数是:

我在v8::Context::New().

请帮忙。

预先感谢。

0 投票
2 回答
14783 浏览

v8 - v8::Isolate 和 v8::Context 之间到底有什么区别?

V8 中这些对象之间的区别/联系是什么?上下文是否“属于”一个 Isolate,反之亦然?

我知道单个 Isolate 一次只能被一个线程访问(我猜这就是 v8::Locker 的用途?)。

我浏览了文档,但似乎无法掌握这些概念 - 任何帮助都将不胜感激!

0 投票
1 回答
1661 浏览

v8 - 在 V8 中使用 TerminateExecution

我目前正在尝试使用 V8。我希望能够在一个线程中运行一些(可能是长时间运行的)javascript,然后能够从另一个线程随意“优雅地”终止执行。

我编写了这个简单的代码片段来测试 Lockers 的概念和 TerminateExecution 的用法:

但是,我总是在terminateExecution()通话中遇到段错误。我在这里做错了什么?

谢谢你的帮助