Re: [v8-users] ArrayBuffer BackingStore mutex causing high system load

2020-10-20 Thread Andrew Johnston
Hi Ulan,

Thanks for the response. I will do that over next couple days. It could be 
an edge case or could be related to something stupid I am doing when 
running isolates on threads in the same process 
(https://github.com/just-js/just/blob/main/just.cc#L2722). When i use 
separate processes I don't see the contention/syscall overhead. Will see if 
i can make a small and reproducible case for a bug report.

Andrew 

On Tuesday, October 20, 2020 at 1:12:06 PM UTC+1 Ulan Degenbaev wrote:

> Hi Andrew!
>
> Could you please file a bug at crbug.com/v8 with steps to reproduce? We 
> will take a look and see if we can optimize this case.
>
> Until it is fixed, I think caching the backing store pointer in the 
> internal field would work. Then you'd need to ensure that you keep a handle 
> to ArrayBuffer while using the pointer (to prevent ArrayBuffer from being 
> garbage collected). Additionally, the pointer may become invalid if 
> ArrayBuffer is detached. You can detect that case by checking ByteLength() 
> == 0. 
>
> Cheers,
> Ulan.
>
> On Sun, Oct 18, 2020 at 12:45 AM billywhizz  wrote:
>
>> Hi,
>>
>> I have put some details here on an issue i have come across while doing 
>> some benchmarking: 
>> https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045
>>
>> I have a few questions around this:
>>
>> 1) Do we need a pthread_mutex_lock and pthread_mutex_unlock in every 
>> access to ArrayBuffer->GetBackingStore? In the absence of a deep dive into 
>> the code (which I will do soon hopefully) I am guessing this is in case the 
>> GC, which is running on another thread, has moved the backing data 
>> elsewhere.
>>
>> 2) If i want to access backing data at high frequency from JS (e.g. doing 
>> lots of writing or reading of an arraybuffer on a socket) is it possible 
>> (or advisable) to do something like this in order to avoid the lock 
>> contention in GetBackingStore? 
>> https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045#file-test-cc.
>>  
>> i.e. cache the pointer to the backing data in an internal field, assuming 
>> it will not be moved.
>>
>> 3) If the approach in 2) is not possible, is there a known approach to 
>> this problem which can avoid all the syscall overhead of locking the mutex?
>>
>> If you need more info or something easy to reproduce please let me know.
>>
>> Many Thanks,
>>
>> Andrew
>>
>> -- 
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/v8-users/a4ea069b-4271-4590-af99-4446a6a041e4n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/81d904e2-5e8c-48ec-bef9-a8e2f8384b25n%40googlegroups.com.


Re: [v8-users] ArrayBuffer BackingStore mutex causing high system load

2020-10-20 Thread 'Ulan Degenbaev' via v8-users
Hi Andrew!

Could you please file a bug at crbug.com/v8 with steps to reproduce? We
will take a look and see if we can optimize this case.

Until it is fixed, I think caching the backing store pointer in the
internal field would work. Then you'd need to ensure that you keep a handle
to ArrayBuffer while using the pointer (to prevent ArrayBuffer from being
garbage collected). Additionally, the pointer may become invalid if
ArrayBuffer is detached. You can detect that case by checking ByteLength()
== 0.

Cheers,
Ulan.

On Sun, Oct 18, 2020 at 12:45 AM billywhizz  wrote:

> Hi,
>
> I have put some details here on an issue i have come across while doing
> some benchmarking:
> https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045
>
> I have a few questions around this:
>
> 1) Do we need a pthread_mutex_lock and pthread_mutex_unlock in every
> access to ArrayBuffer->GetBackingStore? In the absence of a deep dive into
> the code (which I will do soon hopefully) I am guessing this is in case the
> GC, which is running on another thread, has moved the backing data
> elsewhere.
>
> 2) If i want to access backing data at high frequency from JS (e.g. doing
> lots of writing or reading of an arraybuffer on a socket) is it possible
> (or advisable) to do something like this in order to avoid the lock
> contention in GetBackingStore?
> https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045#file-test-cc.
> i.e. cache the pointer to the backing data in an internal field, assuming
> it will not be moved.
>
> 3) If the approach in 2) is not possible, is there a known approach to
> this problem which can avoid all the syscall overhead of locking the mutex?
>
> If you need more info or something easy to reproduce please let me know.
>
> Many Thanks,
>
> Andrew
>
> --
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/a4ea069b-4271-4590-af99-4446a6a041e4n%40googlegroups.com
> 
> .
>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CABNJt2LxOnoPKOjKss-xMo0Dcxcg6HqsQfmMRGwMjF2CfSB1Gw%40mail.gmail.com.


[v8-users] ArrayBuffer BackingStore mutex causing high system load

2020-10-17 Thread billywhizz
Hi,

I have put some details here on an issue i have come across while doing 
some 
benchmarking: 
https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045

I have a few questions around this:

1) Do we need a pthread_mutex_lock and pthread_mutex_unlock in every access 
to ArrayBuffer->GetBackingStore? In the absence of a deep dive into the 
code (which I will do soon hopefully) I am guessing this is in case the GC, 
which is running on another thread, has moved the backing data elsewhere.

2) If i want to access backing data at high frequency from JS (e.g. doing 
lots of writing or reading of an arraybuffer on a socket) is it possible 
(or advisable) to do something like this in order to avoid the lock 
contention in 
GetBackingStore? 
https://gist.github.com/billywhizz/ff4c83c37142198d2e70992e438bf045#file-test-cc.
 
i.e. cache the pointer to the backing data in an internal field, assuming 
it will not be moved.

3) If the approach in 2) is not possible, is there a known approach to this 
problem which can avoid all the syscall overhead of locking the mutex?

If you need more info or something easy to reproduce please let me know.

Many Thanks,

Andrew

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/a4ea069b-4271-4590-af99-4446a6a041e4n%40googlegroups.com.


Re: [v8-users] ArrayBuffer size is 0

2019-09-02 Thread Jonathan Doster
Simon,

Thank you so much for your answer!
That makes perfect sense

On Sun, Sep 1, 2019 at 10:31 PM 'Simon Zünd' via v8-users <
v8-users@googlegroups.com> wrote:

> Hey,
>
> You are not accessing the "size" property, but treat "args[0]" as if it
> were a number (which it is not, it's a ArrayBuffer). Since you have
> established that args[0] is an ArrayBuffer, you can use cast, which would
> look roughly like this:
>
> Local array_buffer = Local::cast(args[0]);
> size_t size = array_buffer->ByteLength();
>
>
> On Mon, Sep 2, 2019 at 12:50 AM Jonathan Doster 
> wrote:
>
>> Hey everyone!
>>
>> I am trying to pass an ArrayBuffer from JS to C++, and when I debug the
>> "size" variable is 0.
>> I do not understand what I am doing wrong, ultimately my goal is to be
>> able to read and write the buffer, copy, etc.
>> Thank you!!
>>
>> var api = require('../src/public/api')
>> api.Method(new ArrayBuffer([1, 2, 3, 4]))
>>
>> void Method(const v8::FunctionCallbackInfo )
>> {
>> CHECK_ARGS(args, args[0]->IsArrayBuffer());
>> uint32_t size = args[0]->Uint32Value();
>> }
>>
>>
>> --
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/v8-users/ed43b406-af94-49f1-94c2-47c09673379d%40googlegroups.com
>> 
>> .
>>
> --
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/CACswSC1LA6dT66X12EOTNTrG29St8tnnHYp8uqhwARtid4ijcA%40mail.gmail.com
> 
> .
>
-- 
Jonathan Doster 909.839.3432 jbdos...@gmail.com Please disregard any
spelling errors, this message was sent via mobile.

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CAPcdUY%2BFKic66ioqYcqbHC4cziMs5Ez796HArVNgqVTFePyxXA%40mail.gmail.com.


Re: [v8-users] ArrayBuffer size is 0

2019-09-01 Thread 'Simon Zünd' via v8-users
Hey,

You are not accessing the "size" property, but treat "args[0]" as if it
were a number (which it is not, it's a ArrayBuffer). Since you have
established that args[0] is an ArrayBuffer, you can use cast, which would
look roughly like this:

Local array_buffer = Local::cast(args[0]);
size_t size = array_buffer->ByteLength();


On Mon, Sep 2, 2019 at 12:50 AM Jonathan Doster  wrote:

> Hey everyone!
>
> I am trying to pass an ArrayBuffer from JS to C++, and when I debug the
> "size" variable is 0.
> I do not understand what I am doing wrong, ultimately my goal is to be
> able to read and write the buffer, copy, etc.
> Thank you!!
>
> var api = require('../src/public/api')
> api.Method(new ArrayBuffer([1, 2, 3, 4]))
>
> void Method(const v8::FunctionCallbackInfo )
> {
> CHECK_ARGS(args, args[0]->IsArrayBuffer());
> uint32_t size = args[0]->Uint32Value();
> }
>
>
> --
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/ed43b406-af94-49f1-94c2-47c09673379d%40googlegroups.com
> 
> .
>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CACswSC1LA6dT66X12EOTNTrG29St8tnnHYp8uqhwARtid4ijcA%40mail.gmail.com.


[v8-users] ArrayBuffer size is 0

2019-09-01 Thread Jonathan Doster
Hey everyone!

I am trying to pass an ArrayBuffer from JS to C++, and when I debug the 
"size" variable is 0. 
I do not understand what I am doing wrong, ultimately my goal is to be able 
to read and write the buffer, copy, etc.
Thank you!!

var api = require('../src/public/api')
api.Method(new ArrayBuffer([1, 2, 3, 4]))

void Method(const v8::FunctionCallbackInfo )
{
CHECK_ARGS(args, args[0]->IsArrayBuffer());
uint32_t size = args[0]->Uint32Value();
}


-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/ed43b406-af94-49f1-94c2-47c09673379d%40googlegroups.com.


Re: [v8-users] Arraybuffer

2018-10-01 Thread Michael Hablich
Hi Dan,

as already pointed out in this thread and other ones created by you: Please 
ask blink-related questions on blink-...@chromium.org. A good way to 
understand how something works is to check existing code as Caitlin already 
pointed out. Please use cs.chromium.org for this. If *after* consulting 
blink-...@chromium.org and cs.chromium.org you still have questions about 
the *V8 codebase*, feel free to ask questions on v8-users@googlegroups.com.

Cheers,
Michael

On Friday, September 28, 2018 at 2:39:31 PM UTC+2, dan Med wrote:
>
> I appreciate your help, but still i can't seem to just understand the 
> stack calls and if i do that then i like to understand what thing should i 
> do in the code to get v8 execute those lines, well if my prievous question 
> is out of scope for v8-users how can i understand how they work ? 
> There is no doc
>
> Il giorno ven 28 set 2018 alle ore 14:35 Caitlin Potter  > ha scritto:
>
>> That question is probably out of scope for v8-users. The good news is, 
>> cs.chromium.org is very good at finding when things are called, how 
>> they’re used, etc.
>>
>> -- 
>> -- 
>> 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] Arraybuffer

2018-09-28 Thread dan Med
I appreciate your help, but still i can't seem to just understand the stack
calls and if i do that then i like to understand what thing should i do in
the code to get v8 execute those lines, well if my prievous question is out
of scope for v8-users how can i understand how they work ?
There is no doc

Il giorno ven 28 set 2018 alle ore 14:35 Caitlin Potter 
ha scritto:

> That question is probably out of scope for v8-users. The good news is,
> cs.chromium.org is very good at finding when things are called, how
> they’re used, etc.
>
> --
> --
> 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] Arraybuffer and arraybufferbuilde

2018-09-27 Thread dan Med
What i'm looking generally is how to understand the code in general and by
this i mean the following
So processes in chrome talk to each other via the IPC, other than reading
the source code which just scratched the surface i want to understand from
the lowest point of the implementation and then navigate up
I don't know if i expressed my thoguth correctly or not, i saw this post
http://blog.azimuthsecurity.com/2010/08/chrome-sandbox-part-2-of-3-ipc.html
and it gave me so much Knowledge rather than reading the chromium docs i
know this is for v8... but the concept remains the same
I'm trying to understand where in the code v8 will create my arraybuffer
and maybe where in the renderer it will call such thing and keep getting
lower and lower. I like to put it this way i need to understand how to get
to the lowest point of a desired function of implementation that im
interested to understand and then walk my way up in the code.
one thing that keeps me (i'm getting something wrong is that for every
topic i want to understand (in depth but not as deep as someone might
think) i keep getting just classes i don't see any c++ invovled in creating
javascirpt functions things like that (can't find the slice function ...) i
keep just finding classes (ofc this is c++ i know) but still i think those
classes will be called by a renderer process (X) which will fill that class
with some data D but how ? i can't read that part...
One more thing i didn't find anything intereting in how v8 translates
javascript just classes upon classes. There isn't any code ( i know i'm
wrong but i'm pretty sure that i'm searchig correctly since i'm using
cs.chromium.org to surf the code just because if i need to click a function
it will bring me there to see how it is implemented )
Thank you

Il giorno gio 27 set 2018 alle ore 20:31  ha
scritto:

> 1) Can someone help me understand how v8 will parse my arraybuffer
> specified in one of my scripts ? If you could supply the links to the
> source code that does this function it will be helpful.
>
>
> 2) When is  ArrayBufferBuilder::Append called ?
>
> --
> --
> 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] Arraybuffer

2018-09-24 Thread J Decker
On Mon, Sep 24, 2018 at 2:18 PM dan Med  wrote:

> When is it called ?
>
It never is; It doesn't even exist in V8.

>
> On Thu, 20 Sep 2018 at 07:03, dan Med  wrote:
>
>> Ok but then can someone give me a big picture of the directories ? And
>> how the code is generally structured ?
>> Or how is ArrayBufferBuilder:append called ?
>>
>> On Thu, 20 Sep 2018 at 00:14, Peter Schow  wrote:
>>
>>> On Wed, Sep 19, 2018 at 2:36 PM dan Med  wrote:
>>> > This is how I see it atm
>>> > Each tab is a process that is composed of several threads, this
>>> process is sandboxed with the Windows kernel security ( on Windows )
>>> > Then we have WebKit which is the rendered thread inside of this main
>>> tab (thread) which as the name implies will render the page.
>>> > When in the renderer process is v8 called ?
>>> > Or when WebKit is executing UI things v8 is also running JavaScript
>>> code ?
>>>
>>> This mailing list is about V8 itself, not arbitrary consumers (there
>>> are many) of V8.  Do you understand the difference?  V8 has no notion
>>> of "tabs", "WebKit", "renderer process", or "UI".  I suggest you find
>>> another place to ask your questions.
>>>
>>> --
>>> --
>>> 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 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] Arraybuffer

2018-09-24 Thread dan Med
When is it called ?

On Thu, 20 Sep 2018 at 07:03, dan Med  wrote:

> Ok but then can someone give me a big picture of the directories ? And how
> the code is generally structured ?
> Or how is ArrayBufferBuilder:append called ?
>
> On Thu, 20 Sep 2018 at 00:14, Peter Schow  wrote:
>
>> On Wed, Sep 19, 2018 at 2:36 PM dan Med  wrote:
>> > This is how I see it atm
>> > Each tab is a process that is composed of several threads, this process
>> is sandboxed with the Windows kernel security ( on Windows )
>> > Then we have WebKit which is the rendered thread inside of this main
>> tab (thread) which as the name implies will render the page.
>> > When in the renderer process is v8 called ?
>> > Or when WebKit is executing UI things v8 is also running JavaScript
>> code ?
>>
>> This mailing list is about V8 itself, not arbitrary consumers (there
>> are many) of V8.  Do you understand the difference?  V8 has no notion
>> of "tabs", "WebKit", "renderer process", or "UI".  I suggest you find
>> another place to ask your questions.
>>
>> --
>> --
>> 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] Arraybuffer

2018-09-19 Thread dan Med
Ok but then can someone give me a big picture of the directories ? And how
the code is generally structured ?
Or how is ArrayBufferBuilder:append called ?

On Thu, 20 Sep 2018 at 00:14, Peter Schow  wrote:

> On Wed, Sep 19, 2018 at 2:36 PM dan Med  wrote:
> > This is how I see it atm
> > Each tab is a process that is composed of several threads, this process
> is sandboxed with the Windows kernel security ( on Windows )
> > Then we have WebKit which is the rendered thread inside of this main tab
> (thread) which as the name implies will render the page.
> > When in the renderer process is v8 called ?
> > Or when WebKit is executing UI things v8 is also running JavaScript code
> ?
>
> This mailing list is about V8 itself, not arbitrary consumers (there
> are many) of V8.  Do you understand the difference?  V8 has no notion
> of "tabs", "WebKit", "renderer process", or "UI".  I suggest you find
> another place to ask your questions.
>
> --
> --
> 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] Arraybuffer

2018-09-19 Thread Peter Schow
On Wed, Sep 19, 2018 at 2:36 PM dan Med  wrote:
> This is how I see it atm
> Each tab is a process that is composed of several threads, this process is 
> sandboxed with the Windows kernel security ( on Windows )
> Then we have WebKit which is the rendered thread inside of this main tab 
> (thread) which as the name implies will render the page.
> When in the renderer process is v8 called ?
> Or when WebKit is executing UI things v8 is also running JavaScript code ?

This mailing list is about V8 itself, not arbitrary consumers (there
are many) of V8.  Do you understand the difference?  V8 has no notion
of "tabs", "WebKit", "renderer process", or "UI".  I suggest you find
another place to ask your questions.

-- 
-- 
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] Arraybuffer

2018-09-19 Thread dan Med
This is how I see it atm
Each tab is a process that is composed of several threads, this process is
sandboxed with the Windows kernel security ( on Windows )
Then we have WebKit which is the rendered thread inside of this main tab
(thread) which as the name implies will render the page.
When in the renderer process is v8 called ?
Or when WebKit is executing UI things v8 is also running JavaScript code ?

Last thing is when ArrayBufferBuilder:append is called ?

On Wed, 19 Sep 2018 at 18:39, dan Med  wrote:

> Ok so when is arraybufferbuilde:append called ?
>
> On Wed, 19 Sep 2018 at 12:36, @soylentgraham 
> wrote:
>
>> Not sure where to start with this message
>>
>> a) Not even vaguely related to the original topic, you should start a new
>> thread when the topic is wildly different.
>> b) Do not start a new thread.
>> c) This code is from libav (or actually, maybe ffmpeg). av_XXX are
>> macros, functions and other values. The AV prefix is a hint to the user
>> (you) that it's part of the av library. AV stands for audio/visual (or I
>> suppose, audio/video these days)
>> d) This is a question that should be on www.stackoverflow.com
>> e) Please do not reply to this message. (at least regarding this new
>> topic)
>>
>>
>> On Tuesday, 18 September 2018 21:15:42 UTC+1, dan Med wrote:
>>
>>> I was reading this code but i can't figure outwhat av_..._.. stands for
>>> is it already opening the connection here?
>>>
>>> static int tcp_open(URLContext *h, const char *uri, int flags){struct 
>>> addrinfo hints = { 0 }, *ai, *cur_ai;int port, fd = -1;TCPContext 
>>> *s = h->priv_data;const char *p;char buf[256];int ret;char 
>>> hostname[1024],proto[1024],path[1024];char portstr[10];
>>> s->open_timeout = 500;av_url_split(proto, sizeof(proto), NULL, 0, 
>>> hostname, sizeof(hostname),, path, sizeof(path), uri);if 
>>> (strcmp(proto, "tcp"))return AVERROR(EINVAL);if (port <= 0 || 
>>> port >= 65536) {av_log(h, AV_LOG_ERROR, "Port missing in uri\n");   
>>>  return AVERROR(EINVAL);}p = strchr(uri, '?');if (p) {  
>>>   if (av_find_info_tag(buf, sizeof(buf), "listen", p)) {char 
>>> *endptr = NULL;s->listen = strtol(buf, , 10);
>>> /* assume if no digits were found it is a request to enable it */   
>>>  if (buf == endptr)s->listen = 1;}if 
>>> (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
>>> s->rw_timeout = strtol(buf, NULL, 10);}if 
>>> (av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) {
>>> s->listen_timeout = strtol(buf, NULL, 10);}}if 
>>> (s->rw_timeout >= 0) {s->open_timeout =h->rw_timeout   = 
>>> s->rw_timeout;}hints.ai_family = AF_UNSPEC;hints.ai_socktype = 
>>> SOCK_STREAM;snprintf(portstr, sizeof(portstr), "%d", port);if 
>>> (s->listen)hints.ai_flags |= AI_PASSIVE;if (!hostname[0])   
>>>  ret = getaddrinfo(NULL, portstr, , );elseret = 
>>> getaddrinfo(hostname, portstr, , );if (ret) {av_log(h, 
>>> AV_LOG_ERROR,   "Failed to resolve hostname %s: %s\n",  
>>>  hostname, gai_strerror(ret));return AVERROR(EIO);}
>>> cur_ai = ai; restart:#if HAVE_STRUCT_SOCKADDR_IN6// workaround for IOS9 
>>> getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve 
>>> port number.if (cur_ai->ai_family == AF_INET6){struct 
>>> sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
>>> if (!sockaddr_v6->sin6_port){sockaddr_v6->sin6_port = 
>>> htons(port);}}#endiffd = ff_socket(cur_ai->ai_family,   
>>> cur_ai->ai_socktype,   cur_ai->ai_protocol);
>>> if (fd < 0) {ret = ff_neterrno();goto fail;}/* Set 
>>> the socket's send or receive buffer sizes, if specified.   If 
>>> unspecified or setting fails, system default is used. */if 
>>> (s->recv_buffer_size > 0) {setsockopt (fd, SOL_SOCKET, SO_RCVBUF, 
>>> >recv_buffer_size, sizeof (s->recv_buffer_size));}if 
>>> (s->send_buffer_size > 0) {setsockopt (fd, SOL_SOCKET, SO_SNDBUF, 
>>> >send_buffer_size, sizeof (s->send_buffer_size));}if 
>>> (s->tcp_nodelay > 0) {setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, 
>>> >tcp_nodelay, sizeof (s->tcp_nodelay));}if (s->listen == 2) {
>>> // multi-clientif ((ret = ff_listen(fd, cur_ai->ai_addr, 
>>> cur_ai->ai_addrlen)) < 0)goto fail1;} else if (s->listen == 
>>> 1) {// single clientif ((ret = ff_listen_bind(fd, 
>>> cur_ai->ai_addr, cur_ai->ai_addrlen,  
>>> s->listen_timeout, h)) < 0)goto fail1;// Socket 
>>> descriptor already closed here. Safe to overwrite to client one.fd 
>>> = ret;  

Re: [v8-users] Arraybuffer

2018-09-19 Thread dan Med
Ok so when is arraybufferbuilde:append called ?

On Wed, 19 Sep 2018 at 12:36, @soylentgraham 
wrote:

> Not sure where to start with this message
>
> a) Not even vaguely related to the original topic, you should start a new
> thread when the topic is wildly different.
> b) Do not start a new thread.
> c) This code is from libav (or actually, maybe ffmpeg). av_XXX are macros,
> functions and other values. The AV prefix is a hint to the user (you) that
> it's part of the av library. AV stands for audio/visual (or I suppose,
> audio/video these days)
> d) This is a question that should be on www.stackoverflow.com
> e) Please do not reply to this message. (at least regarding this new topic)
>
>
> On Tuesday, 18 September 2018 21:15:42 UTC+1, dan Med wrote:
>
>> I was reading this code but i can't figure outwhat av_..._.. stands for
>> is it already opening the connection here?
>>
>> static int tcp_open(URLContext *h, const char *uri, int flags){struct 
>> addrinfo hints = { 0 }, *ai, *cur_ai;int port, fd = -1;TCPContext *s 
>> = h->priv_data;const char *p;char buf[256];int ret;char 
>> hostname[1024],proto[1024],path[1024];char portstr[10];
>> s->open_timeout = 500;av_url_split(proto, sizeof(proto), NULL, 0, 
>> hostname, sizeof(hostname),, path, sizeof(path), uri);if 
>> (strcmp(proto, "tcp"))return AVERROR(EINVAL);if (port <= 0 || 
>> port >= 65536) {av_log(h, AV_LOG_ERROR, "Port missing in uri\n");
>> return AVERROR(EINVAL);}p = strchr(uri, '?');if (p) {
>> if (av_find_info_tag(buf, sizeof(buf), "listen", p)) {char 
>> *endptr = NULL;s->listen = strtol(buf, , 10);
>> /* assume if no digits were found it is a request to enable it */
>> if (buf == endptr)s->listen = 1;}if 
>> (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
>> s->rw_timeout = strtol(buf, NULL, 10);}if 
>> (av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) {
>> s->listen_timeout = strtol(buf, NULL, 10);}}if 
>> (s->rw_timeout >= 0) {s->open_timeout =h->rw_timeout   = 
>> s->rw_timeout;}hints.ai_family = AF_UNSPEC;hints.ai_socktype = 
>> SOCK_STREAM;snprintf(portstr, sizeof(portstr), "%d", port);if 
>> (s->listen)hints.ai_flags |= AI_PASSIVE;if (!hostname[0])
>> ret = getaddrinfo(NULL, portstr, , );elseret = 
>> getaddrinfo(hostname, portstr, , );if (ret) {av_log(h, 
>> AV_LOG_ERROR,   "Failed to resolve hostname %s: %s\n",   
>> hostname, gai_strerror(ret));return AVERROR(EIO);}cur_ai 
>> = ai; restart:#if HAVE_STRUCT_SOCKADDR_IN6// workaround for IOS9 
>> getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve 
>> port number.if (cur_ai->ai_family == AF_INET6){struct 
>> sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
>> if (!sockaddr_v6->sin6_port){sockaddr_v6->sin6_port = 
>> htons(port);}}#endiffd = ff_socket(cur_ai->ai_family,
>>cur_ai->ai_socktype,   cur_ai->ai_protocol);
>> if (fd < 0) {ret = ff_neterrno();goto fail;}/* Set 
>> the socket's send or receive buffer sizes, if specified.   If 
>> unspecified or setting fails, system default is used. */if 
>> (s->recv_buffer_size > 0) {setsockopt (fd, SOL_SOCKET, SO_RCVBUF, 
>> >recv_buffer_size, sizeof (s->recv_buffer_size));}if 
>> (s->send_buffer_size > 0) {setsockopt (fd, SOL_SOCKET, SO_SNDBUF, 
>> >send_buffer_size, sizeof (s->send_buffer_size));}if 
>> (s->tcp_nodelay > 0) {setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, 
>> >tcp_nodelay, sizeof (s->tcp_nodelay));}if (s->listen == 2) { 
>>// multi-clientif ((ret = ff_listen(fd, cur_ai->ai_addr, 
>> cur_ai->ai_addrlen)) < 0)goto fail1;} else if (s->listen == 
>> 1) {// single clientif ((ret = ff_listen_bind(fd, 
>> cur_ai->ai_addr, cur_ai->ai_addrlen,  
>> s->listen_timeout, h)) < 0)goto fail1;// Socket 
>> descriptor already closed here. Safe to overwrite to client one.fd = 
>> ret;} else {if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, 
>> cur_ai->ai_addrlen, s->open_timeout / 
>> 1000, h, !!cur_ai->ai_next)) < 0) {if (ret == AVERROR_EXIT)  
>>   goto fail1;elsegoto fail;}
>> }h->is_streamed = 1;s->fd = fd;freeaddrinfo(ai);return 0; 
>> fail:if (cur_ai->ai_next) {/* Retry with the next sockaddr */
>> cur_ai = cur_ai->ai_next;if (fd >= 0)
>> closesocket(fd);ret = 0;goto restart;  

Re: [v8-users] Arraybuffer

2018-09-19 Thread @soylentgraham
Not sure where to start with this message

a) Not even vaguely related to the original topic, you should start a new 
thread when the topic is wildly different.
b) Do not start a new thread.
c) This code is from libav (or actually, maybe ffmpeg). av_XXX are macros, 
functions and other values. The AV prefix is a hint to the user (you) that 
it's part of the av library. AV stands for audio/visual (or I suppose, 
audio/video these days)
d) This is a question that should be on www.stackoverflow.com
e) Please do not reply to this message. (at least regarding this new topic)

On Tuesday, 18 September 2018 21:15:42 UTC+1, dan Med wrote:
>
> I was reading this code but i can't figure outwhat av_..._.. stands for 
> is it already opening the connection here?
>
> static int tcp_open(URLContext *h, const char *uri, int flags){struct 
> addrinfo hints = { 0 }, *ai, *cur_ai;int port, fd = -1;TCPContext *s 
> = h->priv_data;const char *p;char buf[256];int ret;char 
> hostname[1024],proto[1024],path[1024];char portstr[10];
> s->open_timeout = 500;av_url_split(proto, sizeof(proto), NULL, 0, 
> hostname, sizeof(hostname),, path, sizeof(path), uri);if 
> (strcmp(proto, "tcp"))return AVERROR(EINVAL);if (port <= 0 || 
> port >= 65536) {av_log(h, AV_LOG_ERROR, "Port missing in uri\n"); 
>return AVERROR(EINVAL);}p = strchr(uri, '?');if (p) {
> if (av_find_info_tag(buf, sizeof(buf), "listen", p)) {char 
> *endptr = NULL;s->listen = strtol(buf, , 10);
> /* assume if no digits were found it is a request to enable it */
> if (buf == endptr)s->listen = 1;}if 
> (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {s->rw_timeout 
> = strtol(buf, NULL, 10);}if (av_find_info_tag(buf, 
> sizeof(buf), "listen_timeout", p)) {s->listen_timeout = 
> strtol(buf, NULL, 10);}}if (s->rw_timeout >= 0) {
> s->open_timeout =h->rw_timeout   = s->rw_timeout;}
> hints.ai_family = AF_UNSPEC;hints.ai_socktype = SOCK_STREAM;
> snprintf(portstr, sizeof(portstr), "%d", port);if (s->listen)
> hints.ai_flags |= AI_PASSIVE;if (!hostname[0])ret = 
> getaddrinfo(NULL, portstr, , );elseret = 
> getaddrinfo(hostname, portstr, , );if (ret) {av_log(h, 
> AV_LOG_ERROR,   "Failed to resolve hostname %s: %s\n",
>hostname, gai_strerror(ret));return AVERROR(EIO);}cur_ai = 
> ai; restart:#if HAVE_STRUCT_SOCKADDR_IN6// workaround for IOS9 
> getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve 
> port number.if (cur_ai->ai_family == AF_INET6){struct 
> sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
> if (!sockaddr_v6->sin6_port){sockaddr_v6->sin6_port = 
> htons(port);}}#endiffd = ff_socket(cur_ai->ai_family, 
>   cur_ai->ai_socktype,   cur_ai->ai_protocol);if 
> (fd < 0) {ret = ff_neterrno();goto fail;}/* Set the 
> socket's send or receive buffer sizes, if specified.   If unspecified or 
> setting fails, system default is used. */if (s->recv_buffer_size > 0) {   
>  setsockopt (fd, SOL_SOCKET, SO_RCVBUF, >recv_buffer_size, sizeof 
> (s->recv_buffer_size));}if (s->send_buffer_size > 0) {
> setsockopt (fd, SOL_SOCKET, SO_SNDBUF, >send_buffer_size, sizeof 
> (s->send_buffer_size));}if (s->tcp_nodelay > 0) {setsockopt 
> (fd, IPPROTO_TCP, TCP_NODELAY, >tcp_nodelay, sizeof (s->tcp_nodelay));
> }if (s->listen == 2) {// multi-clientif ((ret = 
> ff_listen(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) < 0)goto 
> fail1;} else if (s->listen == 1) {// single clientif 
> ((ret = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,   
>s->listen_timeout, h)) < 0)goto fail1;
> // Socket descriptor already closed here. Safe to overwrite to client one.
> fd = ret;} else {if ((ret = ff_listen_connect(fd, 
> cur_ai->ai_addr, cur_ai->ai_addrlen, 
> s->open_timeout / 1000, h, !!cur_ai->ai_next)) < 0) {if (ret == 
> AVERROR_EXIT)goto fail1;elsegoto 
> fail;}}h->is_streamed = 1;s->fd = fd;
> freeaddrinfo(ai);return 0; fail:if (cur_ai->ai_next) {/* 
> Retry with the next sockaddr */cur_ai = cur_ai->ai_next;if 
> (fd >= 0)closesocket(fd);ret = 0;goto restart;
> } fail1:if (fd >= 0)closesocket(fd);freeaddrinfo(ai);
> return ret;}
>
>
> Il giorno mar 18 set 2018 alle ore 21:54 dan Med  > ha scritto:
>
>> I know that i 

Re: [v8-users] Arraybuffer

2018-09-18 Thread dan Med
I was reading this code but i can't figure outwhat av_..._.. stands for
is it already opening the connection here?

static int tcp_open(URLContext *h, const char *uri, int flags){
struct addrinfo hints = { 0 }, *ai, *cur_ai;int port, fd = -1;
TCPContext *s = h->priv_data;const char *p;char buf[256];
int ret;char hostname[1024],proto[1024],path[1024];char
portstr[10];s->open_timeout = 500;av_url_split(proto,
sizeof(proto), NULL, 0, hostname, sizeof(hostname),,
path, sizeof(path), uri);if (strcmp(proto, "tcp"))return
AVERROR(EINVAL);if (port <= 0 || port >= 65536) {av_log(h,
AV_LOG_ERROR, "Port missing in uri\n");return AVERROR(EINVAL);
   }p = strchr(uri, '?');if (p) {if
(av_find_info_tag(buf, sizeof(buf), "listen", p)) {char
*endptr = NULL;s->listen = strtol(buf, , 10);
 /* assume if no digits were found it is a request to enable it */
   if (buf == endptr)s->listen = 1;}
 if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
 s->rw_timeout = strtol(buf, NULL, 10);}if
(av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) {
s->listen_timeout = strtol(buf, NULL, 10);}}if
(s->rw_timeout >= 0) {s->open_timeout =h->rw_timeout
= s->rw_timeout;}hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;snprintf(portstr, sizeof(portstr),
"%d", port);if (s->listen)hints.ai_flags |= AI_PASSIVE;
if (!hostname[0])ret = getaddrinfo(NULL, portstr, ,
);elseret = getaddrinfo(hostname, portstr, ,
);if (ret) {av_log(h, AV_LOG_ERROR,
"Failed to resolve hostname %s: %s\n",   hostname,
gai_strerror(ret));return AVERROR(EIO);}cur_ai = ai;
restart:#if HAVE_STRUCT_SOCKADDR_IN6// workaround for IOS9
getaddrinfo in IPv6 only network use hardcode IPv4 address can not
resolve port number.if (cur_ai->ai_family == AF_INET6){
struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6
*)cur_ai->ai_addr;if (!sockaddr_v6->sin6_port){
sockaddr_v6->sin6_port = htons(port);}}#endiffd =
ff_socket(cur_ai->ai_family,   cur_ai->ai_socktype,
   cur_ai->ai_protocol);if (fd < 0) {ret =
ff_neterrno();goto fail;}/* Set the socket's send or
receive buffer sizes, if specified.   If unspecified or setting
fails, system default is used. */if (s->recv_buffer_size > 0) {
setsockopt (fd, SOL_SOCKET, SO_RCVBUF, >recv_buffer_size,
sizeof (s->recv_buffer_size));}if (s->send_buffer_size > 0) {
  setsockopt (fd, SOL_SOCKET, SO_SNDBUF, >send_buffer_size,
sizeof (s->send_buffer_size));}if (s->tcp_nodelay > 0) {
 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, >tcp_nodelay, sizeof
(s->tcp_nodelay));}if (s->listen == 2) {//
multi-clientif ((ret = ff_listen(fd, cur_ai->ai_addr,
cur_ai->ai_addrlen)) < 0)goto fail1;} else if
(s->listen == 1) {// single clientif ((ret =
ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
  s->listen_timeout, h)) < 0)goto fail1;
 // Socket descriptor already closed here. Safe to overwrite to
client one.fd = ret;} else {if ((ret =
ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
s->open_timeout / 1000, h, !!cur_ai->ai_next))
< 0) {if (ret == AVERROR_EXIT)goto fail1;
  elsegoto fail;}}
h->is_streamed = 1;s->fd = fd;freeaddrinfo(ai);return 0;
fail:if (cur_ai->ai_next) {/* Retry with the next sockaddr
*/cur_ai = cur_ai->ai_next;if (fd >= 0)
closesocket(fd);ret = 0;goto restart;} fail1:
if (fd >= 0)closesocket(fd);freeaddrinfo(ai);return
ret;}


Il giorno mar 18 set 2018 alle ore 21:54 dan Med 
ha scritto:

> I know that i might have written the same thing over and over again but i
> didn't get an answer (which i really need)
>
> When is ArrayBufferBuilder::Append called ?
> Thank you
>
> Il giorno sab 15 set 2018 alle ore 12:34 dan Med 
> ha scritto:
>
>> That’s all.
>>
>> On Fri, 14 Sep 2018 at 21:53, dan Med  wrote:
>>
>>> I don’t understand how that code could be helpful to me..
>>>
>>> On Fri, 14 Sep 2018 at 21:51, dan Med  wrote:
>>>
 Technica question, when Arraybufferbuilder:append will be called ?

 On Fri, 14 Sep 2018 at 01:14, Peter Schow  wrote:

> On Thu, Sep 13, 2018 at 10:45 AM dan Med 
> wrote:
> > That isn’t my question
> > Arraybufferbuilder:append how could I get that to be called.
> > What I really need is a little guidance on how to understand how v8
> will parse my JavaScript script and how it will allocate the data.
> > Maybe even how a buffer or if there’s something that describes how
> 

Re: [v8-users] Arraybuffer

2018-09-15 Thread dan Med
That’s all.

On Fri, 14 Sep 2018 at 21:53, dan Med  wrote:

> I don’t understand how that code could be helpful to me..
>
> On Fri, 14 Sep 2018 at 21:51, dan Med  wrote:
>
>> Technica question, when Arraybufferbuilder:append will be called ?
>>
>> On Fri, 14 Sep 2018 at 01:14, Peter Schow  wrote:
>>
>>> On Thu, Sep 13, 2018 at 10:45 AM dan Med 
>>> wrote:
>>> > That isn’t my question
>>> > Arraybufferbuilder:append how could I get that to be called.
>>> > What I really need is a little guidance on how to understand how v8
>>> will parse my JavaScript script and how it will allocate the data.
>>> > Maybe even how a buffer or if there’s something that describes how
>>> buffers are handeled or if there’s a file or code that tells me that not
>>> the memory I know... just how it will execute it that’s all
>>>
>>> Starting with the sample REPL code at:
>>>  https://github.com/v8/v8/blob/master/samples/shell.cc
>>>
>>> could answer your questions.  In the days that you've been pursuing
>>> this, you could have traced all this by now.  Good luck.
>>>
>>> --
>>> --
>>> 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] Arraybuffer

2018-09-14 Thread dan Med
Technica question, when Arraybufferbuilder:append will be called ?

On Fri, 14 Sep 2018 at 01:14, Peter Schow  wrote:

> On Thu, Sep 13, 2018 at 10:45 AM dan Med  wrote:
> > That isn’t my question
> > Arraybufferbuilder:append how could I get that to be called.
> > What I really need is a little guidance on how to understand how v8 will
> parse my JavaScript script and how it will allocate the data.
> > Maybe even how a buffer or if there’s something that describes how
> buffers are handeled or if there’s a file or code that tells me that not
> the memory I know... just how it will execute it that’s all
>
> Starting with the sample REPL code at:
>  https://github.com/v8/v8/blob/master/samples/shell.cc
>
> could answer your questions.  In the days that you've been pursuing
> this, you could have traced all this by now.  Good luck.
>
> --
> --
> 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] Arraybuffer

2018-09-13 Thread Peter Schow
On Thu, Sep 13, 2018 at 10:45 AM dan Med  wrote:
> That isn’t my question
> Arraybufferbuilder:append how could I get that to be called.
> What I really need is a little guidance on how to understand how v8 will 
> parse my JavaScript script and how it will allocate the data.
> Maybe even how a buffer or if there’s something that describes how buffers 
> are handeled or if there’s a file or code that tells me that not the memory I 
> know... just how it will execute it that’s all

Starting with the sample REPL code at:
 https://github.com/v8/v8/blob/master/samples/shell.cc

could answer your questions.  In the days that you've been pursuing
this, you could have traced all this by now.  Good luck.

-- 
-- 
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] Arraybuffer

2018-09-13 Thread dan Med
That isn’t my question
Arraybufferbuilder:append how could I get that to be called.
What I really need is a little guidance on how to understand how v8 will
parse my JavaScript script and how it will allocate the data.
Maybe even how a buffer or if there’s something that describes how buffers
are handeled or if there’s a file or code that tells me that not the memory
I know... just how it will execute it that’s all

On Thu, 13 Sep 2018 at 18:42, J Decker  wrote:

>
>
> On Thu, Sep 13, 2018 at 9:21 AM dan Med  wrote:
>
>> Still no one ?
>>
> I dont know how I could have been more clear about the memory.
> https://groups.google.com/d/msg/v8-users/MNpTNiRaBmM/Muz5-KHpBgAJ
>
> Why do you think there is some magic to the buffer of an arraybuffer?
> It's just continuous bytes in memory.  Especially well suited for
> communicating arrays of data to WebGL.
>
>
>> On Thu, 13 Sep 2018 at 16:31, dan Med  wrote:
>>
>>> Okay I will but, how could I be sure when blink on the renderer process
>>> executes arraybufferbuilder ??
>>> Or one more thing, can u redirect me to checkout how v8 represents data
>>> in memory, how would it handle arraybuffers?
>>> The only thing I’ve managed to find ( in the github repo ) was a
>>> JavaScript file which contained if I remember correctly, 2 definitions of
>>> sorting algorithms.
>>>
>>> On Thu, 13 Sep 2018 at 16:23, @soylentgraham 
>>> wrote:
>>>
 You seem to be purposely ignoring the responses to your questions.

 If you still want help, build v8, build a program, breakpoint the
 function you want to see is called, debug it (this alone answers all your
 questions), then come back if you still have a VERY SPECIFIC question.


 On Thursday, 13 September 2018 15:15:03 UTC+1, dan Med wrote:
>
> No one is willingly to help me  ?
>
> On Wed, 12 Sep 2018 at 20:34, dan Med  wrote:
>
>> Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it
>> is actually called in blink ?
>> Cause by the name it has to do with Arraybuffers..
>> Plus if i build v8 so i can examine the memory layout, where is the
>> code on how v8 handeles arraybuffer ?
>> Where is the doc or some source where there's explained how v8
>> represents object in memory, how can i be sure that in memory i'm not
>> starrying at a pointer instead of an object or something like that...
>>
>> Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
>> jkum...@chromium.org> ha scritto:
>>
>>> On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:
>>>
 But can someone help me understand the arraybuffer part ? How to
 call arraybuffer::append and when I create an instance of a 
 arraybuffer it
 will create it with maximum size so 37... bytes and will only say that 
 the
 bytes used are the one which I’ve declared ?

>>>
>>> There is no ArrayBuffer::Append. Read closely: you've found
>>> ArrayBuffer*Builder*::Append, which is some implementation detail
>>> in Blink (not V8). I don't know when it's called, but I've pointed out
>>> before how you can find out. When you use ArrayBuffer objects in
>>> JavaScript, then that code is not executed at all.
>>>
>>> And when you create an ArrayBuffer(10) in JavaScript, it definitely
>>> does not allocate 32KB of memory. It'll round up to the nearest 
>>> multiple of
>>> a pointer size.
>>>
>>> On Wed, Sep 12, 2018 at 10:09 AM dan Med 
>>> wrote:
>>>
 Oh one more thing, so each tab in chrome is handeled as a single
 process, but Is the same process sandboxes with the Windows 10 kernel.
 Security or there’s another process which is sandboxes and then the 
 main
 tab process the ( renderer ) is executed inside of it ?

>>>
>>> That's a completely unrelated question which has nothing to do with
>>> V8 and does not belong in this thread. I suggest to look around on
>>> http://dev.chromium.org/developers for a bunch of things that have
>>> been explained before.
>>>
>>> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>
>> On Tue, Sep 11, 2018 at 2:09 PM dan Med 
>> wrote:
>> >
>> > Would you suggest to build v8 such that I can debug it as I
>> want ?
>>
>> It's difficult to go wrong with this approach if you want to
>> better
>> understand V8 or any large, complex system.
>>
>> --
>> --
>> 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, 

Re: [v8-users] Arraybuffer

2018-09-13 Thread J Decker
On Thu, Sep 13, 2018 at 9:21 AM dan Med  wrote:

> Still no one ?
>
I dont know how I could have been more clear about the memory.
https://groups.google.com/d/msg/v8-users/MNpTNiRaBmM/Muz5-KHpBgAJ

Why do you think there is some magic to the buffer of an arraybuffer?  It's
just continuous bytes in memory.  Especially well suited for communicating
arrays of data to WebGL.


> On Thu, 13 Sep 2018 at 16:31, dan Med  wrote:
>
>> Okay I will but, how could I be sure when blink on the renderer process
>> executes arraybufferbuilder ??
>> Or one more thing, can u redirect me to checkout how v8 represents data
>> in memory, how would it handle arraybuffers?
>> The only thing I’ve managed to find ( in the github repo ) was a
>> JavaScript file which contained if I remember correctly, 2 definitions of
>> sorting algorithms.
>>
>> On Thu, 13 Sep 2018 at 16:23, @soylentgraham 
>> wrote:
>>
>>> You seem to be purposely ignoring the responses to your questions.
>>>
>>> If you still want help, build v8, build a program, breakpoint the
>>> function you want to see is called, debug it (this alone answers all your
>>> questions), then come back if you still have a VERY SPECIFIC question.
>>>
>>>
>>> On Thursday, 13 September 2018 15:15:03 UTC+1, dan Med wrote:

 No one is willingly to help me  ?

 On Wed, 12 Sep 2018 at 20:34, dan Med  wrote:

> Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it is
> actually called in blink ?
> Cause by the name it has to do with Arraybuffers..
> Plus if i build v8 so i can examine the memory layout, where is the
> code on how v8 handeles arraybuffer ?
> Where is the doc or some source where there's explained how v8
> represents object in memory, how can i be sure that in memory i'm not
> starrying at a pointer instead of an object or something like that...
>
> Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
> jkum...@chromium.org> ha scritto:
>
>> On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:
>>
>>> But can someone help me understand the arraybuffer part ? How to
>>> call arraybuffer::append and when I create an instance of a arraybuffer 
>>> it
>>> will create it with maximum size so 37... bytes and will only say that 
>>> the
>>> bytes used are the one which I’ve declared ?
>>>
>>
>> There is no ArrayBuffer::Append. Read closely: you've found
>> ArrayBuffer*Builder*::Append, which is some implementation detail in
>> Blink (not V8). I don't know when it's called, but I've pointed out 
>> before
>> how you can find out. When you use ArrayBuffer objects in JavaScript, 
>> then
>> that code is not executed at all.
>>
>> And when you create an ArrayBuffer(10) in JavaScript, it definitely
>> does not allocate 32KB of memory. It'll round up to the nearest multiple 
>> of
>> a pointer size.
>>
>> On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:
>>
>>> Oh one more thing, so each tab in chrome is handeled as a single
>>> process, but Is the same process sandboxes with the Windows 10 kernel.
>>> Security or there’s another process which is sandboxes and then the main
>>> tab process the ( renderer ) is executed inside of it ?
>>>
>>
>> That's a completely unrelated question which has nothing to do with
>> V8 and does not belong in this thread. I suggest to look around on
>> http://dev.chromium.org/developers for a bunch of things that have
>> been explained before.
>>
>> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:

> On Tue, Sep 11, 2018 at 2:09 PM dan Med 
> wrote:
> >
> > Would you suggest to build v8 such that I can debug it as I want
> ?
>
> It's difficult to go wrong with this approach if you want to better
> understand V8 or any large, complex system.
>
> --
> --
> 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
>> 

Re: [v8-users] Arraybuffer

2018-09-13 Thread dan Med
Still no one ?

On Thu, 13 Sep 2018 at 16:31, dan Med  wrote:

> Okay I will but, how could I be sure when blink on the renderer process
> executes arraybufferbuilder ??
> Or one more thing, can u redirect me to checkout how v8 represents data in
> memory, how would it handle arraybuffers?
> The only thing I’ve managed to find ( in the github repo ) was a
> JavaScript file which contained if I remember correctly, 2 definitions of
> sorting algorithms.
>
> On Thu, 13 Sep 2018 at 16:23, @soylentgraham 
> wrote:
>
>> You seem to be purposely ignoring the responses to your questions.
>>
>> If you still want help, build v8, build a program, breakpoint the
>> function you want to see is called, debug it (this alone answers all your
>> questions), then come back if you still have a VERY SPECIFIC question.
>>
>>
>> On Thursday, 13 September 2018 15:15:03 UTC+1, dan Med wrote:
>>>
>>> No one is willingly to help me  ?
>>>
>>> On Wed, 12 Sep 2018 at 20:34, dan Med  wrote:
>>>
 Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it is
 actually called in blink ?
 Cause by the name it has to do with Arraybuffers..
 Plus if i build v8 so i can examine the memory layout, where is the
 code on how v8 handeles arraybuffer ?
 Where is the doc or some source where there's explained how v8
 represents object in memory, how can i be sure that in memory i'm not
 starrying at a pointer instead of an object or something like that...

 Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
 jkum...@chromium.org> ha scritto:

> On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:
>
>> But can someone help me understand the arraybuffer part ? How to call
>> arraybuffer::append and when I create an instance of a arraybuffer it 
>> will
>> create it with maximum size so 37... bytes and will only say that the 
>> bytes
>> used are the one which I’ve declared ?
>>
>
> There is no ArrayBuffer::Append. Read closely: you've found ArrayBuffer
> *Builder*::Append, which is some implementation detail in Blink (not
> V8). I don't know when it's called, but I've pointed out before how you 
> can
> find out. When you use ArrayBuffer objects in JavaScript, then that code 
> is
> not executed at all.
>
> And when you create an ArrayBuffer(10) in JavaScript, it definitely
> does not allocate 32KB of memory. It'll round up to the nearest multiple 
> of
> a pointer size.
>
> On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:
>
>> Oh one more thing, so each tab in chrome is handeled as a single
>> process, but Is the same process sandboxes with the Windows 10 kernel.
>> Security or there’s another process which is sandboxes and then the main
>> tab process the ( renderer ) is executed inside of it ?
>>
>
> That's a completely unrelated question which has nothing to do with V8
> and does not belong in this thread. I suggest to look around on
> http://dev.chromium.org/developers for a bunch of things that have
> been explained before.
>
> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>>>
 On Tue, Sep 11, 2018 at 2:09 PM dan Med 
 wrote:
 >
 > Would you suggest to build v8 such that I can debug it as I want ?

 It's difficult to go wrong with this approach if you want to better
 understand V8 or any large, complex system.

 --
 --
 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
>> ---
>> 

Re: [v8-users] Arraybuffer

2018-09-13 Thread dan Med
Okay I will but, how could I be sure when blink on the renderer process
executes arraybufferbuilder ??
Or one more thing, can u redirect me to checkout how v8 represents data in
memory, how would it handle arraybuffers?
The only thing I’ve managed to find ( in the github repo ) was a JavaScript
file which contained if I remember correctly, 2 definitions of sorting
algorithms.

On Thu, 13 Sep 2018 at 16:23, @soylentgraham 
wrote:

> You seem to be purposely ignoring the responses to your questions.
>
> If you still want help, build v8, build a program, breakpoint the function
> you want to see is called, debug it (this alone answers all your
> questions), then come back if you still have a VERY SPECIFIC question.
>
>
> On Thursday, 13 September 2018 15:15:03 UTC+1, dan Med wrote:
>>
>> No one is willingly to help me  ?
>>
>> On Wed, 12 Sep 2018 at 20:34, dan Med  wrote:
>>
>>> Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it is
>>> actually called in blink ?
>>> Cause by the name it has to do with Arraybuffers..
>>> Plus if i build v8 so i can examine the memory layout, where is the code
>>> on how v8 handeles arraybuffer ?
>>> Where is the doc or some source where there's explained how v8
>>> represents object in memory, how can i be sure that in memory i'm not
>>> starrying at a pointer instead of an object or something like that...
>>>
>>> Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
>>> jkum...@chromium.org> ha scritto:
>>>
 On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:

> But can someone help me understand the arraybuffer part ? How to call
> arraybuffer::append and when I create an instance of a arraybuffer it will
> create it with maximum size so 37... bytes and will only say that the 
> bytes
> used are the one which I’ve declared ?
>

 There is no ArrayBuffer::Append. Read closely: you've found ArrayBuffer
 *Builder*::Append, which is some implementation detail in Blink (not
 V8). I don't know when it's called, but I've pointed out before how you can
 find out. When you use ArrayBuffer objects in JavaScript, then that code is
 not executed at all.

 And when you create an ArrayBuffer(10) in JavaScript, it definitely
 does not allocate 32KB of memory. It'll round up to the nearest multiple of
 a pointer size.

 On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:

> Oh one more thing, so each tab in chrome is handeled as a single
> process, but Is the same process sandboxes with the Windows 10 kernel.
> Security or there’s another process which is sandboxes and then the main
> tab process the ( renderer ) is executed inside of it ?
>

 That's a completely unrelated question which has nothing to do with V8
 and does not belong in this thread. I suggest to look around on
 http://dev.chromium.org/developers for a bunch of things that have
 been explained before.

 On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>>
>>> On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
>>> >
>>> > Would you suggest to build v8 such that I can debug it as I want ?
>>>
>>> It's difficult to go wrong with this approach if you want to better
>>> understand V8 or any large, complex system.
>>>
>>> --
>>> --
>>> 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-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more 

Re: [v8-users] Arraybuffer

2018-09-13 Thread dan Med
No one is willingly to help me  ?

On Wed, 12 Sep 2018 at 20:34, dan Med  wrote:

> Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it is
> actually called in blink ?
> Cause by the name it has to do with Arraybuffers..
> Plus if i build v8 so i can examine the memory layout, where is the code
> on how v8 handeles arraybuffer ?
> Where is the doc or some source where there's explained how v8 represents
> object in memory, how can i be sure that in memory i'm not starrying at a
> pointer instead of an object or something like that...
>
> Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
> jkumme...@chromium.org> ha scritto:
>
>> On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:
>>
>>> But can someone help me understand the arraybuffer part ? How to call
>>> arraybuffer::append and when I create an instance of a arraybuffer it will
>>> create it with maximum size so 37... bytes and will only say that the bytes
>>> used are the one which I’ve declared ?
>>>
>>
>> There is no ArrayBuffer::Append. Read closely: you've found ArrayBuffer
>> *Builder*::Append, which is some implementation detail in Blink (not
>> V8). I don't know when it's called, but I've pointed out before how you can
>> find out. When you use ArrayBuffer objects in JavaScript, then that code is
>> not executed at all.
>>
>> And when you create an ArrayBuffer(10) in JavaScript, it definitely does
>> not allocate 32KB of memory. It'll round up to the nearest multiple of a
>> pointer size.
>>
>> On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:
>>
>>> Oh one more thing, so each tab in chrome is handeled as a single
>>> process, but Is the same process sandboxes with the Windows 10 kernel.
>>> Security or there’s another process which is sandboxes and then the main
>>> tab process the ( renderer ) is executed inside of it ?
>>>
>>
>> That's a completely unrelated question which has nothing to do with V8
>> and does not belong in this thread. I suggest to look around on
>> http://dev.chromium.org/developers for a bunch of things that have been
>> explained before.
>>
>> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:

> On Tue, Sep 11, 2018 at 2:09 PM dan Med 
> wrote:
> >
> > Would you suggest to build v8 such that I can debug it as I want ?
>
> It's difficult to go wrong with this approach if you want to better
> understand V8 or any large, complex system.
>
> --
> --
> 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 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] Arraybuffer

2018-09-12 Thread dan Med
Yeah i meant   ArrayBuffer*Builder*::Append my bad but when it is
actually called in blink ?
Cause by the name it has to do with Arraybuffers..
Plus if i build v8 so i can examine the memory layout, where is the code on
how v8 handeles arraybuffer ?
Where is the doc or some source where there's explained how v8 represents
object in memory, how can i be sure that in memory i'm not starrying at a
pointer instead of an object or something like that...

Il giorno mer 12 set 2018 alle ore 19:40 Jakob Kummerow <
jkumme...@chromium.org> ha scritto:

> On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:
>
>> But can someone help me understand the arraybuffer part ? How to call
>> arraybuffer::append and when I create an instance of a arraybuffer it will
>> create it with maximum size so 37... bytes and will only say that the bytes
>> used are the one which I’ve declared ?
>>
>
> There is no ArrayBuffer::Append. Read closely: you've found ArrayBuffer
> *Builder*::Append, which is some implementation detail in Blink (not V8).
> I don't know when it's called, but I've pointed out before how you can find
> out. When you use ArrayBuffer objects in JavaScript, then that code is not
> executed at all.
>
> And when you create an ArrayBuffer(10) in JavaScript, it definitely does
> not allocate 32KB of memory. It'll round up to the nearest multiple of a
> pointer size.
>
> On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:
>
>> Oh one more thing, so each tab in chrome is handeled as a single process,
>> but Is the same process sandboxes with the Windows 10 kernel. Security or
>> there’s another process which is sandboxes and then the main tab process
>> the ( renderer ) is executed inside of it ?
>>
>
> That's a completely unrelated question which has nothing to do with V8 and
> does not belong in this thread. I suggest to look around on
> http://dev.chromium.org/developers for a bunch of things that have been
> explained before.
>
> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>>>
 On Tue, Sep 11, 2018 at 2:09 PM dan Med 
 wrote:
 >
 > Would you suggest to build v8 such that I can debug it as I want ?

 It's difficult to go wrong with this approach if you want to better
 understand V8 or any large, complex system.

 --
 --
 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 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] Arraybuffer

2018-09-12 Thread Jakob Kummerow
On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:

> But can someone help me understand the arraybuffer part ? How to call
> arraybuffer::append and when I create an instance of a arraybuffer it will
> create it with maximum size so 37... bytes and will only say that the bytes
> used are the one which I’ve declared ?
>

There is no ArrayBuffer::Append. Read closely: you've found ArrayBuffer
*Builder*::Append, which is some implementation detail in Blink (not V8). I
don't know when it's called, but I've pointed out before how you can find
out. When you use ArrayBuffer objects in JavaScript, then that code is not
executed at all.

And when you create an ArrayBuffer(10) in JavaScript, it definitely does
not allocate 32KB of memory. It'll round up to the nearest multiple of a
pointer size.

On Wed, Sep 12, 2018 at 10:09 AM dan Med  wrote:

> Oh one more thing, so each tab in chrome is handeled as a single process,
> but Is the same process sandboxes with the Windows 10 kernel. Security or
> there’s another process which is sandboxes and then the main tab process
> the ( renderer ) is executed inside of it ?
>

That's a completely unrelated question which has nothing to do with V8 and
does not belong in this thread. I suggest to look around on
http://dev.chromium.org/developers for a bunch of things that have been
explained before.

On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>>
>>> On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
>>> >
>>> > Would you suggest to build v8 such that I can debug it as I want ?
>>>
>>> It's difficult to go wrong with this approach if you want to better
>>> understand V8 or any large, complex system.
>>>
>>> --
>>> --
>>> 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 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] Arraybuffer

2018-09-12 Thread dan Med
Oh one more thing, so each tab in chrome is handeled as a single process,
but Is the same process sandboxes with the Windows 10 kernel. Security or
there’s another process which is sandboxes and then the main tab process
the ( renderer ) is executed inside of it ?

On Wed, 12 Sep 2018 at 13:15, dan Med  wrote:

> But can someone help me understand the arraybuffer part ? How to call
> arraybuffer::append and when I create an instance of a arraybuffer it will
> create it with maximum size so 37... bytes and will only say that the bytes
> used are the one which I’ve declared ?
>
> On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>
>> On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
>> >
>> > Would you suggest to build v8 such that I can debug it as I want ?
>>
>> It's difficult to go wrong with this approach if you want to better
>> understand V8 or any large, complex system.
>>
>> --
>> --
>> 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] Arraybuffer

2018-09-12 Thread dan Med
But can someone help me understand the arraybuffer part ? How to call
arraybuffer::append and when I create an instance of a arraybuffer it will
create it with maximum size so 37... bytes and will only say that the bytes
used are the one which I’ve declared ?

On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:

> On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
> >
> > Would you suggest to build v8 such that I can debug it as I want ?
>
> It's difficult to go wrong with this approach if you want to better
> understand V8 or any large, complex system.
>
> --
> --
> 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] Arraybuffer

2018-09-11 Thread Peter Schow
On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
>
> Would you suggest to build v8 such that I can debug it as I want ?

It's difficult to go wrong with this approach if you want to better
understand V8 or any large, complex system.

-- 
-- 
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] Arraybuffer

2018-09-11 Thread dan Med
Would you suggest to build v8 such that I can debug it as I want ?

On Tue, 11 Sep 2018 at 12:44, dan Med  wrote:

> I've already read that  guide and watched those videos, but i'm not
> interested at a HIGH level definition, i wan't to see the hole picture
> starting from the very buttom or at least at a low level
> In those presentation they just give the very top of the iceberg which
> isn't really helpful
>
> Il giorno mar 11 set 2018 alle ore 12:42 dan Med 
> ha scritto:
>
>> Ok so to answer the memory side i believe i should build v8 and then
>> debug it and see the memory.
>> But another question arises, how is data/pointers or anything else
>> represented in memory ? There should be i guide i hope ...
>>
>> Il giorno mar 11 set 2018 alle ore 12:41 dan Med 
>> ha scritto:
>>
>>> So the location of the length regarding my allocation is base on which
>>> algorithm v8 uses to find the free space it needs?
>>>
>>> Anyway, i still don't get when arraybuffer::append will be called or can
>>> be called 
>>> One more thing when i create a new instance let's say this example again:
>>> Arraybuffer foo = new arraybuffer(10)
>>>
>>> so an arraybuffer of CAPACITY will be allocated so static const int
>>> kDefaultBufferCapacity
>>> 
>>> = 32768;
>>> 32768 bytes will be allocated but only 10 of those will be marked as
>>> BYTE_USED hence i will only be able to access those with
>>> a proper typedarray.
>>>
>>> If i start reading the code on how v8 compiles i will have even more
>>> questions, i think i need the low stuff, something like how does it create
>>> the machine code that will be executed where will it be stored such and
>>> such ...
>>>
>>>
>>> Another developer replied to me that the basic structure of v8 is a loop
>>> that reacts when certain events happen..
>>>
>>> I'm really glad you're answering my questions !
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Il giorno mar 11 set 2018 alle ore 12:32 @soylentgraham <
>>> gra...@grahamreeves.com> ha scritto:
>>>
 Let's not confuse matters by adding Node into the mix! :)

 > by doing buffer_->Data() i'm accessing a defined length space
 somewhere in memory but on the heap since there's the new operator
 involded..

 It uses the new operator, but this can, and is, overloaded. (in v8). As
 I said above, it will use the memory allocator, which you can override with
 your own (the code I provided), so, it is most likely on a heap, but it may
 not. For your purposes, it is memory allocated SOMEWHERE, by SOMETHING.


 > and where data points to the length of that space is the same as the
 one declared for example as
 > Arraybuffer a = new arraybuffer(10) so data will point to a space in
 memory who's length is 10 bytes?

 As I keep saying, this MAY NOT be the case. It depends on many things.
 As you've seen from the code, an arraybuffer has a memory-allocation of
 size CAPACITY, and the number of bytes used is BYTES_USED (in this case,
 10). The usage can grow and shrink, to save reallocation (which is
 traditionally an expensive thing)
 The most likely case, is that yes, it will probably point at some
 memory allocated by the allocator assigned to the isolate of 10 bytes. The
 only way you can verify that in your case is by debugging it, stepping into
 the code and seeing what it does.


 > So, what i'd like to understand is how v8 would compile a javascript
 "file" by that i mean how it would be
 > represented in memory which methods will be called and so on

 This is quite different from the use of array buffers!
 This question is more about compiling. How the memory is laid out after
 compilation... is going to be a very difficult thing to delve into even for
 the engine developers (they may know there's lists of functions, scripts,
 but how it's laid out EXACTLY probably isn't of concern to them)

 If you want to learn more about how the script compiles, how the
 virtual machine executes, delve into this page, and the videos at the
 bottom (while they're from 2008, the fundamentals probably haven't changed
 that much)

 http://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/

 If you're interested in finding out how v8 compiles, and executes code,
 I would totally ignore the memory side of things and get a grasp on what
 it's doing at a high level, (ie. the theory) then low level (what gets
 stored, how things are found, and arranged) first.
 

Re: [v8-users] Arraybuffer

2018-09-11 Thread dan Med
I've already read that  guide and watched those videos, but i'm not
interested at a HIGH level definition, i wan't to see the hole picture
starting from the very buttom or at least at a low level
In those presentation they just give the very top of the iceberg which
isn't really helpful

Il giorno mar 11 set 2018 alle ore 12:42 dan Med 
ha scritto:

> Ok so to answer the memory side i believe i should build v8 and then debug
> it and see the memory.
> But another question arises, how is data/pointers or anything else
> represented in memory ? There should be i guide i hope ...
>
> Il giorno mar 11 set 2018 alle ore 12:41 dan Med 
> ha scritto:
>
>> So the location of the length regarding my allocation is base on which
>> algorithm v8 uses to find the free space it needs?
>>
>> Anyway, i still don't get when arraybuffer::append will be called or can
>> be called 
>> One more thing when i create a new instance let's say this example again:
>> Arraybuffer foo = new arraybuffer(10)
>>
>> so an arraybuffer of CAPACITY will be allocated so static const int
>> kDefaultBufferCapacity
>> 
>> = 32768;
>> 32768 bytes will be allocated but only 10 of those will be marked as
>> BYTE_USED hence i will only be able to access those with
>> a proper typedarray.
>>
>> If i start reading the code on how v8 compiles i will have even more
>> questions, i think i need the low stuff, something like how does it create
>> the machine code that will be executed where will it be stored such and
>> such ...
>>
>>
>> Another developer replied to me that the basic structure of v8 is a loop
>> that reacts when certain events happen..
>>
>> I'm really glad you're answering my questions !
>>
>>
>>
>>
>>
>>
>>
>> Il giorno mar 11 set 2018 alle ore 12:32 @soylentgraham <
>> gra...@grahamreeves.com> ha scritto:
>>
>>> Let's not confuse matters by adding Node into the mix! :)
>>>
>>> > by doing buffer_->Data() i'm accessing a defined length space
>>> somewhere in memory but on the heap since there's the new operator
>>> involded..
>>>
>>> It uses the new operator, but this can, and is, overloaded. (in v8). As
>>> I said above, it will use the memory allocator, which you can override with
>>> your own (the code I provided), so, it is most likely on a heap, but it may
>>> not. For your purposes, it is memory allocated SOMEWHERE, by SOMETHING.
>>>
>>>
>>> > and where data points to the length of that space is the same as the
>>> one declared for example as
>>> > Arraybuffer a = new arraybuffer(10) so data will point to a space in
>>> memory who's length is 10 bytes?
>>>
>>> As I keep saying, this MAY NOT be the case. It depends on many things.
>>> As you've seen from the code, an arraybuffer has a memory-allocation of
>>> size CAPACITY, and the number of bytes used is BYTES_USED (in this case,
>>> 10). The usage can grow and shrink, to save reallocation (which is
>>> traditionally an expensive thing)
>>> The most likely case, is that yes, it will probably point at some memory
>>> allocated by the allocator assigned to the isolate of 10 bytes. The only
>>> way you can verify that in your case is by debugging it, stepping into the
>>> code and seeing what it does.
>>>
>>>
>>> > So, what i'd like to understand is how v8 would compile a javascript
>>> "file" by that i mean how it would be
>>> > represented in memory which methods will be called and so on
>>>
>>> This is quite different from the use of array buffers!
>>> This question is more about compiling. How the memory is laid out after
>>> compilation... is going to be a very difficult thing to delve into even for
>>> the engine developers (they may know there's lists of functions, scripts,
>>> but how it's laid out EXACTLY probably isn't of concern to them)
>>>
>>> If you want to learn more about how the script compiles, how the virtual
>>> machine executes, delve into this page, and the videos at the bottom (while
>>> they're from 2008, the fundamentals probably haven't changed that much)
>>>
>>> http://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/
>>>
>>> If you're interested in finding out how v8 compiles, and executes code,
>>> I would totally ignore the memory side of things and get a grasp on what
>>> it's doing at a high level, (ie. the theory) then low level (what gets
>>> stored, how things are found, and arranged) first.
>>> THEN you could browse the allocations and see WHERE everything is (I'm
>>> not sure what use this would be to anyone who is working with more than
>>> 50mb of ram though :)
>>>
>>> I would really encourage you to step through the 

Re: [v8-users] Arraybuffer

2018-09-11 Thread dan Med
Ok so to answer the memory side i believe i should build v8 and then debug
it and see the memory.
But another question arises, how is data/pointers or anything else
represented in memory ? There should be i guide i hope ...

Il giorno mar 11 set 2018 alle ore 12:41 dan Med 
ha scritto:

> So the location of the length regarding my allocation is base on which
> algorithm v8 uses to find the free space it needs?
>
> Anyway, i still don't get when arraybuffer::append will be called or can
> be called 
> One more thing when i create a new instance let's say this example again:
> Arraybuffer foo = new arraybuffer(10)
>
> so an arraybuffer of CAPACITY will be allocated so static const int
> kDefaultBufferCapacity
> 
> = 32768;
> 32768 bytes will be allocated but only 10 of those will be marked as
> BYTE_USED hence i will only be able to access those with
> a proper typedarray.
>
> If i start reading the code on how v8 compiles i will have even more
> questions, i think i need the low stuff, something like how does it create
> the machine code that will be executed where will it be stored such and
> such ...
>
>
> Another developer replied to me that the basic structure of v8 is a loop
> that reacts when certain events happen..
>
> I'm really glad you're answering my questions !
>
>
>
>
>
>
>
> Il giorno mar 11 set 2018 alle ore 12:32 @soylentgraham <
> gra...@grahamreeves.com> ha scritto:
>
>> Let's not confuse matters by adding Node into the mix! :)
>>
>> > by doing buffer_->Data() i'm accessing a defined length space somewhere
>> in memory but on the heap since there's the new operator involded..
>>
>> It uses the new operator, but this can, and is, overloaded. (in v8). As I
>> said above, it will use the memory allocator, which you can override with
>> your own (the code I provided), so, it is most likely on a heap, but it may
>> not. For your purposes, it is memory allocated SOMEWHERE, by SOMETHING.
>>
>>
>> > and where data points to the length of that space is the same as the
>> one declared for example as
>> > Arraybuffer a = new arraybuffer(10) so data will point to a space in
>> memory who's length is 10 bytes?
>>
>> As I keep saying, this MAY NOT be the case. It depends on many things. As
>> you've seen from the code, an arraybuffer has a memory-allocation of size
>> CAPACITY, and the number of bytes used is BYTES_USED (in this case, 10).
>> The usage can grow and shrink, to save reallocation (which is traditionally
>> an expensive thing)
>> The most likely case, is that yes, it will probably point at some memory
>> allocated by the allocator assigned to the isolate of 10 bytes. The only
>> way you can verify that in your case is by debugging it, stepping into the
>> code and seeing what it does.
>>
>>
>> > So, what i'd like to understand is how v8 would compile a javascript
>> "file" by that i mean how it would be
>> > represented in memory which methods will be called and so on
>>
>> This is quite different from the use of array buffers!
>> This question is more about compiling. How the memory is laid out after
>> compilation... is going to be a very difficult thing to delve into even for
>> the engine developers (they may know there's lists of functions, scripts,
>> but how it's laid out EXACTLY probably isn't of concern to them)
>>
>> If you want to learn more about how the script compiles, how the virtual
>> machine executes, delve into this page, and the videos at the bottom (while
>> they're from 2008, the fundamentals probably haven't changed that much)
>>
>> http://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/
>>
>> If you're interested in finding out how v8 compiles, and executes code, I
>> would totally ignore the memory side of things and get a grasp on what it's
>> doing at a high level, (ie. the theory) then low level (what gets stored,
>> how things are found, and arranged) first.
>> THEN you could browse the allocations and see WHERE everything is (I'm
>> not sure what use this would be to anyone who is working with more than
>> 50mb of ram though :)
>>
>> I would really encourage you to step through the code though! (find
>> script::compile and just step through from there)
>> This will make lots of things make sense! (because everything is named
>> properly in the code :)
>>
>>
>> On Tuesday, 11 September 2018 08:57:53 UTC+1, J Decker wrote:
>>>
>>>
>>>
>>> On Tue, Sep 11, 2018 at 12:44 AM dan Med  wrote:
>>>
 First of all, i'd like to say that for me the documentation is
 really. useless from a real technical point of view.
 So, what i'd 

Re: [v8-users] Arraybuffer

2018-09-11 Thread dan Med
So the location of the length regarding my allocation is base on which
algorithm v8 uses to find the free space it needs?

Anyway, i still don't get when arraybuffer::append will be called or can be
called 
One more thing when i create a new instance let's say this example again:
Arraybuffer foo = new arraybuffer(10)

so an arraybuffer of CAPACITY will be allocated so static const int
kDefaultBufferCapacity

= 32768;
32768 bytes will be allocated but only 10 of those will be marked as
BYTE_USED hence i will only be able to access those with
a proper typedarray.

If i start reading the code on how v8 compiles i will have even more
questions, i think i need the low stuff, something like how does it create
the machine code that will be executed where will it be stored such and
such ...


Another developer replied to me that the basic structure of v8 is a loop
that reacts when certain events happen..

I'm really glad you're answering my questions !







Il giorno mar 11 set 2018 alle ore 12:32 @soylentgraham <
gra...@grahamreeves.com> ha scritto:

> Let's not confuse matters by adding Node into the mix! :)
>
> > by doing buffer_->Data() i'm accessing a defined length space somewhere
> in memory but on the heap since there's the new operator involded..
>
> It uses the new operator, but this can, and is, overloaded. (in v8). As I
> said above, it will use the memory allocator, which you can override with
> your own (the code I provided), so, it is most likely on a heap, but it may
> not. For your purposes, it is memory allocated SOMEWHERE, by SOMETHING.
>
>
> > and where data points to the length of that space is the same as the one
> declared for example as
> > Arraybuffer a = new arraybuffer(10) so data will point to a space in
> memory who's length is 10 bytes?
>
> As I keep saying, this MAY NOT be the case. It depends on many things. As
> you've seen from the code, an arraybuffer has a memory-allocation of size
> CAPACITY, and the number of bytes used is BYTES_USED (in this case, 10).
> The usage can grow and shrink, to save reallocation (which is traditionally
> an expensive thing)
> The most likely case, is that yes, it will probably point at some memory
> allocated by the allocator assigned to the isolate of 10 bytes. The only
> way you can verify that in your case is by debugging it, stepping into the
> code and seeing what it does.
>
>
> > So, what i'd like to understand is how v8 would compile a javascript
> "file" by that i mean how it would be
> > represented in memory which methods will be called and so on
>
> This is quite different from the use of array buffers!
> This question is more about compiling. How the memory is laid out after
> compilation... is going to be a very difficult thing to delve into even for
> the engine developers (they may know there's lists of functions, scripts,
> but how it's laid out EXACTLY probably isn't of concern to them)
>
> If you want to learn more about how the script compiles, how the virtual
> machine executes, delve into this page, and the videos at the bottom (while
> they're from 2008, the fundamentals probably haven't changed that much)
>
> http://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/
>
> If you're interested in finding out how v8 compiles, and executes code, I
> would totally ignore the memory side of things and get a grasp on what it's
> doing at a high level, (ie. the theory) then low level (what gets stored,
> how things are found, and arranged) first.
> THEN you could browse the allocations and see WHERE everything is (I'm not
> sure what use this would be to anyone who is working with more than 50mb of
> ram though :)
>
> I would really encourage you to step through the code though! (find
> script::compile and just step through from there)
> This will make lots of things make sense! (because everything is named
> properly in the code :)
>
>
> On Tuesday, 11 September 2018 08:57:53 UTC+1, J Decker wrote:
>>
>>
>>
>> On Tue, Sep 11, 2018 at 12:44 AM dan Med  wrote:
>>
>>> First of all, i'd like to say that for me the documentation is
>>> really. useless from a real technical point of view.
>>> So, what i'd like to understand is how v8 would compile a javascript
>>> "file" by that i mean how it would be
>>> represented in memory which methods will be called and so on
>>> (In the classes defined in the various v8 files, you don't get that sort
>>> of feeling about the memory allocator and such...
>>> i'd like to understand how to gather that knowledge.)
>>> Now, u said "kind of" for my question which was, when i 

Re: [v8-users] Arraybuffer

2018-09-11 Thread J Decker
On Tue, Sep 11, 2018 at 12:44 AM dan Med  wrote:

> First of all, i'd like to say that for me the documentation is really.
> useless from a real technical point of view.
> So, what i'd like to understand is how v8 would compile a javascript
> "file" by that i mean how it would be
> represented in memory which methods will be called and so on
> (In the classes defined in the various v8 files, you don't get that sort
> of feeling about the memory allocator and such...
> i'd like to understand how to gather that knowledge.)
> Now, u said "kind of" for my question which was, when i allocate an
> arraybuffer in javascript will v8 call arraybufferbuilder ?
> But then one of my questions was how to invoke the append method?
> I know that if someone want's to expand an arraybuffer it will have to
> create another one and copy there those values...
> This is how i have a rough vision of the arraybuffer in memory:
>
> buffer > [   DATA ]
> "simple pointer" "size of the bytes which i can manipulate with a
> typedarray"
>

There's really nothing special about the memory gets the size of a
file, allocates a buffer and reads the file into it.
https://github.com/d3x0r/sack.vfs/blob/master/src/vfs_module.cc#L479

size_t len = sack_vfs_size( file );
uint8_t *buf = NewArray( uint8_t, len );
sack_vfs_read( file, (char*)buf, len );
Local arrayBuffer = ArrayBuffer::New( isolate, buf, len );

where buf is allocated from some allocator V8 doesn't even know about
the next few lines of code wrap it in a weak persistent holder that tracks
when the object gets deleted to be able to delete the 'buf' allocated...
https://github.com/d3x0r/sack.vfs/blob/master/src/vfs_module.cc#L447
(releaseBuffer)

You can find information about ArrayBuffer by searching for 'nodejs addon
arraybuffer'   Node is a handy platform for writing code that extends V8;
99% of the code you will write is actually interfacing to V8 and not Node.


> Il giorno mar 11 set 2018 alle ore 00:07 @soylentgraham <
> gra...@grahamreeves.com> ha scritto:
>
>> > When I talk about typedarray or anything else I referr to the
>> JavaScript side, so create an arraybuffer it will invoke that class in v8,
>> Kind of.
>>
>> > then build a view or not it depends how do I make v8 to call the append
>> method ?
>> I don't understand this question.
>> An array buffer in javascript is fixed in length. You cannot make it grow
>> or shrink on the javascript side.
>> To do anything, you need a view, so the code knows how to manipulate the
>> raw bytes in the array buffer.
>> See javascript documentation on array buffers;
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
>>
>> You personally shouldn't TRY to make it call the append method. If it
>> needs to grow, it'll grow. Why do you think you need to? Back to previous
>> messages, what are you trying to achieve??
>>
>> Gather your thoughts, and try and answer some of the questions I've asked
>> in previous emails; I asked them to help guide you so people can help with
>> your problem! (I'm still not exactly sure what you're trying to do)
>>
>>
>> On Monday, 10 September 2018 22:55:51 UTC+1, dan Med wrote:
>>>
>>> ATM I’m writing with my phone, here in EU is almost midnight so I will
>>> write u an email tomorrow fully detailed.
>>>
>>> Btw how do I call append ???
>>> I’m interested in how v8 works and manages JavaScript code that’s all.
>>>
>>> When I talk about typedarray or anything else I referr to the JavaScript
>>> side, so create an arraybuffer it will invoke that class in v8, then build
>>> a view or not it depends how do I make v8 to call the append method ?
>>>
>>> On Mon, 10 Sep 2018 at 23:46, @soylentgraham 
>>> wrote:
>>>
 > First, how big is the data member of the object ?

 As I said before. Capacity is the size of the memory allocated that
 data points at.


 > Is it as big as the actual array buffer length which I declare on
 JavaScript

 It will be either as big, or bigger. It can grow.
 bytes_used will be the size that matches javascript.


 > which I can build on top of it a typedarray ?

 This is a slightly different question, (and needs clarifying)
 When you create a typedarray in C++, it needs an array buffer.
 When you create a typedarray in javascript, it will have an array
 buffer behind it. (which you may or may not have created in javascript or
 c++, there are several ways of approaching this)


 > So, when a typedarray is build on top of an areaybuffer instance, how
 do I get to call the arraybufferbuilder::append ?

 Aha! a more specific question!
 Are you trying to call arraybufferbuilder::append in javascript, or c++?
 Why? are you trying to make a typedarray bigger? (in javascript or c++?)
 I believe once created they're a fixed size in javascript.
 I have a feeling on the c++ side, 

Re: [v8-users] Arraybuffer

2018-09-11 Thread dan Med
by doing buffer_->Data() i'm accessing a defined length space somewhere in
memory but on the heap since there's the new operator involded..
and where data points to the length of that space is the same as the one
declared for example as
Arraybuffer a = new arraybuffer(10) so data will point to a space in memory
who's length is 10 bytes?

Il giorno mar 11 set 2018 alle ore 09:43 dan Med 
ha scritto:

> First of all, i'd like to say that for me the documentation is really.
> useless from a real technical point of view.
> So, what i'd like to understand is how v8 would compile a javascript
> "file" by that i mean how it would be
> represented in memory which methods will be called and so on
> (In the classes defined in the various v8 files, you don't get that sort
> of feeling about the memory allocator and such...
> i'd like to understand how to gather that knowledge.)
> Now, u said "kind of" for my question which was, when i allocate an
> arraybuffer in javascript will v8 call arraybufferbuilder ?
> But then one of my questions was how to invoke the append method?
> I know that if someone want's to expand an arraybuffer it will have to
> create another one and copy there those values...
> This is how i have a rough vision of the arraybuffer in memory:
>
> buffer > [   DATA ]
> "simple pointer" "size of the bytes which i can manipulate with a
> typedarray"
>
> Il giorno mar 11 set 2018 alle ore 00:07 @soylentgraham <
> gra...@grahamreeves.com> ha scritto:
>
>> > When I talk about typedarray or anything else I referr to the
>> JavaScript side, so create an arraybuffer it will invoke that class in v8,
>> Kind of.
>>
>> > then build a view or not it depends how do I make v8 to call the append
>> method ?
>> I don't understand this question.
>> An array buffer in javascript is fixed in length. You cannot make it grow
>> or shrink on the javascript side.
>> To do anything, you need a view, so the code knows how to manipulate the
>> raw bytes in the array buffer.
>> See javascript documentation on array buffers;
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
>>
>> You personally shouldn't TRY to make it call the append method. If it
>> needs to grow, it'll grow. Why do you think you need to? Back to previous
>> messages, what are you trying to achieve??
>>
>> Gather your thoughts, and try and answer some of the questions I've asked
>> in previous emails; I asked them to help guide you so people can help with
>> your problem! (I'm still not exactly sure what you're trying to do)
>>
>>
>> On Monday, 10 September 2018 22:55:51 UTC+1, dan Med wrote:
>>>
>>> ATM I’m writing with my phone, here in EU is almost midnight so I will
>>> write u an email tomorrow fully detailed.
>>>
>>> Btw how do I call append ???
>>> I’m interested in how v8 works and manages JavaScript code that’s all.
>>>
>>> When I talk about typedarray or anything else I referr to the JavaScript
>>> side, so create an arraybuffer it will invoke that class in v8, then build
>>> a view or not it depends how do I make v8 to call the append method ?
>>>
>>> On Mon, 10 Sep 2018 at 23:46, @soylentgraham 
>>> wrote:
>>>
 > First, how big is the data member of the object ?

 As I said before. Capacity is the size of the memory allocated that
 data points at.


 > Is it as big as the actual array buffer length which I declare on
 JavaScript

 It will be either as big, or bigger. It can grow.
 bytes_used will be the size that matches javascript.


 > which I can build on top of it a typedarray ?

 This is a slightly different question, (and needs clarifying)
 When you create a typedarray in C++, it needs an array buffer.
 When you create a typedarray in javascript, it will have an array
 buffer behind it. (which you may or may not have created in javascript or
 c++, there are several ways of approaching this)


 > So, when a typedarray is build on top of an areaybuffer instance, how
 do I get to call the arraybufferbuilder::append ?

 Aha! a more specific question!
 Are you trying to call arraybufferbuilder::append in javascript, or c++?
 Why? are you trying to make a typedarray bigger? (in javascript or c++?)
 I believe once created they're a fixed size in javascript.
 I have a feeling on the c++ side, you can't change the size once
 created (but I may be wrong, you have direct access to the buffer's
 buffercontents via the bufferview...)

 Can you make your question a lot more specific? post some code?


 On Monday, 10 September 2018 22:38:16 UTC+1, dan Med wrote:
>
> First, how big is the data member of the object ? Is it as big as the
> actual array buffer length which I declare on JavaScript and which I can
> build on top of it a typedarray ?
>
> No, I’m just trying to understand how v8 

Re: [v8-users] Arraybuffer

2018-09-11 Thread dan Med
First of all, i'd like to say that for me the documentation is really.
useless from a real technical point of view.
So, what i'd like to understand is how v8 would compile a javascript "file"
by that i mean how it would be
represented in memory which methods will be called and so on
(In the classes defined in the various v8 files, you don't get that sort of
feeling about the memory allocator and such...
i'd like to understand how to gather that knowledge.)
Now, u said "kind of" for my question which was, when i allocate an
arraybuffer in javascript will v8 call arraybufferbuilder ?
But then one of my questions was how to invoke the append method?
I know that if someone want's to expand an arraybuffer it will have to
create another one and copy there those values...
This is how i have a rough vision of the arraybuffer in memory:

buffer > [   DATA ]
"simple pointer" "size of the bytes which i can manipulate with a
typedarray"

Il giorno mar 11 set 2018 alle ore 00:07 @soylentgraham <
gra...@grahamreeves.com> ha scritto:

> > When I talk about typedarray or anything else I referr to the JavaScript
> side, so create an arraybuffer it will invoke that class in v8,
> Kind of.
>
> > then build a view or not it depends how do I make v8 to call the append
> method ?
> I don't understand this question.
> An array buffer in javascript is fixed in length. You cannot make it grow
> or shrink on the javascript side.
> To do anything, you need a view, so the code knows how to manipulate the
> raw bytes in the array buffer.
> See javascript documentation on array buffers;
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
>
> You personally shouldn't TRY to make it call the append method. If it
> needs to grow, it'll grow. Why do you think you need to? Back to previous
> messages, what are you trying to achieve??
>
> Gather your thoughts, and try and answer some of the questions I've asked
> in previous emails; I asked them to help guide you so people can help with
> your problem! (I'm still not exactly sure what you're trying to do)
>
>
> On Monday, 10 September 2018 22:55:51 UTC+1, dan Med wrote:
>>
>> ATM I’m writing with my phone, here in EU is almost midnight so I will
>> write u an email tomorrow fully detailed.
>>
>> Btw how do I call append ???
>> I’m interested in how v8 works and manages JavaScript code that’s all.
>>
>> When I talk about typedarray or anything else I referr to the JavaScript
>> side, so create an arraybuffer it will invoke that class in v8, then build
>> a view or not it depends how do I make v8 to call the append method ?
>>
>> On Mon, 10 Sep 2018 at 23:46, @soylentgraham 
>> wrote:
>>
>>> > First, how big is the data member of the object ?
>>>
>>> As I said before. Capacity is the size of the memory allocated that data
>>> points at.
>>>
>>>
>>> > Is it as big as the actual array buffer length which I declare on
>>> JavaScript
>>>
>>> It will be either as big, or bigger. It can grow.
>>> bytes_used will be the size that matches javascript.
>>>
>>>
>>> > which I can build on top of it a typedarray ?
>>>
>>> This is a slightly different question, (and needs clarifying)
>>> When you create a typedarray in C++, it needs an array buffer.
>>> When you create a typedarray in javascript, it will have an array buffer
>>> behind it. (which you may or may not have created in javascript or c++,
>>> there are several ways of approaching this)
>>>
>>>
>>> > So, when a typedarray is build on top of an areaybuffer instance, how
>>> do I get to call the arraybufferbuilder::append ?
>>>
>>> Aha! a more specific question!
>>> Are you trying to call arraybufferbuilder::append in javascript, or c++?
>>> Why? are you trying to make a typedarray bigger? (in javascript or c++?)
>>> I believe once created they're a fixed size in javascript.
>>> I have a feeling on the c++ side, you can't change the size once created
>>> (but I may be wrong, you have direct access to the buffer's buffercontents
>>> via the bufferview...)
>>>
>>> Can you make your question a lot more specific? post some code?
>>>
>>>
>>> On Monday, 10 September 2018 22:38:16 UTC+1, dan Med wrote:

 First, how big is the data member of the object ? Is it as big as the
 actual array buffer length which I declare on JavaScript and which I can
 build on top of it a typedarray ?

 No, I’m just trying to understand how v8 works, I know it is a big
 thing but at least how it moves then I might read the code and understand,
 extra parts.

 So, when a typedarray is build on top of an areaybuffer instance, how
 do I get to call the arraybufferbuilder::append ?





 On Mon, 10 Sep 2018 at 23:30, @soylentgraham 
 wrote:

> I'm guessing you may be a bit new to unmanaged-memory
> languages/systems.
>
> buffer is an object, (it's structure/layout will look a bit like it's
> 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
ATM I’m writing with my phone, here in EU is almost midnight so I will
write u an email tomorrow fully detailed.

Btw how do I call append ???
I’m interested in how v8 works and manages JavaScript code that’s all.

When I talk about typedarray or anything else I referr to the JavaScript
side, so create an arraybuffer it will invoke that class in v8, then build
a view or not it depends how do I make v8 to call the append method ?

On Mon, 10 Sep 2018 at 23:46, @soylentgraham 
wrote:

> > First, how big is the data member of the object ?
>
> As I said before. Capacity is the size of the memory allocated that data
> points at.
>
>
> > Is it as big as the actual array buffer length which I declare on
> JavaScript
>
> It will be either as big, or bigger. It can grow.
> bytes_used will be the size that matches javascript.
>
>
> > which I can build on top of it a typedarray ?
>
> This is a slightly different question, (and needs clarifying)
> When you create a typedarray in C++, it needs an array buffer.
> When you create a typedarray in javascript, it will have an array buffer
> behind it. (which you may or may not have created in javascript or c++,
> there are several ways of approaching this)
>
>
> > So, when a typedarray is build on top of an areaybuffer instance, how do
> I get to call the arraybufferbuilder::append ?
>
> Aha! a more specific question!
> Are you trying to call arraybufferbuilder::append in javascript, or c++?
> Why? are you trying to make a typedarray bigger? (in javascript or c++?)
> I believe once created they're a fixed size in javascript.
> I have a feeling on the c++ side, you can't change the size once created
> (but I may be wrong, you have direct access to the buffer's buffercontents
> via the bufferview...)
>
> Can you make your question a lot more specific? post some code?
>
>
> On Monday, 10 September 2018 22:38:16 UTC+1, dan Med wrote:
>>
>> First, how big is the data member of the object ? Is it as big as the
>> actual array buffer length which I declare on JavaScript and which I can
>> build on top of it a typedarray ?
>>
>> No, I’m just trying to understand how v8 works, I know it is a big thing
>> but at least how it moves then I might read the code and understand, extra
>> parts.
>>
>> So, when a typedarray is build on top of an areaybuffer instance, how do
>> I get to call the arraybufferbuilder::append ?
>>
>>
>>
>>
>>
>> On Mon, 10 Sep 2018 at 23:30, @soylentgraham 
>> wrote:
>>
>>> I'm guessing you may be a bit new to unmanaged-memory languages/systems.
>>>
>>> buffer is an object, (it's structure/layout will look a bit like it's
>>> class declaration, but it's a little more complex than that) that was
>>> allocated somewhere sometime, (you can figure out where, but really you
>>> don't need to,  for this purpose it's just an object)
>>> data is a member of that object, that points to some memory (somewhere
>>> else, maybe allocated by a different system, in a different place)
>>> you have no idea (and you shouldn't need to know, or use the
>>> information) the "offset" from the buffer-object to the data. They are not
>>> necessarily related, or share the same memory space. (and in most cases,
>>> they're not even real memory addresses, they're more like identifiers)
>>>
>>> Simple Javascript scripts can look like C sometimes (a few variables
>>> here and there, a few array creations), but underneath it's doing a lot
>>> more moving things around.
>>> function x()
>>> {
>>>  var a = new array(10);
>>>  var b = new array(100);
>>> }
>>> This may look like it allocates 2 arrays, but more than likely it's
>>> doing something radically different with actual memory.
>>>
>>>
>>> > so how can i see the memory management ?
>>> As I said, you can't see the javascript side so easily (other than using
>>> the v8 debugging/inspector tools)
>>> But if you want to see the C-side memory (which MAY be where the data
>>> that buffer points at came from) you can make your own allocator that v8
>>> can use.
>>> If you then breakpoint each call, you'll know when V8 is allocating some
>>> memory to use (which may or may not be a direct object in javascript, an
>>> array or typed array in javascript may not directly allocate here)
>>>
>>>
>>> class TV8Allocator : public v8::ArrayBuffer::Allocator
>>>
>>> {
>>>
>>> public:
>>>
>>> virtual void* Allocate(size_t length) override;
>>>
>>> virtual void* AllocateUninitialized(size_t length) override;
>>>
>>> virtual void Free(void* data, size_t length) override;
>>>
>>> };
>>>
>>>
>>> void* TV8Allocator::Allocate(size_t length)
>>>
>>> {
>>>
>>> auto* Bytes = new uint8_t[length];
>>>
>>> for ( auto i=0; i>>
>>> Bytes[i] = 0;
>>>
>>> return Bytes;
>>>
>>> }
>>>
>>>
>>> void* TV8Allocator::AllocateUninitialized(size_t length)
>>>
>>> {
>>>
>>> auto* Bytes = new uint8_t[length];
>>>
>>> return Bytes;
>>>
>>> }
>>>
>>>
>>> void TV8Allocator::Free(void* data, size_t length)
>>>
>>> {
>>>
>>> auto* data8 = reinterpret_cast(data);
>>>
>>> delete[] data8;

Re: [v8-users] Arraybuffer

2018-09-10 Thread @soylentgraham
> First, how big is the data member of the object ?

As I said before. Capacity is the size of the memory allocated that data 
points at.


> Is it as big as the actual array buffer length which I declare on 
JavaScript 

It will be either as big, or bigger. It can grow.
bytes_used will be the size that matches javascript.


> which I can build on top of it a typedarray ?

This is a slightly different question, (and needs clarifying)
When you create a typedarray in C++, it needs an array buffer.
When you create a typedarray in javascript, it will have an array buffer 
behind it. (which you may or may not have created in javascript or c++, 
there are several ways of approaching this)


> So, when a typedarray is build on top of an areaybuffer instance, how do 
I get to call the arraybufferbuilder::append ? 

Aha! a more specific question!
Are you trying to call arraybufferbuilder::append in javascript, or c++?
Why? are you trying to make a typedarray bigger? (in javascript or c++?)
I believe once created they're a fixed size in javascript.
I have a feeling on the c++ side, you can't change the size once created 
(but I may be wrong, you have direct access to the buffer's buffercontents 
via the bufferview...)

Can you make your question a lot more specific? post some code?


On Monday, 10 September 2018 22:38:16 UTC+1, dan Med wrote:
>
> First, how big is the data member of the object ? Is it as big as the 
> actual array buffer length which I declare on JavaScript and which I can 
> build on top of it a typedarray ?
>
> No, I’m just trying to understand how v8 works, I know it is a big thing 
> but at least how it moves then I might read the code and understand, extra 
> parts.
>
> So, when a typedarray is build on top of an areaybuffer instance, how do I 
> get to call the arraybufferbuilder::append ? 
>
>
>
>
>
> On Mon, 10 Sep 2018 at 23:30, @soylentgraham  > wrote:
>
>> I'm guessing you may be a bit new to unmanaged-memory languages/systems. 
>>
>> buffer is an object, (it's structure/layout will look a bit like it's 
>> class declaration, but it's a little more complex than that) that was 
>> allocated somewhere sometime, (you can figure out where, but really you 
>> don't need to,  for this purpose it's just an object)
>> data is a member of that object, that points to some memory (somewhere 
>> else, maybe allocated by a different system, in a different place)
>> you have no idea (and you shouldn't need to know, or use the information) 
>> the "offset" from the buffer-object to the data. They are not necessarily 
>> related, or share the same memory space. (and in most cases, they're not 
>> even real memory addresses, they're more like identifiers)
>>
>> Simple Javascript scripts can look like C sometimes (a few variables here 
>> and there, a few array creations), but underneath it's doing a lot more 
>> moving things around.
>> function x()
>> {
>>  var a = new array(10);
>>  var b = new array(100);
>> }
>> This may look like it allocates 2 arrays, but more than likely it's doing 
>> something radically different with actual memory.
>>
>>
>> > so how can i see the memory management ? 
>> As I said, you can't see the javascript side so easily (other than using 
>> the v8 debugging/inspector tools)
>> But if you want to see the C-side memory (which MAY be where the data 
>> that buffer points at came from) you can make your own allocator that v8 
>> can use.
>> If you then breakpoint each call, you'll know when V8 is allocating some 
>> memory to use (which may or may not be a direct object in javascript, an 
>> array or typed array in javascript may not directly allocate here)
>>
>>
>> class TV8Allocator : public v8::ArrayBuffer::Allocator
>>
>> {
>>
>> public:
>>
>> virtual void* Allocate(size_t length) override;
>>
>> virtual void* AllocateUninitialized(size_t length) override;
>>
>> virtual void Free(void* data, size_t length) override;
>>
>> };
>>
>>
>> void* TV8Allocator::Allocate(size_t length)
>>
>> {
>>
>> auto* Bytes = new uint8_t[length];
>>
>> for ( auto i=0; i>
>> Bytes[i] = 0;
>>
>> return Bytes;
>>
>> }
>>
>>
>> void* TV8Allocator::AllocateUninitialized(size_t length)
>>
>> {
>>
>> auto* Bytes = new uint8_t[length];
>>
>> return Bytes;
>>
>> }
>>
>>
>> void TV8Allocator::Free(void* data, size_t length)
>>
>> {
>>
>> auto* data8 = reinterpret_cast(data);
>>
>> delete[] data8;
>>
>> }
>>
>> v8::Isolate::CreateParams create_params;
>>
>> create_params.array_buffer_allocator = 
>>
>>
>>
>> > Cause i saw the code but didn't find how it handles all the possible 
>> javascript i might write into a script file
>>
>>
>> Your computer most likely has more memory than you'll ever write in a 
>> script :)
>>
>> If you're trying to work out where your script goes... arraybuffer isn't 
>> the right place.
>>
>>
>> Do you NEED to know? What exactly are you trying to achieve? (take a 
>> step back from the code and describe what you're trying to do;
>>
>> are you trying to make an app? learn 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
First, how big is the data member of the object ? Is it as big as the
actual array buffer length which I declare on JavaScript and which I can
build on top of it a typedarray ?

No, I’m just trying to understand how v8 works, I know it is a big thing
but at least how it moves then I might read the code and understand, extra
parts.

So, when a typedarray is build on top of an areaybuffer instance, how do I
get to call the arraybufferbuilder::append ?





On Mon, 10 Sep 2018 at 23:30, @soylentgraham 
wrote:

> I'm guessing you may be a bit new to unmanaged-memory languages/systems.
>
> buffer is an object, (it's structure/layout will look a bit like it's
> class declaration, but it's a little more complex than that) that was
> allocated somewhere sometime, (you can figure out where, but really you
> don't need to,  for this purpose it's just an object)
> data is a member of that object, that points to some memory (somewhere
> else, maybe allocated by a different system, in a different place)
> you have no idea (and you shouldn't need to know, or use the information)
> the "offset" from the buffer-object to the data. They are not necessarily
> related, or share the same memory space. (and in most cases, they're not
> even real memory addresses, they're more like identifiers)
>
> Simple Javascript scripts can look like C sometimes (a few variables here
> and there, a few array creations), but underneath it's doing a lot more
> moving things around.
> function x()
> {
>  var a = new array(10);
>  var b = new array(100);
> }
> This may look like it allocates 2 arrays, but more than likely it's doing
> something radically different with actual memory.
>
>
> > so how can i see the memory management ?
> As I said, you can't see the javascript side so easily (other than using
> the v8 debugging/inspector tools)
> But if you want to see the C-side memory (which MAY be where the data that
> buffer points at came from) you can make your own allocator that v8 can use.
> If you then breakpoint each call, you'll know when V8 is allocating some
> memory to use (which may or may not be a direct object in javascript, an
> array or typed array in javascript may not directly allocate here)
>
>
> class TV8Allocator : public v8::ArrayBuffer::Allocator
>
> {
>
> public:
>
> virtual void* Allocate(size_t length) override;
>
> virtual void* AllocateUninitialized(size_t length) override;
>
> virtual void Free(void* data, size_t length) override;
>
> };
>
>
> void* TV8Allocator::Allocate(size_t length)
>
> {
>
> auto* Bytes = new uint8_t[length];
>
> for ( auto i=0; i
> Bytes[i] = 0;
>
> return Bytes;
>
> }
>
>
> void* TV8Allocator::AllocateUninitialized(size_t length)
>
> {
>
> auto* Bytes = new uint8_t[length];
>
> return Bytes;
>
> }
>
>
> void TV8Allocator::Free(void* data, size_t length)
>
> {
>
> auto* data8 = reinterpret_cast(data);
>
> delete[] data8;
>
> }
>
> v8::Isolate::CreateParams create_params;
>
> create_params.array_buffer_allocator = 
>
>
>
> > Cause i saw the code but didn't find how it handles all the possible
> javascript i might write into a script file
>
>
> Your computer most likely has more memory than you'll ever write in a
> script :)
>
> If you're trying to work out where your script goes... arraybuffer isn't
> the right place.
>
>
> Do you NEED to know? What exactly are you trying to achieve? (take a step
> back from the code and describe what you're trying to do;
>
> are you trying to make an app? learn how memory works in c++? learn how
> memory is used in javascript? Why your app uses 1gb of memory?
>
>
>
>
> On Monday, 10 September 2018 22:10:54 UTC+1, dan Med wrote:
>>
>> How big is the offset from buffer to data ?
>> const void* Data
>> ()
>> const { return buffer_
>> 
>> ->
>> 
>> Data
>> ();
>> }
>>
>> sorry for spamming emails, i will try to condensate more
>>
>> Il giorno lun 10 set 2018 alle ore 23:07 dan Med 
>> ha scritto:
>>
>>> Cause i saw the code but didn't find how it handles all the possible
>>> javascript i might write into a script file
>>>
>>> Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
>>> ha scritto:
>>>
 But after using it for a little while, I have found v8 in general is
 pretty simple. It provides an interface to C 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
How big is the offset from buffer to data ?
const void* Data
()
const { return buffer_

->

Data
();
}

sorry for spamming emails, i will try to condensate more

Il giorno lun 10 set 2018 alle ore 23:07 dan Med 
ha scritto:

> Cause i saw the code but didn't find how it handles all the possible
> javascript i might write into a script file
>
> Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
> ha scritto:
>
>> But after using it for a little while, I have found v8 in general is
>> pretty simple. It provides an interface to C functions and memory. This is
>> kinda what it's for.
>>
>> so how can i see the memory management ?
>>
>>
>> Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
>> ha scritto:
>>
>>> So, the hole length of this raw memory is set to be Data ? And to use it
>>> i should create a view on top of it like with typedarrays?
>>>
>>>
>>> So to call arraybuffer::append i should first, try to make the typed
>>> array bigger that action will call the arraybuffer::append  ?  i didn't ask
>>> how memcpy work, i didn't get the Data() thing, in the class that's all.
>>>
>>> Il giorno lun 10 set 2018 alle ore 22:55 @soylentgraham <
>>> gra...@grahamreeves.com> ha scritto:
>>>
 > How can i understand the structure in memory of an arraybuffer and how 
 > big is the data field which is pointed by this void pointerIt has no 
 > structure. It is just a series of linear bytes, raw memory, allocated by 
 > the memory allocator. (If you implement your own memory allocator you 
 > can catch when this happens)It's just the data(buffer) for an array.
 > How are they represented in memoryIt IS memory. It's nothing more 
 > (it's an array of bytes)
 > How big is the data field ?If by "field", you mean, the data buffer... 
 > it's Capacity 
 > 
 >  (capacity is how much it can fit) in length. But not how much is being 
 > used. (bytes_used)
 If you're curious about when memory grows, reallocates, is written to, 
 accessed... it might be worth setting up your environment so you can debug 
 it by stepping through the code as it executes. You can watch memory, 
 (this would show what memcpy changes) see the values passed around, track 
 when memory gets allocated etc.
 Your questions are a mix of very broad, ("How does v8 work") and very 
 specific programming questions (what is memcpy() doing)Broad questions are 
 very hard to answer in general. ("How does a car work")

 I agree, simply browsing the code doesn't give a good overview of say, how 
 the javascript compiler works, or how memory is utilised. (How it is 
 allocated is very simple, on the C/++ side it doesn't implement any memory 
 management, and the array buffer/view is a view of the C-side memory)But 
 after using it for a little while, I have found v8 in general is pretty 
 simple. It provides an interface to C functions and memory. This is kinda 
 what it's for.
 But the point of v8 is that it does a lot of that for you. I don't REALLY 
 need to know how the memory is tracked on the javascript side, it just 
 works (if I'm using the API correctly)Then again, if you NEED to know how 
 it works for a specific purpose (very restricted memory, fixing a bug), we 
 can help you a lot more easily by answering a very specific question. ("My 
 car's low-oil light is blinking, where do I fill it up")
 If you're just curious as to how the entire v8 engine works... that's a 
 massive ask. A lot of people work on it, and there is a lot of work and 
 topics involved.Your best bet is reading the (limited) documentation on 
 the wiki, and read the blog posts https://v8project.blogspot.com/ which go 
 into quite a lot of detail on each post topic.I've not seen any real 
 general overview (the 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
Cause i saw the code but didn't find how it handles all the possible
javascript i might write into a script file

Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
ha scritto:

> But after using it for a little while, I have found v8 in general is
> pretty simple. It provides an interface to C functions and memory. This is
> kinda what it's for.
>
> so how can i see the memory management ?
>
>
> Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
> ha scritto:
>
>> So, the hole length of this raw memory is set to be Data ? And to use it
>> i should create a view on top of it like with typedarrays?
>>
>>
>> So to call arraybuffer::append i should first, try to make the typed
>> array bigger that action will call the arraybuffer::append  ?  i didn't ask
>> how memcpy work, i didn't get the Data() thing, in the class that's all.
>>
>> Il giorno lun 10 set 2018 alle ore 22:55 @soylentgraham <
>> gra...@grahamreeves.com> ha scritto:
>>
>>> > How can i understand the structure in memory of an arraybuffer and how 
>>> > big is the data field which is pointed by this void pointerIt has no 
>>> > structure. It is just a series of linear bytes, raw memory, allocated by 
>>> > the memory allocator. (If you implement your own memory allocator you can 
>>> > catch when this happens)It's just the data(buffer) for an array.
>>> > How are they represented in memoryIt IS memory. It's nothing more 
>>> > (it's an array of bytes)
>>> > How big is the data field ?If by "field", you mean, the data buffer... 
>>> > it's Capacity 
>>> > 
>>> >  (capacity is how much it can fit) in length. But not how much is being 
>>> > used. (bytes_used)
>>> If you're curious about when memory grows, reallocates, is written to, 
>>> accessed... it might be worth setting up your environment so you can debug 
>>> it by stepping through the code as it executes. You can watch memory, (this 
>>> would show what memcpy changes) see the values passed around, track when 
>>> memory gets allocated etc.
>>> Your questions are a mix of very broad, ("How does v8 work") and very 
>>> specific programming questions (what is memcpy() doing)Broad questions are 
>>> very hard to answer in general. ("How does a car work")
>>>
>>> I agree, simply browsing the code doesn't give a good overview of say, how 
>>> the javascript compiler works, or how memory is utilised. (How it is 
>>> allocated is very simple, on the C/++ side it doesn't implement any memory 
>>> management, and the array buffer/view is a view of the C-side memory)But 
>>> after using it for a little while, I have found v8 in general is pretty 
>>> simple. It provides an interface to C functions and memory. This is kinda 
>>> what it's for.
>>> But the point of v8 is that it does a lot of that for you. I don't REALLY 
>>> need to know how the memory is tracked on the javascript side, it just 
>>> works (if I'm using the API correctly)Then again, if you NEED to know how 
>>> it works for a specific purpose (very restricted memory, fixing a bug), we 
>>> can help you a lot more easily by answering a very specific question. ("My 
>>> car's low-oil light is blinking, where do I fill it up")
>>> If you're just curious as to how the entire v8 engine works... that's a 
>>> massive ask. A lot of people work on it, and there is a lot of work and 
>>> topics involved.Your best bet is reading the (limited) documentation on the 
>>> wiki, and read the blog posts https://v8project.blogspot.com/ which go into 
>>> quite a lot of detail on each post topic.I've not seen any real general 
>>> overview (the wiki itself says it's out of date) so, stepping through all 
>>> the code as it executes is probably your best bet.
>>>
>>>
>>> On Monday, 10 September 2018 21:25:37 UTC+1, dan Med wrote:

 in this snippet for example

 namespace WTF 
 
  {// A utility class to build an ArrayBuffer instance. Validity must be 
 checked// by isValid() before using an instance.class WTF_EXPORT 
 
  ArrayBufferBuilder 
 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
But after using it for a little while, I have found v8 in general is pretty
simple. It provides an interface to C functions and memory. This is kinda
what it's for.

so how can i see the memory management ?


Il giorno lun 10 set 2018 alle ore 23:06 dan Med 
ha scritto:

> So, the hole length of this raw memory is set to be Data ? And to use it i
> should create a view on top of it like with typedarrays?
>
>
> So to call arraybuffer::append i should first, try to make the typed array
> bigger that action will call the arraybuffer::append  ?  i didn't ask how
> memcpy work, i didn't get the Data() thing, in the class that's all.
>
> Il giorno lun 10 set 2018 alle ore 22:55 @soylentgraham <
> gra...@grahamreeves.com> ha scritto:
>
>> > How can i understand the structure in memory of an arraybuffer and how big 
>> > is the data field which is pointed by this void pointerIt has no 
>> > structure. It is just a series of linear bytes, raw memory, allocated by 
>> > the memory allocator. (If you implement your own memory allocator you can 
>> > catch when this happens)It's just the data(buffer) for an array.
>> > How are they represented in memoryIt IS memory. It's nothing more 
>> > (it's an array of bytes)
>> > How big is the data field ?If by "field", you mean, the data buffer... 
>> > it's Capacity 
>> > 
>> >  (capacity is how much it can fit) in length. But not how much is being 
>> > used. (bytes_used)
>> If you're curious about when memory grows, reallocates, is written to, 
>> accessed... it might be worth setting up your environment so you can debug 
>> it by stepping through the code as it executes. You can watch memory, (this 
>> would show what memcpy changes) see the values passed around, track when 
>> memory gets allocated etc.
>> Your questions are a mix of very broad, ("How does v8 work") and very 
>> specific programming questions (what is memcpy() doing)Broad questions are 
>> very hard to answer in general. ("How does a car work")
>>
>> I agree, simply browsing the code doesn't give a good overview of say, how 
>> the javascript compiler works, or how memory is utilised. (How it is 
>> allocated is very simple, on the C/++ side it doesn't implement any memory 
>> management, and the array buffer/view is a view of the C-side memory)But 
>> after using it for a little while, I have found v8 in general is pretty 
>> simple. It provides an interface to C functions and memory. This is kinda 
>> what it's for.
>> But the point of v8 is that it does a lot of that for you. I don't REALLY 
>> need to know how the memory is tracked on the javascript side, it just works 
>> (if I'm using the API correctly)Then again, if you NEED to know how it works 
>> for a specific purpose (very restricted memory, fixing a bug), we can help 
>> you a lot more easily by answering a very specific question. ("My car's 
>> low-oil light is blinking, where do I fill it up")
>> If you're just curious as to how the entire v8 engine works... that's a 
>> massive ask. A lot of people work on it, and there is a lot of work and 
>> topics involved.Your best bet is reading the (limited) documentation on the 
>> wiki, and read the blog posts https://v8project.blogspot.com/ which go into 
>> quite a lot of detail on each post topic.I've not seen any real general 
>> overview (the wiki itself says it's out of date) so, stepping through all 
>> the code as it executes is probably your best bet.
>>
>>
>> On Monday, 10 September 2018 21:25:37 UTC+1, dan Med wrote:
>>>
>>> in this snippet for example
>>>
>>> namespace WTF 
>>> 
>>>  {// A utility class to build an ArrayBuffer instance. Validity must be 
>>> checked// by isValid() before using an instance.class WTF_EXPORT 
>>> 
>>>  ArrayBufferBuilder 
>>> 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
So, the hole length of this raw memory is set to be Data ? And to use it i
should create a view on top of it like with typedarrays?


So to call arraybuffer::append i should first, try to make the typed array
bigger that action will call the arraybuffer::append  ?  i didn't ask how
memcpy work, i didn't get the Data() thing, in the class that's all.

Il giorno lun 10 set 2018 alle ore 22:55 @soylentgraham <
gra...@grahamreeves.com> ha scritto:

> > How can i understand the structure in memory of an arraybuffer and how big 
> > is the data field which is pointed by this void pointerIt has no structure. 
> > It is just a series of linear bytes, raw memory, allocated by the memory 
> > allocator. (If you implement your own memory allocator you can catch when 
> > this happens)It's just the data(buffer) for an array.
> > How are they represented in memoryIt IS memory. It's nothing more (it's 
> > an array of bytes)
> > How big is the data field ?If by "field", you mean, the data buffer... it's 
> > Capacity 
> > 
> >  (capacity is how much it can fit) in length. But not how much is being 
> > used. (bytes_used)
> If you're curious about when memory grows, reallocates, is written to, 
> accessed... it might be worth setting up your environment so you can debug it 
> by stepping through the code as it executes. You can watch memory, (this 
> would show what memcpy changes) see the values passed around, track when 
> memory gets allocated etc.
> Your questions are a mix of very broad, ("How does v8 work") and very 
> specific programming questions (what is memcpy() doing)Broad questions are 
> very hard to answer in general. ("How does a car work")
>
> I agree, simply browsing the code doesn't give a good overview of say, how 
> the javascript compiler works, or how memory is utilised. (How it is 
> allocated is very simple, on the C/++ side it doesn't implement any memory 
> management, and the array buffer/view is a view of the C-side memory)But 
> after using it for a little while, I have found v8 in general is pretty 
> simple. It provides an interface to C functions and memory. This is kinda 
> what it's for.
> But the point of v8 is that it does a lot of that for you. I don't REALLY 
> need to know how the memory is tracked on the javascript side, it just works 
> (if I'm using the API correctly)Then again, if you NEED to know how it works 
> for a specific purpose (very restricted memory, fixing a bug), we can help 
> you a lot more easily by answering a very specific question. ("My car's 
> low-oil light is blinking, where do I fill it up")
> If you're just curious as to how the entire v8 engine works... that's a 
> massive ask. A lot of people work on it, and there is a lot of work and 
> topics involved.Your best bet is reading the (limited) documentation on the 
> wiki, and read the blog posts https://v8project.blogspot.com/ which go into 
> quite a lot of detail on each post topic.I've not seen any real general 
> overview (the wiki itself says it's out of date) so, stepping through all the 
> code as it executes is probably your best bet.
>
>
> On Monday, 10 September 2018 21:25:37 UTC+1, dan Med wrote:
>>
>> in this snippet for example
>>
>> namespace WTF 
>> 
>>  {// A utility class to build an ArrayBuffer instance. Validity must be 
>> checked// by isValid() before using an instance.class WTF_EXPORT 
>> 
>>  ArrayBufferBuilder 
>> 
>>  final {  // Disallow copying since it's expensive and we don't want code to 
>> do it by  // accident.  USING_FAST_MALLOC 
>> 

Re: [v8-users] Arraybuffer

2018-09-10 Thread dan Med
in this snippet for example

namespace WTF 

{// A utility class to build an ArrayBuffer instance. Validity must be
checked// by isValid() before using an instance.class WTF_EXPORT

ArrayBufferBuilder

final {  // Disallow copying since it's expensive and we don't want
code to do it by  // accident.  USING_FAST_MALLOC
(ArrayBufferBuilder
);
public:  // Creates an ArrayBufferBuilder using the default capacity.
ArrayBufferBuilder
();
 ArrayBufferBuilder
(unsigned
capacity 
)
 : bytes_used_
(0),
variable_capacity_
(true)
{buffer_ 

= 

ArrayBuffer 
::Create
(capacity
,
1);  }  bool IsValid
()
const { return buffer_
.get
();
}  // Appending empty data is not allowed.  unsigned Append

Re: [v8-users] Arraybuffer

2018-09-10 Thread Jakob Kummerow
On Mon, Sep 10, 2018 at 12:22 PM dan Med  wrote:

> I don't quite see if this google group is useful or not, everybody keeps
> answering me with superficial things,
>

You said you wanted to read the compiler's source but couldn't find it, so
I told you that it's in src/compiler/. If that was not the answer you
wanted, then try asking a different question?

Please also keep in mind that people's time is limited. The easier/quicker
it is to answer your question, the more likely you are to get an answer.

i don't care about the trminology like tell me which allocator it uses when
> and why or at least if there's something i can read to understand.
> I'm surprised u don't know what a JIT page is, basically if you call a
> function foo() let's say 100 times then v8,had enough time to understand
> the parameters given to that specific function and how to optimize it
> efficently based on it's prediction/observation.
>
> I'm not interested in the terminology of things, (that's just a matter of
> reading the source code ) i'm more in reading how it works when and why..
>

It's great that you want to understand how things work. Terminology is an
important aspect of that though, because it enables communication. If we
use different words for the same thing, we won't understand each other.
Based on your explanation, I'm guessing that by "JIT page" you mean "the
strategy V8 uses to select functions for optimization". The core of that
logic is in MarkCandidatesForOptimization in src/runtime-profiler.cc.


> For example when is ArrayBufferBuilder::Append called ??
>

I don't know; it's not part of V8. But you can use Code Search to find out
where anything is called, just click the function in question to get a list
of call sites:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?q=ArrayBufferBuilder=package:chromium=0=61


> And i thing i've looked at the entire v8 source code but didn't find much,
> apart from the array.js file which describes some javascript function, i
> don't understand where's the rest
>


Il giorno lun 10 set 2018 alle ore 20:45 Jakob Kummerow <
> jkumme...@chromium.org> ha scritto:
>
>> On Sun, Sep 9, 2018 at 8:54 AM dan Med  wrote:
>>
>>> Oh and one more thing, i've surfed perhaps the entire source code of v8
>>> at least the interesting parts, but what i came across was just very short
>>> code execpt for some builtins written in javascript i believe, can't find
>>> all of the things i've found on the documentation such as the interpreter
>>>
>>
>> src/interpreter/
>>
>>
>>> and the JIT compilers,
>>>
>>
>> src/compiler/
>>
>>
>>> one more thing i'd like to understand how the memory is handeled like
>>> how can i read about the JIT pages,
>>>
>>
>> What's a JIT page?
>>
>>
>>> or which memory allocator does v8 use
>>>
>>
>> It uses several allocation techniques for different purposes.
>>
>>
>>> and it's garbage collector
>>>
>>
>> src/heap/
>>
>>
>>>
>>> Thank you !
>>>
>>> Il giorno dom 9 set 2018 alle ore 17:51 dan Med 
>>> ha scritto:
>>>
 I don't have understood this part, let me explain it to you.
 This is how i get it tell me if i'm wrong at any part.

 I need to understand how is the structure in memory of the arraybuffer
 how is it represented and if the data of the array are directly stored at
 an offset accessed by buffer_ -> data().


 before the call to expand capacity it does create an array


 the arraybuffer in src /
 third_party /blink
 /renderer
 /
 platform
 
 /wtf
 
 /typed_arrays
 
 /array_buffer_builder.cc
 
  is
 called whenever the renderer  (has to execute some javascript which defines
 arraybuffers)
 First when is arraybuffer::append  called, cause i know that if someone
 need to reallocate a bigger arraybuffer then a new instance will be created
 and filled with the old values if the length in the original array isn't
 has much as the user reqeusted ?

 One more thing is, when this class is called, the arraybuffer is always
 set to the initial length of static const int kDefaultBufferCapacity
 

Re: [v8-users] Arraybuffer

2018-09-10 Thread Jakob Kummerow
On Sun, Sep 9, 2018 at 8:54 AM dan Med  wrote:

> Oh and one more thing, i've surfed perhaps the entire source code of v8 at
> least the interesting parts, but what i came across was just very short
> code execpt for some builtins written in javascript i believe, can't find
> all of the things i've found on the documentation such as the interpreter
>

src/interpreter/


> and the JIT compilers,
>

src/compiler/


> one more thing i'd like to understand how the memory is handeled like how
> can i read about the JIT pages,
>

What's a JIT page?


> or which memory allocator does v8 use
>

It uses several allocation techniques for different purposes.


> and it's garbage collector
>

src/heap/


>
> Thank you !
>
> Il giorno dom 9 set 2018 alle ore 17:51 dan Med 
> ha scritto:
>
>> I don't have understood this part, let me explain it to you.
>> This is how i get it tell me if i'm wrong at any part.
>>
>> I need to understand how is the structure in memory of the arraybuffer
>> how is it represented and if the data of the array are directly stored at
>> an offset accessed by buffer_ -> data().
>>
>>
>> before the call to expand capacity it does create an array
>>
>>
>> the arraybuffer in src /
>> third_party /blink
>> /renderer
>> /
>> platform
>> 
>> /wtf
>> 
>> /typed_arrays
>> 
>> /array_buffer_builder.cc
>> 
>>  is
>> called whenever the renderer  (has to execute some javascript which defines
>> arraybuffers)
>> First when is arraybuffer::append  called, cause i know that if someone
>> need to reallocate a bigger arraybuffer then a new instance will be created
>> and filled with the old values if the length in the original array isn't
>> has much as the user reqeusted ?
>>
>> One more thing is, when this class is called, the arraybuffer is always
>> set to the initial length of static const int kDefaultBufferCapacity
>> 
>> = 32768; if in the javascript i declare an arraybuffer of 20bytes will
>> it allocate of
>> 32768bytes anyway =?
>>
>>
>>
>>
>>
>>
>>
>> Il giorno mar 4 set 2018 alle ore 12:14 Graham Reeves <
>> gra...@grahamreeves.com> ha scritto:
>>
>>> > is std::numeric_limits
>>> 
>>> ::max
>>> ();
>>> referring to the max unsigned int value ? cause the source code won't find
>>> it
>>> Yes, that's the maximum value unsigned (an unsigned int) can be, but
>>> what do you mean by, the source won't find it?
>>>
>>> On Monday, 3 September 2018 19:55:48 UTC+1, dan Med wrote:

 Can someone help me out?

 Il giorno sab 1 set 2018 alle ore 15:30  ha
 scritto:

> array_buffer_builder.cc in src 
> /third_party /blink
> /renderer
> /
> platform
> 
> /wtf
> 
> /typed_arrays
> 
> /array_buffer_builder.cc
> 
>
> the ArrayBufferBuilder
> 
> ::Append
> 

Re: [v8-users] Arraybuffer

2018-09-09 Thread dan Med
I don't have understood this part, let me explain it to you.
This is how i get it tell me if i'm wrong at any part.

I need to understand how is the structure in memory of the arraybuffer how
is it represented and if the data of the array are directly stored at an
offset accessed by buffer_ -> data().


before the call to expand capacity it does create an array


the arraybuffer in src /third_party
/blink
/renderer
/platform
/
wtf

/typed_arrays

/array_buffer_builder.cc

is
called whenever the renderer  (has to execute some javascript which defines
arraybuffers)
First when is arraybuffer::append  called, cause i know that if someone
need to reallocate a bigger arraybuffer then a new instance will be created
and filled with the old values if the length in the original array isn't
has much as the user reqeusted ?

One more thing is, when this class is called, the arraybuffer is always set
to the initial length of static const int kDefaultBufferCapacity

= 32768; if in the javascript i declare an arraybuffer of 20bytes will it
allocate of
32768bytes anyway =?







Il giorno mar 4 set 2018 alle ore 12:14 Graham Reeves <
gra...@grahamreeves.com> ha scritto:

> > is std::numeric_limits
> 
> ::max
> ();
> referring to the max unsigned int value ? cause the source code won't find
> it
> Yes, that's the maximum value unsigned (an unsigned int) can be, but what
> do you mean by, the source won't find it?
>
> On Monday, 3 September 2018 19:55:48 UTC+1, dan Med wrote:
>>
>> Can someone help me out?
>>
>> Il giorno sab 1 set 2018 alle ore 15:30  ha scritto:
>>
>>> array_buffer_builder.cc in src /
>>> third_party /blink
>>> /renderer
>>> /
>>> platform
>>> 
>>> /wtf
>>> 
>>> /typed_arrays
>>> 
>>> /array_buffer_builder.cc
>>> 
>>>
>>> the ArrayBufferBuilder
>>> 
>>> ::Append
>>> 
>>>  method
>>> will be called through a view on top of the arraybuffer? something like,
>>> there's a arraybuffer of 30bytes in length and we define a view on top of
>>> it (so a typedarray) wehn i call on the new typedarray object the .append
>>> method it will call ArrayBufferBuilder
>>> 
>>> ::Append
>>> 
>>> and then inside it's code it 

Re: [v8-users] Arraybuffer

2018-09-04 Thread Graham Reeves
> is std::numeric_limits 

::max 
();
 
referring to the max unsigned int value ? cause the source code won't find 
it 
Yes, that's the maximum value unsigned (an unsigned int) can be, but what 
do you mean by, the source won't find it?

On Monday, 3 September 2018 19:55:48 UTC+1, dan Med wrote:
>
> Can someone help me out?
>
> Il giorno sab 1 set 2018 alle ore 15:30 > 
> ha scritto:
>
>> array_buffer_builder.cc in src /
>> third_party /blink 
>> /renderer 
>> /
>> platform 
>> 
>> /wtf 
>> 
>> /typed_arrays 
>> 
>> /array_buffer_builder.cc 
>> 
>>  
>> the ArrayBufferBuilder 
>> 
>> ::Append 
>> 
>>  method 
>> will be called through a view on top of the arraybuffer? something like, 
>> there's a arraybuffer of 30bytes in length and we define a view on top of 
>> it (so a typedarray) wehn i call on the new typedarray object the .append 
>> method it will call ArrayBufferBuilder 
>> 
>> ::Append 
>> 
>>   
>> and then inside it's code it will execute ArrayBufferBuilder 
>> 
>> ::ExpandCapacity 
>> 
>>  if 
>> it needs to reallocate the array ?
>>
>> if so inside the expandCapacity definition bytes_used 
>> 
>>  referes 
>> to the elements inside the actual arraybuffer so if i have a arraybuffer 
>> which is 8 bytes in length [ ][ ][ ][ ][ ][ ][ ][ ] and i fill in only 3 
>> bytes so 
>> [1][2][3][ ][ ][ ][ ][ ] the bytes_used 
>> 
>>  when 
>> retrieved will be set to 3 bytes ??
>>
>> ArrayBufferBuilder 
>> ::ArrayBufferBuilder
>>  
>> ()
>> : bytes_used_ 
>> (0),
>>  variable_capacity_ 
>> 

Re: [v8-users] Arraybuffer

2018-09-03 Thread dan Med
Can someone help me out?

Il giorno sab 1 set 2018 alle ore 15:30  ha
scritto:

> array_buffer_builder.cc in src /
> third_party /blink
> /renderer
> /
> platform
> 
> /wtf
> 
> /typed_arrays
> 
> /array_buffer_builder.cc
> 
>
> the ArrayBufferBuilder
> 
> ::Append
> 
>  method
> will be called through a view on top of the arraybuffer? something like,
> there's a arraybuffer of 30bytes in length and we define a view on top of
> it (so a typedarray) wehn i call on the new typedarray object the .append
> method it will call ArrayBufferBuilder
> 
> ::Append
> 
> and then inside it's code it will execute ArrayBufferBuilder
> 
> ::ExpandCapacity
> 
>  if
> it needs to reallocate the array ?
>
> if so inside the expandCapacity definition bytes_used
> 
>  referes
> to the elements inside the actual arraybuffer so if i have a arraybuffer
> which is 8 bytes in length [ ][ ][ ][ ][ ][ ][ ][ ] and i fill in only 3
> bytes so
> [1][2][3][ ][ ][ ][ ][ ] the bytes_used
> 
>  when
> retrieved will be set to 3 bytes ??
>
> ArrayBufferBuilder 
> ::ArrayBufferBuilder
>  
> ()
> : bytes_used_ 
> (0),
>  variable_capacity_ 
> (true)
>  {  buffer_ 
> 
>  = 
> 
>  ArrayBuffer 
> ::Create
>  
> 

[v8-users] Arraybuffer

2018-09-01 Thread litokis . tarin
array_buffer_builder.cc in src /
third_party /blink 
/renderer 
/platform 
/
wtf 

/typed_arrays 

/array_buffer_builder.cc 

 
the ArrayBufferBuilder 

::Append 

 method 
will be called through a view on top of the arraybuffer? something like, 
there's a arraybuffer of 30bytes in length and we define a view on top of 
it (so a typedarray) wehn i call on the new typedarray object the .append 
method it will call ArrayBufferBuilder 

::Append 

  
and then inside it's code it will execute ArrayBufferBuilder 

::ExpandCapacity 

 if 
it needs to reallocate the array ?

if so inside the expandCapacity definition bytes_used 

 referes 
to the elements inside the actual arraybuffer so if i have a arraybuffer 
which is 8 bytes in length [ ][ ][ ][ ][ ][ ][ ][ ] and i fill in only 3 
bytes so 
[1][2][3][ ][ ][ ][ ][ ] the bytes_used 

 when 
retrieved will be set to 3 bytes ??

ArrayBufferBuilder 
::ArrayBufferBuilder
 
()
: bytes_used_ 
(0),
 variable_capacity_ 
(true)
 {  buffer_ 

 = 

 ArrayBuffer 
::Create
 
(kDefaultBufferCapacity
 

Re: [v8-users] ArrayBuffer::Allocator::Free() length differing from Allocate() length?

2018-03-16 Thread Michael Lippautz
Is that the exact implementation? v8::ArrayBuffer::Allocator is required to
be thread-safe [1] as V8 potentially (depends on the platform
implementation) offloads the freeing onto a different thread.

Cheers, -Michael

[1] https://cs.chromium.org/chromium/src/v8/include/v8.h?dr=CSs=4269


On Thu, Mar 15, 2018 at 2:36 AM 'Kenton Varda' via v8-users <
v8-users@googlegroups.com> wrote:

> Hi v8-users,
>
> We have an ArrayBufferAllocator implementation that counts how much memory
> has been allocated. It basically looks like this:
>
> class AllocatorImpl final: public v8::ArrayBuffer::Allocator {
>
> public:
>
>   AllocatorImpl(): allocated(0) {}
>
>   ~AllocatorImpl();
>
>
>   inline size_t getMemoryUsage() const { return allocated; }
>
>
>   void* Allocate(size_t length) {
>
> allocated += length;
>
> return calloc(length, 1);
>
>   }
>
>   void* AllocateUninitialized(size_t length) {
>
> allocated += length;
>
> return malloc(length);
>
>   }
>
>   void Free(void* data, size_t length) {
>
> allocated -= length;
>
> free(data);
>
>   }
>
>
> private:
>
>   size_t allocated;
>
> };
>
>
> We're observing something strange: Sometimes (very rarely!), the
> `allocated` value drops below zero and wraps around, apparently indicating
> that V8 has Free()'d more than it Allocate()ed. However, there don't seem
> to be any issues with double-frees or freeing an invalid pointer.
>
> Any idea what could lead to this? Is it possible for V8 to pass a
> different `legth` value to Free() than it passed to Allocate()?
>
> Unfortunately I have no idea how to reproduce this reliably. It only
> happens very occasionally in production. :/
>
> -Kenton
>
> --
> --
> 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] ArrayBuffer::Allocator::Free() length differing from Allocate() length?

2018-03-14 Thread 'Kenton Varda' via v8-users
Hi v8-users,

We have an ArrayBufferAllocator implementation that counts how much memory
has been allocated. It basically looks like this:

class AllocatorImpl final: public v8::ArrayBuffer::Allocator {

public:

  AllocatorImpl(): allocated(0) {}

  ~AllocatorImpl();


  inline size_t getMemoryUsage() const { return allocated; }


  void* Allocate(size_t length) {

allocated += length;

return calloc(length, 1);

  }

  void* AllocateUninitialized(size_t length) {

allocated += length;

return malloc(length);

  }

  void Free(void* data, size_t length) {

allocated -= length;

free(data);

  }


private:

  size_t allocated;

};


We're observing something strange: Sometimes (very rarely!), the
`allocated` value drops below zero and wraps around, apparently indicating
that V8 has Free()'d more than it Allocate()ed. However, there don't seem
to be any issues with double-frees or freeing an invalid pointer.

Any idea what could lead to this? Is it possible for V8 to pass a different
`legth` value to Free() than it passed to Allocate()?

Unfortunately I have no idea how to reproduce this reliably. It only
happens very occasionally in production. :/

-Kenton

-- 
-- 
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] ArrayBuffer API triggers unnecessary mark-and-sweep events.

2015-09-01 Thread Mark Logan
If I iterate the following steps:

  auto contents = buffer->Externalize();
  buffer->Neuter();

  auto newBuffer = ArrayBuffer::New(isolate, contents.Data(), 
contents.ByteLength(),

v8::ArrayBufferCreationMode::kInternalized);

V8 repeatedly triggers full mark-and-sweep GC passes even though the size 
of the external heap is not increasing. This is because creating an 
internalized ArrayBuffer from existing memory adjusts v8s external heap 
estimate upward, but externalizing/neutering the same array does not appear 
to adjust that estimate downward. (See api.cc and runtime-typedarray.cc).

I have a reproduction using iojs-3.2.0 (v8 version 4.4.63) here: 
https://github.com/mlogan/arraybuffer-gc

This seems undesirable, although I can imagine there might be other cases 
where this is desirable behavior. Let me know if this should be considered 
a bug, I'm happy to file it.

Thanks,
Mark

-- 
-- 
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] ArrayBuffer fast access

2012-06-16 Thread Vyacheslav Egorov
 I couldn't find any fast access defined in the JIT compiler

There are fast paths for typed arrays inside V8, they are just not
called typed arrays :-) Look for external arrays instead.

For them V8 has both specialized IC stubs (e.g. load stub:
https://github.com/v8/v8/blob/master/src/ia32/stub-cache-ia32.cc#L3508
) and support in optimizing compiler pipeline (see IR instructions:
LoadExternalArrayPointer, LoadKeyedSpecializedArrayElement,
StoreKeyedSpecializedArrayElement).

I always use typed arrays when they are available (this communicates
my intent both to the JIT compiler and to a person reading my code).

--
Vyacheslav Egorov


On Sat, Jun 16, 2012 at 5:44 PM, Pablo Sole pablo.s...@gmail.com wrote:
 Hello there,

 I'm embedding v8 into a binary instrumentation framework and I'm trying
 to use an ArrayBuffer/TypedBuffer for fast memory operations (like
 Tamarin/ActionScript does for the Memory object operations), but I
 couldn't find any fast access defined in the JIT compiler, so I suppose
 that a read/write to a TypedBuffer goes all the way of an object and
 property resolution. Although, for this case it could just be a range
 check and a memory load/store operation.

 So, would it be faster to use a regular array of SMIs (SMIs in the
 indexes and in the values) without holes faster than an ArrayBuffer? Is
 there any plan to provide a fast path for this case?

 Thanks,

 pablo.

 --
 v8-users mailing list
 v8-users@googlegroups.com
 http://groups.google.com/group/v8-users

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users