問題タブ [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 に答える
7217 参照

v8 - 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<Object> p = Pe

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


As @aaronman pointed out, if you are working with integers only the fastest way to do this is to have all powers of 2 in table as there are not that many. By construction, in an unsigned 32 bit integer there are 32 powers of 2 (including the number 1), in a 64 bit integer there are 64 and so on.

But if you want to do it on the fly for a generic case you can easily calculate the surrounding powers of 2 of any number. In c/c++:

0 投票する
0 に答える
389 参照

c++ - V8 インターセプター コードが機能しない

V8 の学習を開始しましたが、インターセプターの実装に行き詰まっています。このコードで実行時エラーが発生しています。

インターセプター部分をコメントアウトすると、完全に機能します。NewInstance()Interceptor の呼び出しで失敗します。私は V8 を初めて使用するので、他に間違いがあれば指摘してください。

ありがとう。

0 投票する
1 に答える
161 参照

c++ - ノード アドオンと v8 GlobalTemplate

私はノードでノードアドオンを構築して0.10.17おり、クラスの1つでv8のコンテキストを作成しています。私はこのコードを持っています:

->Set()これにより、関数呼び出しで例外が発生しています。アプリケーションはちょうど壊れています。

私は何をすべきか ?

0 投票する
0 に答える
778 参照

c++ - 別のスレッドで v8 コンテキストを作成する Nodejs

を使用してv8 version 3.14.5.9います。とのそれnodejs is 0.10.17

私のC ++アドオンでは、別のスレッドを開始し、その上でコンストラクターが次のオブジェクトを作成しようとします:

で例外が発生していv8::Context::New()ます。

助けてください。

よろしくお願いします。

0 投票する
1 に答える
1661 参照

v8 - V8 での TerminateExecution の使用

現在V8で実験中です。あるスレッドで(おそらく長時間実行される)javascriptを実行し、別のスレッドから自由に「優雅に」実行を終了できるようにしたいと考えています。

ロッカーの概念と TerminateExecution の使用法をテストするために、次の簡単なスニペットを作成しました。

ただし、terminateExecution()呼び出し時に常にセグメンテーション違反が発生します。ここで何が間違っていますか?

助けてくれてありがとう