On Mon, Sep 10, 2018 at 12:22 PM dan Med <[email protected]> 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 < > [email protected]> ha scritto: > >> On Sun, Sep 9, 2018 at 8:54 AM dan Med <[email protected]> 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 <[email protected]> >>> 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/> >>>> /typed_arrays >>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/> >>>> /array_buffer_builder.cc >>>> <https://cs.chromium.org/chromium/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 >>>> <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; 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 < >>>> [email protected]> ha scritto: >>>> >>>>> > is std::numeric_limits >>>>> <https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/trunk/include/limits?l=442&ct=xref_jump_to_def&gsn=numeric_limits> >>>>> <unsigned>::max >>>>> <https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/trunk/include/limits?l=450&ct=xref_jump_to_def&gsn=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 <[email protected]> ha >>>>>> scritto: >>>>>> >>>>>>> array_buffer_builder.cc 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/> >>>>>>> /typed_arrays >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/> >>>>>>> /array_buffer_builder.cc >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc> >>>>>>> >>>>>>> the 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> >>>>>>> ::Append >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=74&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.cc%2523NFGzJegTouRzc7WYe5NO52sD3rtLZRfs3mHeMLIQn8I%25253D&gsn=Append&ct=xref_usages> >>>>>>> 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 >>>>>>> <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> >>>>>>> ::Append >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=74&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.cc%2523NFGzJegTouRzc7WYe5NO52sD3rtLZRfs3mHeMLIQn8I%25253D&gsn=Append&ct=xref_usages> >>>>>>> and then inside it's code it will execute 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> >>>>>>> ::ExpandCapacity >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=45&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.cc%2523Fu6GnwJLuMqh5Thz%25252BDq0LStBEA8HzkICqnAPtIOPIhY%25253D&gsn=ExpandCapacity&ct=xref_usages> >>>>>>> if >>>>>>> it needs to reallocate the array ? >>>>>>> >>>>>>> if so inside the expandCapacity definition 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_> >>>>>>> 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 >>>>>>> <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_> >>>>>>> when >>>>>>> retrieved will be set to 3 bytes ?? >>>>>>> >>>>>>> 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>::ArrayBufferBuilder >>>>>>> >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=40&gs=kythe%253A%252F%252Fchromium%253Flang%253Dc%25252B%25252B%253Fpath%253Dsrc%252Fthird_party%252Fblink%252Frenderer%252Fplatform%252Fwtf%252Ftyped_arrays%252Farray_buffer_builder.cc%2523lcp23D0sHKN2WnDoJe7UbBQtgQbZY3lJ%25252Bn9qnDlawck%25253D&gsn=ArrayBufferBuilder&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>(kDefaultBufferCapacity >>>>>>> >>>>>>> <https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_builder.cc?l=38&ct=xref_jump_to_def&gsn=kDefaultBufferCapacity>, >>>>>>> 1);} >>>>>>> here buffer_ will be equal to an arraybuffer of 32768 bytes in length ? >>>>>>> since the KdefaultBuffer... is set to that value. >>>>>>> is std::numeric_limits >>>>>>> <https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/trunk/include/limits?l=442&ct=xref_jump_to_def&gsn=numeric_limits><unsigned>::max >>>>>>> >>>>>>> <https://cs.chromium.org/chromium/src/buildtools/third_party/libc%2B%2B/trunk/include/limits?l=450&ct=xref_jump_to_def&gsn=max>(); >>>>>>> referring to the max unsigned int value ? cause the source code won't >>>>>>> find it >>>>>>> >>>>>>> -- >>>>>>> -- >>>>>>> v8-users mailing list >>>>>>> [email protected] >>>>>>> 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 [email protected]. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> -- >>>>> -- >>>>> v8-users mailing list >>>>> [email protected] >>>>> 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 [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>> -- >>> v8-users mailing list >>> [email protected] >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> -- >> v8-users mailing list >> [email protected] >> 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 [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > -- > -- > v8-users mailing list > [email protected] > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
