[v8-users] A strange error with timezone

2018-06-27 Thread zcw
Hello, 

We found a strange behavior with timezone. I tested the following with the 
v8_shell.
running:
var d =new Date()
d.getTimezoneOffset()

It will give me 420 which is correct for PDT. but if I set the TZ variable 
by doing:
export TZ=:/etc/localtime
and running the above script again, it gives me 480.

When I do zdump /etc/localtime, it shows the timezone is PDT. So it doesn't 
seem the /etc/localtime has error.

I don't know why setting the TZ variable changed the correct timezone. 
Our program needs the TZ variable, is there any way to fix this behavior?

-- 
-- 
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] Questions when adding global object

2018-06-27 Thread zcw
Thank you!
We decided to temporarily remove the console block.
Really appreciate your help!

On Wednesday, June 27, 2018 at 11:55:02 AM UTC-7, Jakob Kummerow wrote:
>
> Sorry, I only know what I see in the code. I'm not sure if/how 
> ConsoleDelegate is supposed to be used via the regular API.
>
> If you want to hack it, you can remove the entire { // -- C o n s o l e 
> block in src/bootstrapper.cc, that'll prevent the built-in console from 
> overriding the global template you're providing. Of course this approach 
> doesn't apply if your setup doesn't allow you to modify V8's source.
>
> Maybe it's easiest to just keep the default console.log implementation, 
> letting it print to stdout and redirecting the output of the process to a 
> file?
>
> On Wed, Jun 27, 2018 at 11:37 AM zcw > 
> wrote:
>
>> And actually is the consoleDelegate exposed in the .h files in the 
>> include directory? I saw it is defined in interface-types.h but if I were 
>> to include that, it will lead to a chain of includes from /src..
>> Am I misunderstanding something? 
>>
>> Thanks!
>>
>> On Wednesday, June 27, 2018 at 11:03:35 AM UTC-7, zcw wrote:
>>>
>>> Hello Jakob,
>>>
>>> May I get some more directions for using the consoleDelegate?
>>> From d8 files. I saw that we could make a console class and use set 
>>> consoleDelegate to set console functions.
>>> But in our old way, we create a global template for "console" and using 
>>> setAccessor to append functions to it. 
>>> Since I don't want to introduce too much code change. Is there a way to 
>>> keep the old usage (create as global template)? or is using consoleDelegate 
>>> the only way to specify console functions?
>>>
>>> Again thank you so much!
>>>
>>>
>>>
>>> On Monday, June 25, 2018 at 10:27:58 PM UTC-7, Jakob Kummerow wrote:

 On Mon, Jun 25, 2018 at 8:30 PM zcw  wrote:

> Thank you so much!
> I wanted to save the log to a specific file. I tried using the 
> provided console but couldn't find where it stored the log message.
>

 On a closer look at the code, it seems that you *have to* provide a 
 ConsoleDelegate if you want console.log to do anything.
  

> And could the ConsoleDelegate work for the release build?
>

 Yes, of course.
  

> On Monday, June 25, 2018 at 6:14:42 PM UTC-7, Jakob Kummerow wrote:
>
>> V8 now provides its own "console" object, with the usual methods 
>> installed on it. Does it not serve your needs?
>>
>> You can override it by providing a ConsoleDelegate via the debug 
>> interface. The d8 shell (src/d8.cc) provides an example.
>>
>> On Mon, Jun 25, 2018 at 5:52 PM zwc  wrote:
>>
>>> Hello, 
>>> we are working on upgrading v8 from 5.3 to 6.7-lkgr. 
>>> But I recently found a strange behavior for one global object with 
>>> name "console".
>>> In the old version, we have a global object "console" for logging 
>>> info. 
>>> But when upgraded to 6.7, the "console"'s callbacks functions won't 
>>> get called. I tested if I change the name from "console" to something 
>>> else, 
>>> it will work as usual. 
>>> I am feeling like that "console"seems to become a reserved word for 
>>> the newer version?
>>> May I know if this is expected? And if true, is there any workaround 
>>> to overwrite this behavior? we would want to keep our old "console" 
>>> name.
>>>
>>> Thank you so much!
>>>
>>> -- 
>>> -- 
>>> v8-users mailing list
>>> v8-u...@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+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
> -- 
> v8-users mailing list
> v8-u...@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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
 -- 
>> -- 
>> v8-users mailing list
>> v8-u...@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+u...@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-use

Re: [v8-users] Declare an API in javascript and define in V8.

2018-06-27 Thread Jakob Kummerow
See the documentation, which has examples for this:
https://github.com/v8/v8/wiki/Embedder's-Guide

If you insist on adding this in V8 rather than in your embedding
application, it's more complicated (and, unless you have a strong reason,
probably not a good idea...). Look at bootstrapper.cc and work your way
through the source from there.

On Wed, Jun 27, 2018 at 3:05 PM Abhishek Kanike 
wrote:

> Hi v8 users,
>
> I would like to call a function from javascript which when processed by v8
> engine, calls my own library function.
> For example,
>
>
> *In javascript (main.js):*
> var start = Date.now();
> myFunctionInV8();
> // js code...
> // js code...
> // js code...
> var end = Date.now();
>
>
>
>
>
> *In v8:// may be in v8platform*void myFunctionInV8(){
>// calling my external library functions...
> }
>
>
> What is the best way to achieve this? I want this function call eventually
> in v8 engine only.
>
> Regards,
> K Abhishek
>
> --
> --
> 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] Declare an API in javascript and define in V8.

2018-06-27 Thread Abhishek Kanike
Hi v8 users,

I would like to call a function from javascript which when processed by v8 
engine, calls my own library function.
For example, 


*In javascript (main.js):*
var start = Date.now();
myFunctionInV8();
// js code...
// js code...
// js code...
var end = Date.now();





*In v8:// may be in v8platform*void myFunctionInV8(){
   // calling my external library functions...
}


What is the best way to achieve this? I want this function call eventually 
in v8 engine only.

Regards,
K Abhishek

-- 
-- 
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] Define an API in javascript and handle in V8.

2018-06-27 Thread Abhishek Kanike
Hi v8 users,

I would like to call a function from javascript which when processed by v8 
engine, calls my own library function.
For example, 


*In javascript (main.js):*
var start = Date.now();
myFunctionInV8();
// js code...
// js code...
// js code...
var end = Date.now();

*In v8:*
void myFunctionInV8(){
   // calling my library functions...
}


What is the best way to achieve this? I want this function call eventually 
in v8 engine only.

Regards,
K Abhishek

-- 
-- 
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] Questions when adding global object

2018-06-27 Thread Jakob Kummerow
Sorry, I only know what I see in the code. I'm not sure if/how
ConsoleDelegate is supposed to be used via the regular API.

If you want to hack it, you can remove the entire { // -- C o n s o l e
block in src/bootstrapper.cc, that'll prevent the built-in console from
overriding the global template you're providing. Of course this approach
doesn't apply if your setup doesn't allow you to modify V8's source.

Maybe it's easiest to just keep the default console.log implementation,
letting it print to stdout and redirecting the output of the process to a
file?

On Wed, Jun 27, 2018 at 11:37 AM zcw  wrote:

> And actually is the consoleDelegate exposed in the .h files in the include
> directory? I saw it is defined in interface-types.h but if I were to
> include that, it will lead to a chain of includes from /src..
> Am I misunderstanding something?
>
> Thanks!
>
> On Wednesday, June 27, 2018 at 11:03:35 AM UTC-7, zcw wrote:
>>
>> Hello Jakob,
>>
>> May I get some more directions for using the consoleDelegate?
>> From d8 files. I saw that we could make a console class and use set
>> consoleDelegate to set console functions.
>> But in our old way, we create a global template for "console" and using
>> setAccessor to append functions to it.
>> Since I don't want to introduce too much code change. Is there a way to
>> keep the old usage (create as global template)? or is using consoleDelegate
>> the only way to specify console functions?
>>
>> Again thank you so much!
>>
>>
>>
>> On Monday, June 25, 2018 at 10:27:58 PM UTC-7, Jakob Kummerow wrote:
>>>
>>> On Mon, Jun 25, 2018 at 8:30 PM zcw  wrote:
>>>
 Thank you so much!
 I wanted to save the log to a specific file. I tried using the provided
 console but couldn't find where it stored the log message.

>>>
>>> On a closer look at the code, it seems that you *have to* provide a
>>> ConsoleDelegate if you want console.log to do anything.
>>>
>>>
 And could the ConsoleDelegate work for the release build?

>>>
>>> Yes, of course.
>>>
>>>
 On Monday, June 25, 2018 at 6:14:42 PM UTC-7, Jakob Kummerow wrote:

> V8 now provides its own "console" object, with the usual methods
> installed on it. Does it not serve your needs?
>
> You can override it by providing a ConsoleDelegate via the debug
> interface. The d8 shell (src/d8.cc) provides an example.
>
> On Mon, Jun 25, 2018 at 5:52 PM zwc  wrote:
>
>> Hello,
>> we are working on upgrading v8 from 5.3 to 6.7-lkgr.
>> But I recently found a strange behavior for one global object with
>> name "console".
>> In the old version, we have a global object "console" for logging
>> info.
>> But when upgraded to 6.7, the "console"'s callbacks functions won't
>> get called. I tested if I change the name from "console" to something 
>> else,
>> it will work as usual.
>> I am feeling like that "console"seems to become a reserved word for
>> the newer version?
>> May I know if this is expected? And if true, is there any workaround
>> to overwrite this behavior? we would want to keep our old "console" name.
>>
>> Thank you so much!
>>
>> --
>> --
>> v8-users mailing list
>> v8-u...@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+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
 --
 v8-users mailing list
 v8-u...@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+u...@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 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] Questions when adding global object

2018-06-27 Thread zcw
And actually is the consoleDelegate exposed in the .h files in the include 
directory? I saw it is defined in interface-types.h but if I were to 
include that, it will lead to a chain of includes from /src..
Am I misunderstanding something? 

Thanks!

On Wednesday, June 27, 2018 at 11:03:35 AM UTC-7, zcw wrote:
>
> Hello Jakob,
>
> May I get some more directions for using the consoleDelegate?
> From d8 files. I saw that we could make a console class and use set 
> consoleDelegate to set console functions.
> But in our old way, we create a global template for "console" and using 
> setAccessor to append functions to it. 
> Since I don't want to introduce too much code change. Is there a way to 
> keep the old usage (create as global template)? or is using consoleDelegate 
> the only way to specify console functions?
>
> Again thank you so much!
>
>
>
> On Monday, June 25, 2018 at 10:27:58 PM UTC-7, Jakob Kummerow wrote:
>>
>> On Mon, Jun 25, 2018 at 8:30 PM zcw  wrote:
>>
>>> Thank you so much!
>>> I wanted to save the log to a specific file. I tried using the provided 
>>> console but couldn't find where it stored the log message.
>>>
>>
>> On a closer look at the code, it seems that you *have to* provide a 
>> ConsoleDelegate if you want console.log to do anything.
>>  
>>
>>> And could the ConsoleDelegate work for the release build?
>>>
>>
>> Yes, of course.
>>  
>>
>>> On Monday, June 25, 2018 at 6:14:42 PM UTC-7, Jakob Kummerow wrote:
>>>
 V8 now provides its own "console" object, with the usual methods 
 installed on it. Does it not serve your needs?

 You can override it by providing a ConsoleDelegate via the debug 
 interface. The d8 shell (src/d8.cc) provides an example.

 On Mon, Jun 25, 2018 at 5:52 PM zwc  wrote:

> Hello, 
> we are working on upgrading v8 from 5.3 to 6.7-lkgr. 
> But I recently found a strange behavior for one global object with 
> name "console".
> In the old version, we have a global object "console" for logging 
> info. 
> But when upgraded to 6.7, the "console"'s callbacks functions won't 
> get called. I tested if I change the name from "console" to something 
> else, 
> it will work as usual. 
> I am feeling like that "console"seems to become a reserved word for 
> the newer version?
> May I know if this is expected? And if true, is there any workaround 
> to overwrite this behavior? we would want to keep our old "console" name.
>
> Thank you so much!
>
> -- 
> -- 
> v8-users mailing list
> v8-u...@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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
 -- 
>>> -- 
>>> v8-users mailing list
>>> v8-u...@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+u...@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.


Re: [v8-users] Questions when adding global object

2018-06-27 Thread zcw
Hello Jakob,

May I get some more directions for using the consoleDelegate?
>From d8 files. I saw that we could make a console class and use set 
consoleDelegate to set console functions.
But in our old way, we create a global template for "console" and using 
setAccessor to append functions to it. 
Since I don't want to introduce too much code change. Is there a way to 
keep the old usage (create as global template)? or is using consoleDelegate 
the only way to specify console functions?

Again thank you so much!



On Monday, June 25, 2018 at 10:27:58 PM UTC-7, Jakob Kummerow wrote:
>
> On Mon, Jun 25, 2018 at 8:30 PM zcw > 
> wrote:
>
>> Thank you so much!
>> I wanted to save the log to a specific file. I tried using the provided 
>> console but couldn't find where it stored the log message.
>>
>
> On a closer look at the code, it seems that you *have to* provide a 
> ConsoleDelegate if you want console.log to do anything.
>  
>
>> And could the ConsoleDelegate work for the release build?
>>
>
> Yes, of course.
>  
>
>> On Monday, June 25, 2018 at 6:14:42 PM UTC-7, Jakob Kummerow wrote:
>>
>>> V8 now provides its own "console" object, with the usual methods 
>>> installed on it. Does it not serve your needs?
>>>
>>> You can override it by providing a ConsoleDelegate via the debug 
>>> interface. The d8 shell (src/d8.cc) provides an example.
>>>
>>> On Mon, Jun 25, 2018 at 5:52 PM zwc  wrote:
>>>
 Hello, 
 we are working on upgrading v8 from 5.3 to 6.7-lkgr. 
 But I recently found a strange behavior for one global object with name 
 "console".
 In the old version, we have a global object "console" for logging info. 
 But when upgraded to 6.7, the "console"'s callbacks functions won't get 
 called. I tested if I change the name from "console" to something else, it 
 will work as usual. 
 I am feeling like that "console"seems to become a reserved word for the 
 newer version?
 May I know if this is expected? And if true, is there any workaround to 
 overwrite this behavior? we would want to keep our old "console" name.

 Thank you so much!

 -- 
 -- 
 v8-users mailing list
 v8-u...@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+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@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+u...@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.