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 <litokis.ta...@gmail.com> 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 <litokis.ta...@gmail.com>
> 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 <litokis.ta...@gmail.com>
>> 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
>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=38&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.cc%2523YXDT7WTpXCAcuhdyTlkuCzsfCzI%25252BoHLRFAlkbCrkx4g%25253D&gsn=kDefaultBufferCapacity&ct=xref_usages>
>>> = 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 <litoki...@gmail.com> 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<Object> 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 <
>>>>>>>> gra...@grahamreeves.com> 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 <
>>>>>>>>>> gra...@grahamreeves.com> 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<length; 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<uint8_t*>(data);
>>>>>>>>>>>
>>>>>>>>>>> delete[] data8;
>>>>>>>>>>>
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> v8::Isolate::CreateParams create_params;
>>>>>>>>>>>
>>>>>>>>>>> create_params.array_buffer_allocator = &mAllocator;
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> > 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
>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=80&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523b8F1aEDx%25252F6En%25252FkOKh2zVkvONjtDNg9gr5KG7gT9XeJk%25253D&gsn=Data&ct=xref_usages>()
>>>>>>>>>>>> const { return buffer_
>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&ct=xref_jump_to_def&gsn=buffer_>
>>>>>>>>>>>> ->
>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=218&ct=xref_jump_to_def&gsn=-%3E>
>>>>>>>>>>>> Data
>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=225&ct=xref_jump_to_def&gsn=Data>();
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> sorry for spamming emails, i will try to condensate more
>>>>>>>>>>>>
>>>>>>>>>>>> Il giorno lun 10 set 2018 alle ore 23:07 dan Med <
>>>>>>>>>>>> litoki...@gmail.com> 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 <
>>>>>>>>>>>>> litoki...@gmail.com> 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 <
>>>>>>>>>>>>>> litoki...@gmail.com> 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 memory....It 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 
>>>>>>>>>>>>>>>> > <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=76&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523kB%25252BJ1WxDvoDqf1c8Tz5Ol3yne4lD03cRpevK2LHMUZk%25253D&gsn=Capacity&ct=xref_usages>
>>>>>>>>>>>>>>>> >  (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 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=40&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%2523WTF%252523n%252523namespace&gsn=WTF&ct=xref_usages>
>>>>>>>>>>>>>>>>>  {// A utility class to build an ArrayBuffer instance. 
>>>>>>>>>>>>>>>>> Validity must be checked// by isValid() before using an 
>>>>>>>>>>>>>>>>> instance.class WTF_EXPORT 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/wtf_export.h?l=46&ct=xref_jump_to_def&gsn=WTF_EXPORT>
>>>>>>>>>>>>>>>>>  ArrayBufferBuilder 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=44&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523ArrayBufferBuilder%25253AWTF%252523c%252523hTnYOn1mFcU%2Bkythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523NyhHD05MjDx8XOe1m%25252BLqXBLvqdjWPsLmDrRvvmR2Ywk%25253D&gsn=ArrayBufferBuilder&ct=xref_usages>
>>>>>>>>>>>>>>>>>  final {  // Disallow copying since it's expensive and we 
>>>>>>>>>>>>>>>>> don't want code to do it by  // accident.  USING_FAST_MALLOC 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/allocator.h?l=146&ct=xref_jump_to_def&gsn=USING_FAST_MALLOC>(ArrayBufferBuilder
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=44&ct=xref_jump_to_def&gsn=ArrayBufferBuilder>);
>>>>>>>>>>>>>>>>>  public:  // Creates an ArrayBufferBuilder using the default 
>>>>>>>>>>>>>>>>> capacity.  ArrayBufferBuilder 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=51&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523me5JBk4wDIaIJCK86MiUpy%25252BnGYRZwEr0AvVg3KaU0pw%25253D&gsn=ArrayBufferBuilder&ct=xref_usages>();
>>>>>>>>>>>>>>>>>   ArrayBufferBuilder 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=53&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523VW0P45Tk9IGjtOqM%25252B9dHdJ64so3WDAfcY1jNBLt0GNY%25253D&gsn=ArrayBufferBuilder&ct=xref_usages>(unsigned
>>>>>>>>>>>>>>>>>  capacity 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=53&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523trfcCH7BPCRWiubGq1QF9bypkCRNYtWGHb2AzglMces%25253D&gsn=capacity&ct=xref_usages>)
>>>>>>>>>>>>>>>>>       : bytes_used_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=92&ct=xref_jump_to_def&gsn=bytes_used_>(0),
>>>>>>>>>>>>>>>>>  variable_capacity_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=93&ct=xref_jump_to_def&gsn=variable_capacity_>(true)
>>>>>>>>>>>>>>>>>  {    buffer_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&ct=xref_jump_to_def&gsn=buffer_>
>>>>>>>>>>>>>>>>>  = 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=226&ct=xref_jump_to_def&gsn=%3D>
>>>>>>>>>>>>>>>>>  ArrayBuffer 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=42&ct=xref_jump_to_def&gsn=ArrayBuffer>::Create
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=125&ct=xref_jump_to_def&gsn=Create>(capacity
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=53&ct=xref_jump_to_def&gsn=capacity>,
>>>>>>>>>>>>>>>>>  1);  }  bool IsValid 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=58&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523Bx72YH%25252BiA4nF5ZIPsFhA9MQpdVCDOCRHSZa0Ksg6Wp4%25253D&gsn=IsValid&ct=xref_usages>()
>>>>>>>>>>>>>>>>>  const { return buffer_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&ct=xref_jump_to_def&gsn=buffer_>.get
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=211&ct=xref_jump_to_def&gsn=get>();
>>>>>>>>>>>>>>>>>  }  // Appending empty data is not allowed.  unsigned Append 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=61&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523BHKR8BlIFhr03faCJF5mu7RDXZ%25252FPtZDAlnACyKmv1XM%25253D&gsn=Append&ct=xref_usages>(const
>>>>>>>>>>>>>>>>>  char* data 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=61&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%25233VvJP%25252BUI3abzouA4%25252FYSBHt09pw3AiNI9e9QAJGooqYI%25253D&gsn=data&ct=xref_usages>,
>>>>>>>>>>>>>>>>>  unsigned length 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=61&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523xOZXOK9mCrzsbUtqCxdbDuLg939IJhl7gbf0EykKwnY%25253D&gsn=length&ct=xref_usages>);
>>>>>>>>>>>>>>>>>   // Returns the accumulated data as an ArrayBuffer instance. 
>>>>>>>>>>>>>>>>> If needed,  // creates a new ArrayBuffer instance and copies 
>>>>>>>>>>>>>>>>> contents from the internal  // buffer to it. Otherwise, 
>>>>>>>>>>>>>>>>> returns a RefPtr pointing to the internal  // buffer.  
>>>>>>>>>>>>>>>>> scoped_refptr 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=167&ct=xref_jump_to_def&gsn=scoped_refptr><ArrayBuffer
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=42&ct=xref_jump_to_def&gsn=ArrayBuffer>>
>>>>>>>>>>>>>>>>>  ToArrayBuffer 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=67&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523JX559OA9Zt0rALNU4DOTOkzcmtws4U5V42xhN0rrbow%25253D&gsn=ToArrayBuffer&ct=xref_usages>();
>>>>>>>>>>>>>>>>>   // Converts the accumulated data into a String using the 
>>>>>>>>>>>>>>>>> default encoding.  String 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/text/wtf_string.h?l=64&ct=xref_jump_to_def&gsn=String>
>>>>>>>>>>>>>>>>>  ToString 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=70&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523VMCyw7t%25252FF0UIo65pz8LTbfX5k5G4pIXrUNQbDNKDjaE%25253D&gsn=ToString&ct=xref_usages>();
>>>>>>>>>>>>>>>>>   // Number of bytes currently accumulated.  unsigned 
>>>>>>>>>>>>>>>>> ByteLength 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=73&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523P5Klo%25252BJeJiug%25252FrSAfsaHI8wAnW8h5UBg2%25252BoJByO85kA%25253D&gsn=ByteLength&ct=xref_usages>()
>>>>>>>>>>>>>>>>>  const { return bytes_used_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=92&ct=xref_jump_to_def&gsn=bytes_used_>;
>>>>>>>>>>>>>>>>>  }  // Number of bytes allocated.  unsigned Capacity 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=76&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523kB%25252BJ1WxDvoDqf1c8Tz5Ol3yne4lD03cRpevK2LHMUZk%25253D&gsn=Capacity&ct=xref_usages>()
>>>>>>>>>>>>>>>>>  const { return buffer_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&ct=xref_jump_to_def&gsn=buffer_>->
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=218&ct=xref_jump_to_def&gsn=-%3E>ByteLength
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=249&ct=xref_jump_to_def&gsn=ByteLength>();
>>>>>>>>>>>>>>>>>  }  void ShrinkToFit 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=78&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523WBvAUuWtgva6ffSXIiEGEkt%25252FFFbeCcQcsCz5E%25252FHCKOo%25253D&gsn=ShrinkToFit&ct=xref_usages>();
>>>>>>>>>>>>>>>>>   const void* Data 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=80&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523b8F1aEDx%25252F6En%25252FkOKh2zVkvONjtDNg9gr5KG7gT9XeJk%25253D&gsn=Data&ct=xref_usages>()
>>>>>>>>>>>>>>>>>  const { return buffer_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&ct=xref_jump_to_def&gsn=buffer_>->
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=218&ct=xref_jump_to_def&gsn=-%3E>Data
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=225&ct=xref_jump_to_def&gsn=Data>();
>>>>>>>>>>>>>>>>>  }  // If set to false, the capacity won't be expanded and 
>>>>>>>>>>>>>>>>> when appended data  // overflows, the overflowed part will be 
>>>>>>>>>>>>>>>>> dropped.  void SetVariableCapacity 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=84&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%25232ib6USbezkKcLs8hjPaCz4GUGrUHdD%25252BeN%25252FKenERnRLA%25253D&gsn=SetVariableCapacity&ct=xref_usages>(bool
>>>>>>>>>>>>>>>>>  value 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=84&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523vUjrriXMW5FurGjU87jcAlZRQs3b8JSgA4Tt1xrSq7I%25253D&gsn=value&ct=xref_usages>)
>>>>>>>>>>>>>>>>>  { variable_capacity_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=93&ct=xref_jump_to_def&gsn=variable_capacity_>
>>>>>>>>>>>>>>>>>  = value 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=84&ct=xref_jump_to_def&gsn=value>;
>>>>>>>>>>>>>>>>>  } private:  // Expands the size of m_buffer to size + 
>>>>>>>>>>>>>>>>> m_bytesUsed bytes. Returns true  // iff successful. If 
>>>>>>>>>>>>>>>>> reallocation is needed, copies only data in  // [0, 
>>>>>>>>>>>>>>>>> m_bytesUsed) range.  bool ExpandCapacity 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=90&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523szv9AYLlP3J7qhn%25252Fm%25252BJqzPmSgWf45%25252BRVwVxvXDk3WYQ%25253D&gsn=ExpandCapacity&ct=xref_usages>(unsigned
>>>>>>>>>>>>>>>>>  size 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=90&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523mXwymG5xtblCCeS4C9QcnmOwJxql8nYDr2HLqNZVJ8I%25253D&gsn=size&ct=xref_usages>);
>>>>>>>>>>>>>>>>>   unsigned bytes_used_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=92&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523x95FyaH%25252BSeW1SF4BFhX9oIq7qgtHy3xzXCMmc37LcL8%25253D&gsn=bytes_used_&ct=xref_usages>;
>>>>>>>>>>>>>>>>>   bool variable_capacity_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=93&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523FKWGJXbcZ%25252BRuy6YD7uxQ765XV8Mhciv4FM%25252FF5B3bNvU%25253D&gsn=variable_capacity_&ct=xref_usages>;
>>>>>>>>>>>>>>>>>   scoped_refptr 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/memory/scoped_refptr.h?l=167&ct=xref_jump_to_def&gsn=scoped_refptr><ArrayBuffer
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h?l=42&ct=xref_jump_to_def&gsn=ArrayBuffer>>
>>>>>>>>>>>>>>>>>  buffer_ 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=94&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523aFDjYtlmS2tmLXL2XyJ158HoigBmsAdzguhOSb6XQIw%25253D&gsn=buffer_&ct=xref_usages>;
>>>>>>>>>>>>>>>>>   DISALLOW_COPY_AND_ASSIGN 
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/base/macros.h?l=33&ct=xref_jump_to_def&gsn=DISALLOW_COPY_AND_ASSIGN>(ArrayBufferBuilder
>>>>>>>>>>>>>>>>>  
>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.h?l=96&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.h%2523E6nSXqAY3ipexrHDKPfjzHqWqWIsAlT3EH3KVhT57GQ%25253D&gsn=ArrayBufferBuilder&ct=xref_usages>);};}
>>>>>>>>>>>>>>>>>   // namespace WTF
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> How can i understand the structure in memory of an 
>>>>>>>>>>>>>>>>> arraybuffer and how big is the data field which is pointed by 
>>>>>>>>>>>>>>>>> this void pointerHow are they represented in memory....How 
>>>>>>>>>>>>>>>>> big is the data field ?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Il giorno lun 10 set 2018 alle ore 22:19 dan Med <
>>>>>>>>>>>>>>>>> litoki...@gmail.com> ha scritto:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> i already did that and btw it is under the WTF/webkit .
>>>>>>>>>>>>>>>>>> I'm interested how v8 handles javascript into every
>>>>>>>>>>>>>>>>>> detail if u can guide me...
>>>>>>>>>>>>>>>>>> Tell me which repository are being used by v8 on the
>>>>>>>>>>>>>>>>>> related topic that would help me really much.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> By when it is called i mean, which javascript code will
>>>>>>>>>>>>>>>>>> enable me to call that funciton cause if u click u can't go 
>>>>>>>>>>>>>>>>>> any further
>>>>>>>>>>>>>>>>>> than that,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Il giorno lun 10 set 2018 alle ore 21:53 Jakob Kummerow <
>>>>>>>>>>>>>>>>>> jkum...@chromium.org> ha scritto:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Mon, Sep 10, 2018 at 12:22 PM dan Med <
>>>>>>>>>>>>>>>>>>> litoki...@gmail.com> 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&sq=package:chromium&g=0&l=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 <
>>>>>>>>>>>>>>>>>>>> jkum...@chromium.org> ha scritto:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On Sun, Sep 9, 2018 at 8:54 AM dan Med <
>>>>>>>>>>>>>>>>>>>>> litoki...@gmail.com> 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 <
>>>>>>>>>>>>>>>>>>>>>> litoki...@gmail.com> 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
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/>/third_party
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/>/
>>>>>>>>>>>>>>>>>>>>>>> blink
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/>
>>>>>>>>>>>>>>>>>>>>>>> /renderer
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/>
>>>>>>>>>>>>>>>>>>>>>>> /platform
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/>
>>>>>>>>>>>>>>>>>>>>>>> /wtf
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/>
>>>>>>>>>>>>>>>>>>>>>>> /
>>>>>>>>>>>>>>>>>>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>

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

Reply via email to