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 <litokis.ta...@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 <litokis.ta...@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/> >>>>>>>>>> /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 < >>>>>>>>>> gra...@grahamreeves.com> 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 <litoki...@gmail.com> >>>>>>>>>>>> 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>:: >>>>>>>>>>>>> >>>>>>>>>>>>> <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> >>>>>>>>>>>>> >>>>>>>>>>>>> -- -- 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.