As Mikhail says, there is no API to do what you want.

If you pass the flag --trace to the VM, it calls a runtime function
TraceEnter on entry to every JavaScript function and TraceExit on exit.  If
you're comfortable hacking the sources of the VM, you could change these
functions to do what you want.

On Thu, Jan 20, 2011 at 5:47 AM, irobert <[email protected]> wrote:

> Hi Eddy:
>    Thank you for your reply.
>    My current solution is to do a pre-parse process before v8 compile
> the code.
>   I wrote a rewrite module to arbitrarily insert an specific function
> call at the first line of the function body.
>   However, it doesn't work very well.
>
> Thanks
>
> On Jan 19, 5:36 am, Eddy Bruël <[email protected]> wrote:
> > Hi irobert,
> >
> > Maybe you could alter the way v8 generates machine code in such a way
> that
> > every function call is preceded by a call to your handler function.
> >
> > Greetings,
> >
> > Eddy
> >
> > On Wed, Jan 19, 2011 at 11: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
>

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

Reply via email to