I meant, you can write yourself a function in C++, that calls whatever
you want, then make it accessible from JS code running on V8. And
whenever you will call this function from JS, you'll get your hook.

Please consult include/v8.h around line 1950 -- the comment
illustrates how to use v8::FunctionTemplate.

On Thu, Jan 20, 2011 at 07:44, irobert <[email protected]> wrote:
> Thank you for your reply.
>
> I got your idea, however, I don't understand what you said about
> intercept user-defined C++ function.
> Does this C++ function written in V8? Would you mind to show me a
> little example?
>
>
> Thanks
>
> On Jan 19, 5:28 am, Mikhail Naganov <[email protected]> wrote:
>> Hi,
>>
>> There is no interpreter in V8. All JS code is compiled directly into
>> machine code.
>> Interception is only possible if a user-defined C++ function is called
>> (e.g. a custom property accessor, etc.), because this is the only way
>> to pass control flow out from the virtual machine to user code.
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Jan 19, 2011 at 02:14, irobert <[email protected]> wrote:
>> > Hello to everyone in this group:
>> >      I am currently want to implement a new idea on V8 JavaScript
>> > interpreter. To finish the job, I want to intercept the event from the
>> > interpreter. For example, 2 user-defined function A() and B(), and
>> > function A need to call function B in the body of A. I want to
>> > intercept the event when this call happens. I don't know if any one
>> > knows such a API in V8 to achieve this task. If you know the answer,
>> > please let me know.
>>
>> > Thanks to everyone.
>> > My best regard
>>
>> > --
>> > v8-users mailing list
>> > [email protected]
>> >http://groups.google.com/group/v8-users
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to