Re: [v8-users] Each bytecode is an object?

2018-11-15 Thread Jakob Kummerow
Everything on the heap is a heap object ;-)

I guess the term "bytecode" is slightly overloaded. If you mean "the
bytecode of a function", i.e. the entire bytecode representation of that
function, then yes, that is indeed stored as an object on the heap
(where/how else would it be stored?); and "Bytecode" is the C++ class that
describes the layout of that object.

If you mean "each bytecode" in the sense of "each bytecode instruction,
e.g. LdaSmi", then no: they are not individual objects. They are raw
numbers encoding the respective bytecode instruction.

In short: 1 function -> 1 AST (with many AST nodes in it) -> 1 bytecode
object (with many bytecode instructions in it).

Note that heap objects are not objects of the respective class in the usual
C++ sense -- again this is the same for Bytecode and all other heap objects.


On Thu, Nov 15, 2018 at 11:27 AM TLim  wrote:

> I'm trying to get the idea of how ignition generates the bytecode from the
> AST and handles it straight.
>
> My understanding is that when the Ignition walks through the AST from the
> parser, it generates bytecodes.
> Then, how it generates is that each bytecode is actually an object of
> bytecode class.
>
> Probably how it gets generated and handled is way more complicated, but I
> simply want to get the idea straight first that the bytecode is actually a
> class object.
>
> Thank you!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Building v8 with Makefile

2018-11-13 Thread Jakob Kummerow
You can put:

is_clang = false
use_sysroot = false

into args.gn to make the V8 build use your system toolchain and libraries
instead of the bundled ones.

On Mon, Nov 12, 2018 at 9:18 PM madana gopal 
wrote:

> Hi,
>
> Also, v8 is using its own toolchain for arm,mips  etc, and we have
> toolchain already present as part of our yocto build system.So, do we have
> any way to make v8 build to point to our own toolchain?. please clarify.
>
> Thanks.
>
> Regards,
> Madan
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Building v8 with Makefile

2018-11-12 Thread Jakob Kummerow
Ninja is the only officially supported build system for V8.

I don't know the requirements of the yocto build system. If all you need is
a wrapper, it should be very straightforward to create a two-liner Makefile
that invokes the GN/ninja based build.

If you need to replace GN/ninja entirely, you'll have to create a complete
Makefile yourself. I'm not aware of any existing tool to do this directly;
however the Node.js project maintains GYP files for V8, and one can
generate Makefiles from those, so that path might be worth looking into.
It's also certainly possible to create a tool yourself that generates
Makefiles from GN files, but that's probably quite a bit of work.


On Sun, Nov 11, 2018 at 6:30 PM madana gopal 
wrote:

> Hi Team,
>
> I am trying to prepare a build for v8 in yocto build system. I saw v8 is
> using ninja. Can we generate Makefile for v8 instead of ninja file?.
>
> If so, please share the steps.
>
> Thanks.
>
> Regards,
> Madan
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Check failed: Handle not reset in first callback. How to Reset my Persistent

2018-10-09 Thread Jakob Kummerow
On Tue, Oct 9, 2018 at 11:45 AM Mike Moening  wrote:

> With recent versions of v8 the SetWeak method has changed and the
> Persistent* parameter has been dropped from the destructor callback.
> The destructor callback function is **supposed** to Reset() the persistent
> or its a leak.
> If you don't V8 crashes and tells you this:
>
> Check failed: Handle not reset in first callback. See comments on
> |v8::WeakCallbackInfo
>
> Old signature:
> void MyClass::DestructorCallback(Isolate* pIsolate, Persistent*
> value, MyClass* pObj)
>
> New signature
> void MyClass::DestructorCallback(const WeakCallbackInfo& oValue)
>
> If I call it like this:
> Persistent obj(isolate, objLocal);
> obj.SetWeak(pMyObject, MyClass::DestructorCallback,
> WeakCallbackType::kParameter);
>
> How can I pass the Persistent into my DestructorCallback function so I can
> Reset it??
> Persistent cannot be copied.
> So how can I Reset() it in the callback?
> Any help would be great.
>

See this example:
https://cs.chromium.org/chromium/src/v8/src/d8.cc?l=2312=SetWeak
You can often find such hints in the V8 API Changes doc

(just
ask your favorite search engine for "V8 API Changes" to find it).


> Also the WeakCallbackType::kParameter  vs WeakCallbackType::kFinalizer
> thing has me confuzeled too.
> Which is the right type to use?
>

See the documentation:

// kParameter will pass a void* parameter back to the callback,
> kInternalFields
> // will pass the first two internal fields back to the callback, kFinalizer
> // will pass a void* parameter back, but is invoked before the object is
> // actually collected, so it can be resurrected. In the last case, it is
> not
> // possible to request a second pass callback.
> enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer };


Does that help?


>
> Thanks!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: v8 static library on windows gives linker errors

2018-10-08 Thread Jakob Kummerow
>
> The v8_monolith.lib is unbelievably huge (nearly a gig)
>

That's probably mostly debug info. Try Release mode ("is_debug = false").

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: v8 static library on windows gives linker errors

2018-10-08 Thread Jakob Kummerow
The set of required libraries should be:

v8_base
v8_snapshot
v8_libbase
v8_libplatform
v8_libsampler

Does that work?

As a simpler alternative, the instructions

recommend
to use the "v8_monolith" target, which should include everything you need
in one convenient bundle.


On Sun, Oct 7, 2018 at 3:50 PM Mike Moening  wrote:

> Here's the build command i'm using:
>
> ninja -C out.gn/x64.debug
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: What is the purpose of isolated source group

2018-10-03 Thread Jakob Kummerow
The purpose of d8's --isolate flag is to make it possible to test that
scripts in different isolates can indeed run without interference from each
other. Such scripts cannot communicate with each other (as the name
"isolate" implies).

On Wed, Oct 3, 2018 at 6:44 PM Mingwei Zhang  wrote:

> I realize that I made a mistake. So d8 API does provide support for Worker
> and I suspect developers could use postMessage to talk with each other?
>
> But still, I think my question remains. For a command like:
>
> ./d8 a.js --isolate b.js
>
>
> How does a.js talk with b.js. In Worker example, a.js could to b.js
> because a.js launches b.js, but in this case, a.js does not even know b.js
> exists.
>
>
> Thanks.
>
> On Wednesday, October 3, 2018 at 11:45:30 AM UTC-7, Mingwei Zhang wrote:
>>
>> Hi,
>>
>> I am wondering what is the purpose of the options "--isolate" for the
>> stand-alone binary d8. It is pretty interesting that the option '--isolate'
>> could be used to launch multiple JavaScripts and runtime them truly in
>> parallel. However, since JavaScript is single-threaded by design. This
>> puzzles to me that one JavaScript file may not talk to the other one.
>>
>> So my purpose is to run two JS files, say a.js and b.js. Now I use this
>> command:
>>
>> ./d8 a.js --isolate b.js
>>
>>
>> Now, my question is could I make a.js be able to talk to b.js in some way?
>>
>> Thanks.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] BigInt from String?

2018-09-15 Thread Jakob Kummerow
To create arbitrary BigInts via the C++ API, use BigInt::NewFromWords.

An alternative, as you suggest, is to parse the string as source, because
"BigInt strings with 'n' suffixes" are BigInt literals. Instead of "eval",
the API functions to do that are Script::Compile and Script::Run. Look at
samples/shell.cc or test/cctest/* for examples.

Another alternative, depending on your requirements, might be to create
this custom "parser" (more of a wrapper, really) in JavaScript:

function MyBigInt(str) {
  console.assert(str.endsWith("n"));
  return BigInt(str.substring(0, str.length - 1));
}


On Sat, Sep 15, 2018 at 8:44 PM J Decker  wrote:

>
>
> On Sat, Sep 15, 2018 at 8:41 PM J Decker  wrote:
>
>> I was implementing a parser that includes BigInt strings with 'n'
>> suffixes...
>> I tried to create a BigInt::New( isolate, ...  and then found the only
>> constructor takes an int64; which isn't a very big int.
>>
>> howto bigint from string?
>>
>
> maybe someone could share a snippet to call eval()?  Also Date::New()
> doesn't take a string :(
>
>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Arraybuffer

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

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

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

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

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

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

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

On Wed, 12 Sep 2018 at 00:12, Peter Schow  wrote:
>>
>>> On Tue, Sep 11, 2018 at 2:09 PM dan Med  wrote:
>>> >
>>> > Would you suggest to build v8 such that I can debug it as I want ?
>>>
>>> It's difficult to go wrong with this approach if you want to better
>>> understand V8 or any large, complex system.
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Arraybuffer

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

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

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

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

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

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


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

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


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


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

Re: [v8-users] Arraybuffer

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

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

src/interpreter/


> and the JIT compilers,
>

src/compiler/


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

What's a JIT page?


> or which memory allocator does v8 use
>

It uses several allocation techniques for different purposes.


> and it's garbage collector
>

src/heap/


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

 Can someone help me out?

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

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

Re: [v8-users] Built

2018-08-13 Thread 'Jakob Kummerow' via v8-users
Yes.

On Mon, Aug 13, 2018 at 11:15 AM dan Med  wrote:

> Yes, with v8 i want to be able to launch at it a .js file and debug v8
> By bulding the v8 source code i will have all the compilers inside right ?
> like turbofan...
>
> 2018-08-13 11:13 GMT+02:00 'Jakob Kummerow' via v8-users <
> v8-users@googlegroups.com>:
>
>> You don't need to build Chromium, or anything else for that matter. Just
>> install regular Google Chrome, it contains DevTools.
>>
>> What does "invoking the JIT compilers" have to do with debugging?
>>
>> On Mon, Aug 13, 2018 at 11:08 AM dan Med  wrote:
>>
>>> I really think that i don't need to build the entire chromim right now i
>>> need v8 only
>>>
>>>
>>> 2018-08-13 11:08 GMT+02:00 dan Med :
>>>
>>>> I will follow your link mentioned above the only thing i'm looking
>>>> at is will i be able to invoke the JIT compilers...
>>>>
>>>> 2018-08-13 10:27 GMT+02:00 dan Med :
>>>>
>>>>> Like launch v8 under a debugger and pass as an argument a page that
>>>>> contains javascript
>>>>>
>>>>>
>>>>> 2018-08-13 10:25 GMT+02:00 dan Med :
>>>>>
>>>>>> something like lldb or  gdb to see the memory...
>>>>>>
>>>>>> 2018-08-13 10:19 GMT+02:00 'Jakob Kummerow' via v8-users <
>>>>>> v8-users@googlegroups.com>:
>>>>>>
>>>>>>> For debugging JavaScript, I would recommend Chrome DevTools. Not
>>>>>>> sure why you think a self-compiled V8 would help with that.
>>>>>>>
>>>>>>> On Mon, Aug 13, 2018 at 12:13 AM dan Med 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Yes but by compiling v8 I should be able to debug javascript pages
>>>>>>>>
>>>>>>>> On Sun, 12 Aug 2018 at 23:53, 'Jakob Kummerow' via v8-users <
>>>>>>>> v8-users@googlegroups.com> wrote:
>>>>>>>>
>>>>>>>>> The official build instructions are at
>>>>>>>>> https://github.com/v8/v8/wiki/Building-with-GN. They work.
>>>>>>>>>
>>>>>>>>> That said, V8 implements ECMAScript, and as such has no idea about
>>>>>>>>> HTML or the DOM-related parts of JavaScript.
>>>>>>>>>
>>>>>>>>> On Sun, Aug 12, 2018 at 7:10 AM  wrote:
>>>>>>>>>
>>>>>>>>>> Hi i've been trying to build the javascript v8 engine for as long
>>>>>>>>>> as 3 weeks now,. i've followed many guides all of them miss some
>>>>>>>>>> information
>>>>>>>>>> I'm looking for a guide that helps to build the engine it self
>>>>>>>>>> along all of its compiler and stuff such that i could be able to 
>>>>>>>>>> throw at
>>>>>>>>>> it a /HTML/JS page.
>>>>>>>>>> Thank you
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> --
>>>>>>>>>> v8-users mailing list
>>>>>>>>>> v8-users@googlegroups.com
>>>>>>>>>> http://groups.google.com/group/v8-users
>>>>>>>>>> ---
>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>> Google Groups "v8-users" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> --
>>>>>>>>> v8-users mailing list
>>>>>>>>> v8-users@googlegroups.com
>>>>>>>>> http://groups.google.com/group/v8-users
>>>>>>>>> ---
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "v8-users" group.
>>>>>>>>> To unsubscribe from this group and stop receiving 

Re: [v8-users] Built

2018-08-13 Thread 'Jakob Kummerow' via v8-users
You don't need to build Chromium, or anything else for that matter. Just
install regular Google Chrome, it contains DevTools.

What does "invoking the JIT compilers" have to do with debugging?

On Mon, Aug 13, 2018 at 11:08 AM dan Med  wrote:

> I really think that i don't need to build the entire chromim right now i
> need v8 only
>
>
> 2018-08-13 11:08 GMT+02:00 dan Med :
>
>> I will follow your link mentioned above the only thing i'm looking at
>> is will i be able to invoke the JIT compilers...
>>
>> 2018-08-13 10:27 GMT+02:00 dan Med :
>>
>>> Like launch v8 under a debugger and pass as an argument a page that
>>> contains javascript
>>>
>>>
>>> 2018-08-13 10:25 GMT+02:00 dan Med :
>>>
>>>> something like lldb or  gdb to see the memory...
>>>>
>>>> 2018-08-13 10:19 GMT+02:00 'Jakob Kummerow' via v8-users <
>>>> v8-users@googlegroups.com>:
>>>>
>>>>> For debugging JavaScript, I would recommend Chrome DevTools. Not sure
>>>>> why you think a self-compiled V8 would help with that.
>>>>>
>>>>> On Mon, Aug 13, 2018 at 12:13 AM dan Med 
>>>>> wrote:
>>>>>
>>>>>> Yes but by compiling v8 I should be able to debug javascript pages
>>>>>>
>>>>>> On Sun, 12 Aug 2018 at 23:53, 'Jakob Kummerow' via v8-users <
>>>>>> v8-users@googlegroups.com> wrote:
>>>>>>
>>>>>>> The official build instructions are at
>>>>>>> https://github.com/v8/v8/wiki/Building-with-GN. They work.
>>>>>>>
>>>>>>> That said, V8 implements ECMAScript, and as such has no idea about
>>>>>>> HTML or the DOM-related parts of JavaScript.
>>>>>>>
>>>>>>> On Sun, Aug 12, 2018 at 7:10 AM  wrote:
>>>>>>>
>>>>>>>> Hi i've been trying to build the javascript v8 engine for as long
>>>>>>>> as 3 weeks now,. i've followed many guides all of them miss some
>>>>>>>> information
>>>>>>>> I'm looking for a guide that helps to build the engine it self
>>>>>>>> along all of its compiler and stuff such that i could be able to throw 
>>>>>>>> at
>>>>>>>> it a /HTML/JS page.
>>>>>>>> Thank you
>>>>>>>>
>>>>>>>> --
>>>>>>>> --
>>>>>>>> v8-users mailing list
>>>>>>>> v8-users@googlegroups.com
>>>>>>>> http://groups.google.com/group/v8-users
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "v8-users" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>> --
>>>>>>> --
>>>>>>> v8-users mailing list
>>>>>>> v8-users@googlegroups.com
>>>>>>> http://groups.google.com/group/v8-users
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "v8-users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>> --
>>>>>> --
>>>>>> v8-users mailing list
>>>>>> v8-users@googlegroups.com
>>>>>> http://groups.google.com/group/v8-users
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "v8-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> --
>>>>> v8-users mailing list
>>>>> v8-users@googlegroups.com
>>>>> http://groups.google.com/group/v8-users
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "v8-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Built

2018-08-13 Thread 'Jakob Kummerow' via v8-users
Firstly, as I said before, V8 does not know how to handle "a page that
contains JavaScript". It only understands pure ECMAScript. (I.e. only *.js
files, but no "window", no "document", no "..." etc.)

Secondly, running V8 in a debugger is not going to be helpful for debugging
JavaScript (only for debugging V8 itself). Give Chrome DevTools a try, they
are built for this purpose!

On Mon, Aug 13, 2018 at 10:27 AM dan Med  wrote:

> Like launch v8 under a debugger and pass as an argument a page that
> contains javascript
>
>
> 2018-08-13 10:25 GMT+02:00 dan Med :
>
>> something like lldb or  gdb to see the memory...
>>
>> 2018-08-13 10:19 GMT+02:00 'Jakob Kummerow' via v8-users <
>> v8-users@googlegroups.com>:
>>
>>> For debugging JavaScript, I would recommend Chrome DevTools. Not sure
>>> why you think a self-compiled V8 would help with that.
>>>
>>> On Mon, Aug 13, 2018 at 12:13 AM dan Med 
>>> wrote:
>>>
>>>> Yes but by compiling v8 I should be able to debug javascript pages
>>>>
>>>> On Sun, 12 Aug 2018 at 23:53, 'Jakob Kummerow' via v8-users <
>>>> v8-users@googlegroups.com> wrote:
>>>>
>>>>> The official build instructions are at
>>>>> https://github.com/v8/v8/wiki/Building-with-GN. They work.
>>>>>
>>>>> That said, V8 implements ECMAScript, and as such has no idea about
>>>>> HTML or the DOM-related parts of JavaScript.
>>>>>
>>>>> On Sun, Aug 12, 2018 at 7:10 AM  wrote:
>>>>>
>>>>>> Hi i've been trying to build the javascript v8 engine for as long as
>>>>>> 3 weeks now,. i've followed many guides all of them miss some
>>>>>> information
>>>>>> I'm looking for a guide that helps to build the engine it self along
>>>>>> all of its compiler and stuff such that i could be able to throw at it a
>>>>>> /HTML/JS page.
>>>>>> Thank you
>>>>>>
>>>>>> --
>>>>>> --
>>>>>> v8-users mailing list
>>>>>> v8-users@googlegroups.com
>>>>>> http://groups.google.com/group/v8-users
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "v8-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> --
>>>>> v8-users mailing list
>>>>> v8-users@googlegroups.com
>>>>> http://groups.google.com/group/v8-users
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "v8-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> --
>>>> v8-users mailing list
>>>> v8-users@googlegroups.com
>>>> http://groups.google.com/group/v8-users
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "v8-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Built

2018-08-13 Thread 'Jakob Kummerow' via v8-users
For debugging JavaScript, I would recommend Chrome DevTools. Not sure why
you think a self-compiled V8 would help with that.

On Mon, Aug 13, 2018 at 12:13 AM dan Med  wrote:

> Yes but by compiling v8 I should be able to debug javascript pages
>
> On Sun, 12 Aug 2018 at 23:53, 'Jakob Kummerow' via v8-users <
> v8-users@googlegroups.com> wrote:
>
>> The official build instructions are at
>> https://github.com/v8/v8/wiki/Building-with-GN. They work.
>>
>> That said, V8 implements ECMAScript, and as such has no idea about HTML
>> or the DOM-related parts of JavaScript.
>>
>> On Sun, Aug 12, 2018 at 7:10 AM  wrote:
>>
>>> Hi i've been trying to build the javascript v8 engine for as long as 3
>>> weeks now,. i've followed many guides all of them miss some information
>>> I'm looking for a guide that helps to build the engine it self along all
>>> of its compiler and stuff such that i could be able to throw at it a
>>> /HTML/JS page.
>>> Thank you
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Built

2018-08-12 Thread 'Jakob Kummerow' via v8-users
The official build instructions are at
https://github.com/v8/v8/wiki/Building-with-GN. They work.

That said, V8 implements ECMAScript, and as such has no idea about HTML or
the DOM-related parts of JavaScript.

On Sun, Aug 12, 2018 at 7:10 AM  wrote:

> Hi i've been trying to build the javascript v8 engine for as long as 3
> weeks now,. i've followed many guides all of them miss some information
> I'm looking for a guide that helps to build the engine it self along all
> of its compiler and stuff such that i could be able to throw at it a
> /HTML/JS page.
> Thank you
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is it possible to get the memory for one of v8::Object ?

2018-07-20 Thread Jakob Kummerow
I don't think there is a direct way to do this.

There is v8::internal::HeapObject::Size(), but it only gives you a form of
"shallow" size. Under the hood, most (JavaScript-level) objects are
composed of several (heap) objects; e.g. for an Array, all the elements are
stored in a separate backing store, which would not be included in the
result of a ->Size() call on the array itself.

You could try to implement a crawl of the object graph that sums up all the
nested objects, but it's not obvious how you'd deal with shared objects
(canonical example: typically, many objects share the same hidden class.
How do you count the bytes of the hidden class metadata?). DevTools gives
one answer via the "retained size" of each object in a heap snapshot. Does
that serve your needs?

Another way to approximate it is to wrap your function in a pair of gc()
calls, run with --expose-gc --trace-gc, and compare the tracing output
before/after. The limitation is that you only get 0.1 MB resolution; you
can amplify the signal with a loop. Example:

7 ms: Mark-sweep 0.6 (3.7) -> 0.5 (4.7) MB, 1.1 / 0.0 ms
9 ms: Mark-sweep 1.3 (4.7) -> 0.5 (4.7) MB, 1.1 / 0.0 ms

1.3 - 0.5 = 0.8 MB consumed, in this case for 1,000 invocations of function
my_function() { new Array(100); }. The expected value (from knowing what
such an array looks like in memory) is 0.816 MB, so the approximated result
is reasonably accurate.

On Thu, Jul 19, 2018 at 11:43 PM czczcheng  wrote:

> Is it possible to get the memory for one of v8::Object ?
> I want to count how much memory was used  during a single call of a
> function.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] where is the implementation of ObjectTemplate constructor?

2018-07-20 Thread Jakob Kummerow
ObjectTemplate has no constructor (because it lives on the managed heap,
where C++ constructors don't make sense). Declaring a private constructor
(without defining it anywhere) prevents the C++ compiler from automatically
creating a default constructor. The only way to create an ObjectTemplate is
with its New(...) method.

On Fri, Jul 20, 2018 at 2:49 AM  wrote:

> Hi,
> ObjectTemplate is declared in v8.h, and it's constructor was declared as
> private. But where is the implementation of it's constructor? I can't find
> it's source code.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Build d8 with simulator running on host arch?

2018-07-02 Thread Jakob Kummerow
Sure. If you build with tools/dev/gm.py arm.release on an x86 host, you'll
get a simulator d8 binary. More generally, this is what having distinct
target_arch and v8_target_arch parameters in args.gn is good for: the
former controls what platform the binaries will run on, the latter controls
what architecture V8's compilers will target. If there is a difference, the
simulator will be used.

On Mon, Jul 2, 2018 at 7:48 PM Thomson Tan  wrote:

> Mksnapshot builds v8 to target arch but it could run with simulator on
> host arch when cross compiling. Is there a similar way to build d8 to
> target arch but actually running on host arch with simulator? I'd like to
> utilize the simulator to debug some codegen issue which might be hard to
> debug on target.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

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

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

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

> Hi v8 users,
>
> I would like to call a function from javascript which when processed by v8
> engine, calls my own library function.
> For example,
>
>
> *In javascript (main.js):*
> var start = Date.now();
> myFunctionInV8();
> // js code...
> // js code...
> // js code...
> var end = Date.now();
>
>
>
>
>
> *In v8:// may be in v8platform*void myFunctionInV8(){
>// calling my external library functions...
> }
>
>
> What is the best way to achieve this? I want this function call eventually
> in v8 engine only.
>
> Regards,
> K Abhishek
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

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

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

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

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

> And actually is the consoleDelegate exposed in the .h files in the include
> directory? I saw it is defined in interface-types.h but if I were to
> include that, it will lead to a chain of includes from /src..
> Am I misunderstanding something?
>
> Thanks!
>
> On Wednesday, June 27, 2018 at 11:03:35 AM UTC-7, zcw wrote:
>>
>> Hello Jakob,
>>
>> May I get some more directions for using the consoleDelegate?
>> From d8 files. I saw that we could make a console class and use set
>> consoleDelegate to set console functions.
>> But in our old way, we create a global template for "console" and using
>> setAccessor to append functions to it.
>> Since I don't want to introduce too much code change. Is there a way to
>> keep the old usage (create as global template)? or is using consoleDelegate
>> the only way to specify console functions?
>>
>> Again thank you so much!
>>
>>
>>
>> On Monday, June 25, 2018 at 10:27:58 PM UTC-7, Jakob Kummerow wrote:
>>>
>>> On Mon, Jun 25, 2018 at 8:30 PM zcw  wrote:
>>>
>>>> Thank you so much!
>>>> I wanted to save the log to a specific file. I tried using the provided
>>>> console but couldn't find where it stored the log message.
>>>>
>>>
>>> On a closer look at the code, it seems that you *have to* provide a
>>> ConsoleDelegate if you want console.log to do anything.
>>>
>>>
>>>> And could the ConsoleDelegate work for the release build?
>>>>
>>>
>>> Yes, of course.
>>>
>>>
>>>> On Monday, June 25, 2018 at 6:14:42 PM UTC-7, Jakob Kummerow wrote:
>>>>
>>>>> V8 now provides its own "console" object, with the usual methods
>>>>> installed on it. Does it not serve your needs?
>>>>>
>>>>> You can override it by providing a ConsoleDelegate via the debug
>>>>> interface. The d8 shell (src/d8.cc) provides an example.
>>>>>
>>>>> On Mon, Jun 25, 2018 at 5:52 PM zwc  wrote:
>>>>>
>>>>>> Hello,
>>>>>> we are working on upgrading v8 from 5.3 to 6.7-lkgr.
>>>>>> But I recently found a strange behavior for one global object with
>>>>>> name "console".
>>>>>> In the old version, we have a global object "console" for logging
>>>>>> info.
>>>>>> But when upgraded to 6.7, the "console"'s callbacks functions won't
>>>>>> get called. I tested if I change the name from "console" to something 
>>>>>> else,
>>>>>> it will work as usual.
>>>>>> I am feeling like that "console"seems to become a reserved word for
>>>>>> the newer version?
>>>>>> May I know if this is expected? And if true, is there any workaround
>>>>>> to overwrite this behavior? we would want to keep our old "console" name.
>>>>>>
>>>>>> Thank you so much!
>>>>>>
>>>>>> --
>>>>>> --
>>>>>> v8-users mailing list
>>>>>> v8-u...@googlegroups.com
>>>>>> http://groups.google.com/group/v8-users
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "v8-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to v8-users+u...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>> --
>>>> v8-users mailing list
>>>> v8-u...@googlegroups.com
>>>> http://groups.google.com/group/v8-users
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "v8-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to v8-users+u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-06-25 Thread Jakob Kummerow
On Mon, Jun 25, 2018 at 8:30 PM zcw  wrote:

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

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


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

Yes, of course.


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

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Where are let / const objects stored?

2018-06-21 Thread Jakob Kummerow
Variable allocation is complicated. In short, Function-local variables are
allocated on the stack. When nested closures refer to them, they get
allocated in a Context object.


On Thu, Jun 21, 2018 at 12:15 AM Zac Hansen  wrote:

> I don't know the answer, but they are accessible via the debugging
> interface, so that may be a place to look.
>
> On Wednesday, June 20, 2018 at 11:01:23 PM UTC-7, Gonzalo Diethelm wrote:
>>
>> I run the following JS code in the Chrome console:
>>
>> // Version 67.0.3396.87 (Official Build) (64-bit)
>>
>> var p = 11
>> p // returns 11
>>
>> let q = 12
>> q // returns 12
>>
>> const r = 13
>> r // returns 13
>>
>> Now, from C++ code, I can look up p in the global context, and it is
>> found; its value is, unsurprisingly, 11.
>>
>> On the other hand, q and r are not found in the global context.  This is
>> fine, I guess, since let / const have lexical scoping.
>>
>> My question is: how does Chrome / V8 find q and r?  Where is it looking
>> for them?
>>
>> Thanks!
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Finding cycles in an object

2018-06-21 Thread Jakob Kummerow
The Local class defines an operator == that should do exactly what you need.

On Thu, Jun 21, 2018 at 5:43 AM Gonzalo Diethelm 
wrote:

> Sure, slot does have a value, I just didn't include it in the code.
> Something like:
>
> Local slot = String::NewFromUtf8(isolate, "MyBeautifulSlot",
> NewStringType::kNormal).ToLocalChecked();
>
> Cheers!
>
> On Thursday, June 21, 2018 at 2:27:00 PM UTC+2, Zac Hansen wrote:
>>
>> You're dereferencing a "super pointer" to get to a "pointer", hence * not
>> &.   You can't "go back" because the local/global represents an
>> "reference count" to the object which must be known to the JS runtime.
>>
>> As for p0 and p1, have you tried setting slot to a fixed string value
>> before using it as a key for storing/lookup?   I don't know what the
>> expected behavior of using an empty value as a key into an object is.
>>
>> These are all just guesses - if someone else answers differently, I'm
>> probably wrong.
>>
>>
>> On Thursday, June 21, 2018 at 5:07:50 AM UTC-7, Gonzalo Diethelm wrote:
>>>
>>> Note to self: this might be related to Local vs Global
>>> (or Persistent? so many names...)
>>>
>>> Need to look into that.
>>>
>>> On Thursday, June 21, 2018 at 7:58:37 AM UTC+2, Gonzalo Diethelm wrote:

 I run the following JS code in the Chrome console:

 // Version 67.0.3396.87 (Official Build) (64-bit)

 var x = [1, 2, {"foo": 11}];
 x[2].bar = x;

 Now from C++ code, I get ahold of x as a Local, and wish to
 traverse the whole structure; for the sake of the example, let's say I am
 converting it into serialized data (I know I can use JSON.stringify() to do
 this, serializing is just an example to clarify ideas).  My question is,
 how can I keep track of the nodes in the structure  that I have already
 seen, and their associated serialized value, so that I can avoid an
 infinite traversal?

 It seems to me doing this would require a way to get a unique identity
 for each node, so that the C++ code can do something similar to this:

 typedef map NodeMap;
 NodeMap seen;
 ...
 Local node = current.GetNextChild();
 NodeId id = node.GetUniqueId();
 NodeMap::iterator k = seen.find(id);
 NodeData data;
 if (k != seen.end()) {
 // node already seen, reuse its serialization
 data = k->first;
 } else {
 // first time we see node, serialize and remember
 data = node.Serialize(); // recurses
 seen[id] = data;
 }

 The specific question is: what type could be NodeId, and how do I get
 the equivalent of GetUniqueId()?

 I am very tempted to ask for a way to get a raw void* to each node, but
 I guess any way of doing this is fine, as long as I can get a unique id
 that is stable while I'm traversing the data.  For these reasons,
 GetIdentityHash() does not seem to fit the bill: "*The return value
 will never be 0. Also, it is not guaranteed to be unique.*"

 Incidentally, If I try to use JSON.stringify for my data, I get this:

 JSON.stringify(x)
 VM170:1 Uncaught TypeError: Converting circular structure to JSON
 at JSON.stringify ()
 at :1:6

 This is taken care of here in the V8 code:

 JsonStringifier::Result JsonStringifier::StackPush(Handle
 object) {
 ...
 // member stack_ is: Handle stack_;
 int length = Smi::ToInt(stack_->length());
 FixedArray* elements = FixedArray::cast(stack_->elements());
 for (int i = 0; i < length; i++) {
 FixedArray* elements = FixedArray::cast(stack_->elements());
 if (elements->get(i) == *object) {
 // boom
 }
 }
 }

 So, operator*() in a Handle gives me a unique id? Which is the
 type for this? Can I store that in a C++ map? Is it stable (enough)?

 Thanks!

>>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How Date.now() function value is returned (Is it from kernel of v8 engine has its own implementation)

2018-06-21 Thread Jakob Kummerow
gin provides its own v8::Platform implementation, overriding the default
platform.

On Thu, Jun 21, 2018 at 9:55 AM Abhishek Kanike 
wrote:

> Hi Jakob and v8-users,​​
> I have following observations on printing logs in v8 and date.now call
> trace.
>
>1. *Logs in v8:*
>
>*printf* and *std::cout* were not outputting any logs in adb logcat. I
>​tried redirecting stdio logs to logcat by following commands -
>
>$ adb shell stop$ adb shell setprop log.redirect-stdio true$ adb shell 
> start
>
>But still logs were not getting displayed in adb logcat. So I used
>android log library. Following is the procedure
>
>- Import header file:
>
>   #if defined(V8_OS_ANDROID)
> #include 
>   #endif
>
>   - Print log:
>
>   #if defined(V8_OS_ANDROID)
> __android_log_print(ANDROID_LOG_INFO, "", "");
>   #endif
>
>
>2. Date.now() final system call:
>Date.now() calls *V8Platform::CurrentClockTimeMillis()* from*
>src/gin/v8_platform.cc *---> *Time::Now() *from *src/base/time/time.cc*
>---> *getTimeofDay() *rather than *base::OS::TimeCurrentMillis. *Can
>anyone explain this behaviour?
>
> Regards,
> K Abhishek
>
>
>
> On Mon, Jun 18, 2018 at 7:07 PM Jakob Kummerow 
> wrote:
>
>> Sure, just use printf or std::cout << "print\n". I don't know whether
>> adb logcat has any special requirements.
>>
>> On Mon, Jun 18, 2018 at 3:48 PM Abhishek Kanike <
>> kai.dranzer32...@gmail.com> wrote:
>>
>>> Jakob,
>>> Thanks for quick reply.
>>> That's a good point, should have tried with gdb. Will check with that.
>>> Is there a way to add logs in v8 source code, it will be lot faster to
>>> debug.
>>> In cc (compositor), i used *LOG(INFO)<<"print";* from *base/logging.h *(of
>>> main chromium *src*)
>>>
>>> On Mon, Jun 18, 2018 at 5:12 PM Jakob Kummerow 
>>> wrote:
>>>
>>>> Yes, it is.
>>>>
>>>> Have you tried using a debugger? You can set a breakpoint in
>>>> the BUILTIN(DateNow) function here:
>>>>
>>>>
>>>> https://cs.chromium.org/chromium/src/v8/src/builtins/builtins-date.cc?q=builtins-date.cc=package:chromium=282
>>>>
>>>> and step through the code from there.
>>>>
>>>> On Mon, Jun 18, 2018 at 2:39 PM Abhishek Kanike <
>>>> kai.dranzer32...@gmail.com> wrote:
>>>>
>>>>> ​Hi,
>>>>> For confirmation i am using a simple Date.now() call on button click
>>>>> [Attached].
>>>>> I have added a print log in Time::NOW() at
>>>>> https://cs.chromium.org/chromium/src/v8/src/base/platform/time.cc?type=cs=package:chromium=0=402
>>>>> as printf("v8:DEBUG::TIME:NOW called").
>>>>> I am not getting this log in adb logcat. So is this the correct place
>>>>> from where Date.now() is getting called?
>>>>>
>>>>> Regards,
>>>>> K Abhishek
>>>>>
>>>>> On Mon, May 21, 2018 at 6:51 PM Abhishek Kanike <
>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>
>>>>>> Sorry JaKob
>>>>>>
>>>>>> On Mon, May 21, 2018, 6:51 PM Abhishek Kanike <
>>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>>
>>>>>>> Cool.. I see it. Thanks a lot Jacob.
>>>>>>>
>>>>>>> On Mon, May 21, 2018, 5:40 PM Jakob Kummerow 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> The time always has to be retrieved from the kernel. V8's
>>>>>>>> implementation is in base::OS::TimeCurrentMillis, implemented in
>>>>>>>> src/base/platform/platform-{win32,posix}.cc.
>>>>>>>>
>>>>>>>> On Mon, May 21, 2018 at 3:22 PM Abhishek Kanike <
>>>>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>> I want to know how the date.now() function is called in javascript
>>>>>>>>> (or how it returns the value). I believe that javascript uses 
>>>>>>>>> date.now() by
>>>>>>>>> system call. I want to in chrome source code how it is being set.
>>>>>>>>> This is useful for one of the performance benchmark t

Re: [v8-users] How Date.now() function value is returned (Is it from kernel of v8 engine has its own implementation)

2018-06-18 Thread Jakob Kummerow
Sure, just use printf or std::cout << "print\n". I don't know whether adb
logcat has any special requirements.

On Mon, Jun 18, 2018 at 3:48 PM Abhishek Kanike 
wrote:

> Jakob,
> Thanks for quick reply.
> That's a good point, should have tried with gdb. Will check with that.
> Is there a way to add logs in v8 source code, it will be lot faster to
> debug.
> In cc (compositor), i used *LOG(INFO)<<"print";* from *base/logging.h *(of
> main chromium *src*)
>
> On Mon, Jun 18, 2018 at 5:12 PM Jakob Kummerow 
> wrote:
>
>> Yes, it is.
>>
>> Have you tried using a debugger? You can set a breakpoint in
>> the BUILTIN(DateNow) function here:
>>
>>
>> https://cs.chromium.org/chromium/src/v8/src/builtins/builtins-date.cc?q=builtins-date.cc=package:chromium=282
>>
>> and step through the code from there.
>>
>> On Mon, Jun 18, 2018 at 2:39 PM Abhishek Kanike <
>> kai.dranzer32...@gmail.com> wrote:
>>
>>> ​Hi,
>>> For confirmation i am using a simple Date.now() call on button click
>>> [Attached].
>>> I have added a print log in Time::NOW() at
>>> https://cs.chromium.org/chromium/src/v8/src/base/platform/time.cc?type=cs=package:chromium=0=402
>>> as printf("v8:DEBUG::TIME:NOW called").
>>> I am not getting this log in adb logcat. So is this the correct place
>>> from where Date.now() is getting called?
>>>
>>> Regards,
>>> K Abhishek
>>>
>>> On Mon, May 21, 2018 at 6:51 PM Abhishek Kanike <
>>> kai.dranzer32...@gmail.com> wrote:
>>>
>>>> Sorry JaKob
>>>>
>>>> On Mon, May 21, 2018, 6:51 PM Abhishek Kanike <
>>>> kai.dranzer32...@gmail.com> wrote:
>>>>
>>>>> Cool.. I see it. Thanks a lot Jacob.
>>>>>
>>>>> On Mon, May 21, 2018, 5:40 PM Jakob Kummerow 
>>>>> wrote:
>>>>>
>>>>>> The time always has to be retrieved from the kernel. V8's
>>>>>> implementation is in base::OS::TimeCurrentMillis, implemented in
>>>>>> src/base/platform/platform-{win32,posix}.cc.
>>>>>>
>>>>>> On Mon, May 21, 2018 at 3:22 PM Abhishek Kanike <
>>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>> I want to know how the date.now() function is called in javascript
>>>>>>> (or how it returns the value). I believe that javascript uses 
>>>>>>> date.now() by
>>>>>>> system call. I want to in chrome source code how it is being set.
>>>>>>> This is useful for one of the performance benchmark that I am
>>>>>>> working on.
>>>>>>> Can someone please guide me to know how this happens in v8 engine.
>>>>>>>
>>>>>>> Thanks in advance.
>>>>>>>
>>>>>>> Regards,
>>>>>>> K Abhishek
>>>>>>>
>>>>>>> --
>>>>>>> --
>>>>>>> v8-users mailing list
>>>>>>> v8-users@googlegroups.com
>>>>>>> http://groups.google.com/group/v8-users
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "v8-users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>> --
>>>>>> --
>>>>>> v8-users mailing list
>>>>>> v8-users@googlegroups.com
>>>>>> http://groups.google.com/group/v8-users
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "v8-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>
>>> --
>>> Cheers,
>>> K Abhishek
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>>

Re: [v8-users] How Date.now() function value is returned (Is it from kernel of v8 engine has its own implementation)

2018-06-18 Thread Jakob Kummerow
Yes, it is.

Have you tried using a debugger? You can set a breakpoint in
the BUILTIN(DateNow) function here:

https://cs.chromium.org/chromium/src/v8/src/builtins/builtins-date.cc?q=builtins-date.cc=package:chromium=282

and step through the code from there.

On Mon, Jun 18, 2018 at 2:39 PM Abhishek Kanike 
wrote:

> ​Hi,
> For confirmation i am using a simple Date.now() call on button click
> [Attached].
> I have added a print log in Time::NOW() at
> https://cs.chromium.org/chromium/src/v8/src/base/platform/time.cc?type=cs=package:chromium=0=402
> as printf("v8:DEBUG::TIME:NOW called").
> I am not getting this log in adb logcat. So is this the correct place from
> where Date.now() is getting called?
>
> Regards,
> K Abhishek
>
> On Mon, May 21, 2018 at 6:51 PM Abhishek Kanike <
> kai.dranzer32...@gmail.com> wrote:
>
>> Sorry JaKob
>>
>> On Mon, May 21, 2018, 6:51 PM Abhishek Kanike 
>> wrote:
>>
>>> Cool.. I see it. Thanks a lot Jacob.
>>>
>>> On Mon, May 21, 2018, 5:40 PM Jakob Kummerow 
>>> wrote:
>>>
>>>> The time always has to be retrieved from the kernel. V8's
>>>> implementation is in base::OS::TimeCurrentMillis, implemented in
>>>> src/base/platform/platform-{win32,posix}.cc.
>>>>
>>>> On Mon, May 21, 2018 at 3:22 PM Abhishek Kanike <
>>>> kai.dranzer32...@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> I want to know how the date.now() function is called in javascript (or
>>>>> how it returns the value). I believe that javascript uses date.now() by
>>>>> system call. I want to in chrome source code how it is being set.
>>>>> This is useful for one of the performance benchmark that I am working
>>>>> on.
>>>>> Can someone please guide me to know how this happens in v8 engine.
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Regards,
>>>>> K Abhishek
>>>>>
>>>>> --
>>>>> --
>>>>> v8-users mailing list
>>>>> v8-users@googlegroups.com
>>>>> http://groups.google.com/group/v8-users
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "v8-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> --
>>>> v8-users mailing list
>>>> v8-users@googlegroups.com
>>>> http://groups.google.com/group/v8-users
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "v8-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>
> --
> Cheers,
> K Abhishek
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How Date.now() function value is returned (Is it from kernel of v8 engine has its own implementation)

2018-05-21 Thread Jakob Kummerow
The time always has to be retrieved from the kernel. V8's implementation is
in base::OS::TimeCurrentMillis, implemented in
src/base/platform/platform-{win32,posix}.cc.

On Mon, May 21, 2018 at 3:22 PM Abhishek Kanike 
wrote:

> Hi,
> I want to know how the date.now() function is called in javascript (or how
> it returns the value). I believe that javascript uses date.now() by system
> call. I want to in chrome source code how it is being set.
> This is useful for one of the performance benchmark that I am working on.
> Can someone please guide me to know how this happens in v8 engine.
>
> Thanks in advance.
>
> Regards,
> K Abhishek
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Clarification on AllowJavascriptExecution

2018-05-14 Thread Jakob Kummerow
Yes.

On Fri, May 11, 2018 at 8:47 PM madana gopal 
wrote:

> Thanks, ok. let me go through and update. We have both Script.Run() calls
> and vm.runScript() calls in our project.
>
> So, we have to make sure, we are not making any JS calls, when either
> Run() or vm.runScript()  going on (as they will involve in code
> compilation) and need to wait for its completion. Is my understanding right
> Jakob?
>
> Thanks.
>
> Regards,
> Madan
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Isolate destruction "leaking" memory ?

2018-05-14 Thread Jakob Kummerow
Never mind; that shouldn't be needed, as isolate->Dispose() contains delete
this. Funky!

You said "it can be caught by valgrind". What does Valgrind report?

On Mon, May 14, 2018 at 11:16 AM Jakob Kummerow <jkumme...@chromium.org>
wrote:

> One obvious observation is that you don't have a delete isolate; statement
> in the loop ;-)
>
> On Sat, May 12, 2018 at 8:42 AM YJ <yang.ji...@celigo.com> wrote:
>
>> Kinda related to this old thread
>> https://groups.google.com/forum/#!searchin/v8-users/isolate$20memory|sort:date/v8-users/C_CzX8nSbDU/c4FR8-j6BQAJ
>>
>> Basically, I'd imagine if I instantiate an isolate and immediately
>> "Dispose" it inside a loop, all memory used by the isolated should be
>> released therefore the loop could go on forever. In reality however, doing
>> this would consume all available memories and doesn't seem to release any
>> memory back to the os at all. It is not a "leak" in the sense that it can
>> be caught by valgrind, it appears something is actually hogging the memory.
>> I am really curious of what is holding onto the memory. I really hope I am
>> just missing something obvious and any help is appreciated.
>>
>> I test the following code on a MBP
>>
>> #include "v8/include/v8.h"
>> #include "v8/include/libplatform/libplatform.h"
>>
>> int main(int argc, char* argv[]) {
>>   v8::V8::InitializeICUDefaultLocation(V8_LIB_FULL_PATH);
>>   v8::V8::InitializeExternalStartupData(V8_LIB_FULL_PATH);
>>   std::unique_ptr platform =
>> v8::platform::NewDefaultPlatform();
>>   v8::V8::InitializePlatform(platform.get());
>>   v8::V8::Initialize();
>>   for (auto i = 0; i < 10; ++i) {
>> v8::Isolate::CreateParams create_params;
>> create_params.array_buffer_allocator =
>> v8::ArrayBuffer::Allocator::NewDefaultAllocator();
>> v8::Isolate* isolate = v8::Isolate::New(create_params);
>> isolate->Dispose();
>> delete create_params.array_buffer_allocator;
>>   }
>>   v8::V8::Dispose();
>>   v8::V8::ShutdownPlatform();
>> }
>>
>> It will run until all memory is gone and macOS will just be unresponsive.
>>
>> I was using v8 version 6.5 and with the following build args
>>
>> is_debug = false
>> target_cpu = "x64"
>> use_drfuzz = false
>> use_libfuzzer = false
>> v8_enable_test_features = ""
>> v8_experimental_extra_library_files = []
>> v8_extra_library_files = []
>> symbol_level = 1
>> is_component_build = false
>> use_sysroot = false
>> use_glib = false
>> use_custom_libcxx = false
>> use_custom_libcxx_for_host = false
>> v8_enable_i18n_support = false
>> icu_use_data_file = false
>> v8_static_library = true
>> v8_enable_gdbjit = false
>>
>> Thanks
>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Isolate destruction "leaking" memory ?

2018-05-14 Thread Jakob Kummerow
One obvious observation is that you don't have a delete isolate; statement
in the loop ;-)

On Sat, May 12, 2018 at 8:42 AM YJ  wrote:

> Kinda related to this old thread
> https://groups.google.com/forum/#!searchin/v8-users/isolate$20memory|sort:date/v8-users/C_CzX8nSbDU/c4FR8-j6BQAJ
>
> Basically, I'd imagine if I instantiate an isolate and immediately
> "Dispose" it inside a loop, all memory used by the isolated should be
> released therefore the loop could go on forever. In reality however, doing
> this would consume all available memories and doesn't seem to release any
> memory back to the os at all. It is not a "leak" in the sense that it can
> be caught by valgrind, it appears something is actually hogging the memory.
> I am really curious of what is holding onto the memory. I really hope I am
> just missing something obvious and any help is appreciated.
>
> I test the following code on a MBP
>
> #include "v8/include/v8.h"
> #include "v8/include/libplatform/libplatform.h"
>
> int main(int argc, char* argv[]) {
>   v8::V8::InitializeICUDefaultLocation(V8_LIB_FULL_PATH);
>   v8::V8::InitializeExternalStartupData(V8_LIB_FULL_PATH);
>   std::unique_ptr platform =
> v8::platform::NewDefaultPlatform();
>   v8::V8::InitializePlatform(platform.get());
>   v8::V8::Initialize();
>   for (auto i = 0; i < 10; ++i) {
> v8::Isolate::CreateParams create_params;
> create_params.array_buffer_allocator =
> v8::ArrayBuffer::Allocator::NewDefaultAllocator();
> v8::Isolate* isolate = v8::Isolate::New(create_params);
> isolate->Dispose();
> delete create_params.array_buffer_allocator;
>   }
>   v8::V8::Dispose();
>   v8::V8::ShutdownPlatform();
> }
>
> It will run until all memory is gone and macOS will just be unresponsive.
>
> I was using v8 version 6.5 and with the following build args
>
> is_debug = false
> target_cpu = "x64"
> use_drfuzz = false
> use_libfuzzer = false
> v8_enable_test_features = ""
> v8_experimental_extra_library_files = []
> v8_extra_library_files = []
> symbol_level = 1
> is_component_build = false
> use_sysroot = false
> use_glib = false
> use_custom_libcxx = false
> use_custom_libcxx_for_host = false
> v8_enable_i18n_support = false
> icu_use_data_file = false
> v8_static_library = true
> v8_enable_gdbjit = false
>
> Thanks
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Clarification on AllowJavascriptExecution

2018-05-11 Thread Jakob Kummerow
It's not about the garbage collection operation being completed.

Presumably you have a call to v8::Script::Run() somewhere? When that call
returns, you can safely execute other scripts.

On Fri, May 11, 2018 at 5:01 PM madana gopal 
wrote:

> Thanks Jakob.
>
> Below is the backtrace. Here how can I identify, when I came out of event
> loop. Because, we want cleanup calls to get called quickly.
>
> *Backtrace:*
>
> V8_Fatal
> 0x5ac3ec3
> v8::Function::NewInstance(v8::Local, int,
> v8::Local*) const* // calling javascript function here*
> // app code
>
> v8::internal::GlobalHandles::PendingPhantomCallback::Invoke(v8::internal::Isolate*)
> v8::internal::GlobalHandles::DispatchPendingPhantomCallbacks(bool)
> v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector,
> v8::GCCallbackFlags)
> v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector,
> v8::GCCallbackFlags)
> v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char
> const*, char const*, v8::GCCallbackFlags)
> v8::internal::Factory::CopyFixedArrayAndGrow(v8::internal::Handle,
> int, v8::internal::PretenureFlag)
> v8::internal::ArrayList::EnsureSpace(v8::internal::Handle,
> int)
> v8::internal::ArrayList::Add(v8::internal::Handle,
> v8::internal::Handle,
> v8::internal::Handle,
> v8::internal::ArrayList::AddMode)
> v8::internal::Heap::AddRetainedMap(v8::internal::Handle)
> 0x59d0eda
> v8::internal::OptimizedCompileJob::GenerateCode() 
> *//DisAllowJavascriptExecutionScope
> set here*
>
> v8::internal::Compiler::FinalizeOptimizedCompileJob(v8::internal::OptimizedCompileJob*)
> v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions()
> v8::internal::Runtime_TryInstallOptimizedCode(int, v8::internal::Object**,
> v8::internal::Isolate*)
> 
>
> We have many number of cleanup objects, for which we have to call JS code
> on it being garbage collected. So, we will have cleanup calls for every
> object being garbage collected. Could you please point the instant, at
> which it will be good to identify this operation is completed (i.e the
> point where JS enging completed its garbage collection operation and we are
> good to do cleanup).
>
> Thanks.
>
> Regards,
> Madan
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] git cl upload fails on cpplint preexisting errors

2018-05-02 Thread Jakob Kummerow
"git cl lint" is known not to work for V8, becauses it doesn't go through
tools/presubmit.py which defines a few skipped linting rules (explaining
the reports you're seeing).

"git cl presubmit" should work.

"tools/presubmit.py" should work too. What does "which cpplint.py" return?
It should find the cpplint.py in depot_tools.

On Wed, May 2, 2018 at 2:21 PM 'Hidy Han' via v8-users <
v8-users@googlegroups.com> wrote:

> When I run git cl upload, presubmit fails due to lint checker. git cl lint
> gives some errors on preexisting code:
>
> include/v8-inspector.h:5:  #ifndef header guard has wrong style, please
> use: INCLUDE_V8_INSPECTOR_H_  [build/header_guard] [5]
> include/v8-inspector.h:290:  #endif line should be "#endif  //
> INCLUDE_V8_INSPECTOR_H_"  [build/header_guard] [5]
> include/v8-inspector.h:228:  Add #include  for pair<>
> [build/include_what_you_use] [4]
> include/v8-inspector.h:66:  Add #include  for string
> [build/include_what_you_use] [4]
> include/v8-inspector.h:147:  Add #include  for vector<>
> [build/include_what_you_use] [4]
> Done processing include/v8-inspector.h
> src/inspector/v8-stack-trace-impl.cc:276:  Add #include  for
> string  [build/include_what_you_use] [4]
> src/inspector/v8-stack-trace-impl.cc:372:  Add #include  for
> move  [build/include_what_you_use] [4]
> Done processing src/inspector/v8-stack-trace-impl.cc
> Total errors found: 7
>
> git cl presubmit -v shows that errors are found by ~/v8/v8/PRESUBMIT.py.
> If I run tools/presubmit.py, C++ lint check shows "Failed to process ..."
> on all files.
>
> Does someone know what is this error about?
> Thanks!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Parsing only select fields of a JSON in v8

2018-04-24 Thread Jakob Kummerow
There is no way to parse only part of a JSON string.

On Tue, Apr 24, 2018 at 3:30 AM Gautham B A 
wrote:

> Hi all,
>
> As per the JSON spec, there's some mention about JSON pointers which says
>
> JSON Pointer defines a string syntax for identifying a specific value
>>within a JavaScript Object Notation (JSON) document.
>>
>>
> https://tools.ietf.org/html/rfc6901
>
> Consider a large JSON { "a" : 1234, "b" : [1, 2, 3, 4] ...}. Now, if we
> want to access the field "a", can we do so without having to parse the
> entire JSON, only parse field "a" and its value?
>
> Currently, we just have v8::JSON::Parse which will parse the entire JSON.
>
> Thanks,
> --Gautham
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is running a v8 instance built as a static library supported in the same process that loaded a different v8 instance in a DLL?

2018-04-17 Thread Jakob Kummerow
>
> > What Ben pointed out was virtual memory reservations, which is not the
> same as restricted space sizes.
>
> Would you guys mind expanding on this? My thinking is that the v8 commits
> as much memory as it is allowed for semi/old/code spaces (considering that
> the app doesn't allocate more than fits into these spaces), plus for the
> C++ machinery to maintain these objects and if those sizes are limited to
> some reasonable size, why would v8 reserve more memory that it cannot
> commit?
>

Memory address space is separate from actual memory. There are cases where
it makes sense to reserve a large chunk of address space without requesting
it to be backed by actual memory, usually when a contiguous range may be
required later.
For example, on 64-bit platforms, V8 requires all executable memory to be
within a 2GB section of address space so that calls can use 32-bit offsets,
so it reserves that amount of address space on initialization (which is a
very cheap operation), whereas actual memory is allocated later as needed.
WebAssembly has a similar use case where a large section of address space
is reserved so that *if* it needs to use that memory later, the addresses
will be contiguous.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is running a v8 instance built as a static library supported in the same process that loaded a different v8 instance in a DLL?

2018-04-17 Thread Jakob Kummerow
I'm on the V8 team, and I defer to Ben on this question :-)

I've never tried embedding two different versions of V8 into the same
process, and I don't think we'd consider that scenario supported, but it
may well work. You can probably find out with a fairly small example (i.e.
without sinking lots of time into it) whether it works.

With regards to memory, I implemented first/second chance weak handle
> callbacks and tested it with low memory limits for semi/old space sizes and
> it appears to deal with memory restrictions well.


What Ben pointed out was virtual memory reservations, which is not the same
as restricted space sizes. As he said, on 64-bit platforms it shouldn't be
a problem.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is it possible to turn off the interpreter (i.e. Ignition ) when running the v8

2018-03-26 Thread Jakob Kummerow
Yes, that's Turbofan; and yes, it's enabled by default.

On Sun, Mar 25, 2018 at 11:27 PM 李弘毅 <lihongy...@gmail.com> wrote:

> Sorry, I have another little question: when running the latest v8, is that
> "new optimizing compiler" (I guess that is Turbofan, right?) enabled by
> default?
>
> 2018-03-24 9:31 GMT+08:00 Jakob Kummerow <jkumme...@chromium.org>:
>
>> You cannot turn off the interpreter, nor build V8 without it. Without the
>> interpreter, V8 would be unable to execute any JavaScript.
>>
>> V8 used to have a non-optimizing compiler and an optimizing compiler. Now
>> it has an interpreter and a new optimizing compiler, replacing the former
>> two. What hasn't changed is that all executed code still goes through the
>> first stage of the pipeline first, and then is eventually optimized if it
>> runs hot enough.
>>
>> So I think for your purposes, the fact that the non-optimizing compiler
>> was replaced with an interpreter is an internal implementation detail that
>> you don't need to care about. Just go ahead and run your benchmarks :-)
>>
>>
>> On Fri, Mar 23, 2018 at 5:54 PM Howie Lee <lihongy...@gmail.com> wrote:
>>
>>> Hi, everyone!
>>>
>>> I need to run some benchmarks on the v8 to test the performance of a DBT
>>> (a dynamic binary translator). I am wondering how to turn off the
>>> interpreter in the v8, or is it possible to build v8 without the
>>> interpreter? Though I know that I can build the v8 5.5.x which does not
>>> have the interpreter, yet my professor prefer to use the latest v8 by
>>> turning off the interpreter. The very reason is that our dbt is written
>>> when v8 doesn't have an interpreter and my professor would like to restore
>>> the same environment to run benchmarks on our dbt again without degrading
>>> the version of v8. Since we'd like to use our old dbt in another pro, we
>>> are afraid the version of v8 will be a drawback to publishing a paper.
>>>
>>> Thanks a lot!
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "v8-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/v8-users/Gv6yrGkkLpA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is it possible to turn off the interpreter (i.e. Ignition ) when running the v8

2018-03-23 Thread Jakob Kummerow
You cannot turn off the interpreter, nor build V8 without it. Without the
interpreter, V8 would be unable to execute any JavaScript.

V8 used to have a non-optimizing compiler and an optimizing compiler. Now
it has an interpreter and a new optimizing compiler, replacing the former
two. What hasn't changed is that all executed code still goes through the
first stage of the pipeline first, and then is eventually optimized if it
runs hot enough.

So I think for your purposes, the fact that the non-optimizing compiler was
replaced with an interpreter is an internal implementation detail that you
don't need to care about. Just go ahead and run your benchmarks :-)


On Fri, Mar 23, 2018 at 5:54 PM Howie Lee  wrote:

> Hi, everyone!
>
> I need to run some benchmarks on the v8 to test the performance of a DBT
> (a dynamic binary translator). I am wondering how to turn off the
> interpreter in the v8, or is it possible to build v8 without the
> interpreter? Though I know that I can build the v8 5.5.x which does not
> have the interpreter, yet my professor prefer to use the latest v8 by
> turning off the interpreter. The very reason is that our dbt is written
> when v8 doesn't have an interpreter and my professor would like to restore
> the same environment to run benchmarks on our dbt again without degrading
> the version of v8. Since we'd like to use our old dbt in another pro, we
> are afraid the version of v8 will be a drawback to publishing a paper.
>
> Thanks a lot!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] standalone static library

2018-03-21 Thread Jakob Kummerow
I would hope that NetBeans provides a way to configure it such that V8 is
compiled with V8's own build process, and your embedding project's code
with whatever system you choose to use (which might be whatever NetBeans
uses by default); but I don't know how to set that up, sorry. V8's build
process is fairly complicated, so it is expected that you can't just tell
an IDE "here are the .cc files, now do your thing and build". The example
from our documentation shows you a way how it's possible to build V8 with
GN as usual, and then have your own code link against that. The example
does it by hand; it is up to you to figure out how to integrate those steps
into any other workflows/tools you might want to use. Feel free to post
your findings to this mailing list so that others can benefit!


On Wed, Mar 21, 2018 at 5:56 AM Eduardo Bolis 
wrote:

> Yes, I did. The examples created in the build process (Hello World, Shell,
> etc) works fine.
> But when I try to compile them from Netbeans, there are lot of libraries
> internal reference errors (if you wish, I will put an example here). and
> the compile line code from the turorial references a file 
> (src/inspector/libinspector.a)
> that doesn't exist in my V8 directories. I don't know if there was a config
> error in my process or the doc is deprecated.
> I see no troubles, in the future, to use GN to compile my project with V8,
> but under the development stage I need an IDE facility (like Netbeans) to
> work.
> I want to know if is possible to create a GN or Ninja script to make a
> single library file; if so, I will follow this way, and try to create this
> script (or if anyone already did it, please, tell me where to find).
>
> thanks,
>
> Eduardo
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] standalone static library

2018-03-20 Thread Jakob Kummerow
Have you read the official documentation?
https://github.com/v8/v8/wiki/Getting-Started-with-Embedding

Do those steps work for you? If not, what error(s) do they produce?



On Tue, Mar 20, 2018 at 11:09 AM Eduardo Bolis 
wrote:

> Hi,
>
> I successfully build V8 on Ubuntu 17 with GN, but what it generates is a
> set of static libraries and object files that I have no idea how to
> embedded into my project.
> I found an article that said: "Under gn, there is no way to have v8 build
> as a standalone static library."
> So, I ask if anyone knows how to use it. I am working with Netbeans/C++,
> and everything i tryed results in a lot of link errors.
>
> regards,
>
> Eduardo Bolis
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] CFG

2018-03-16 Thread Jakob Kummerow
V8's new optimizing compiler, Turbofan, is not a CFG-based compiler.
--trace-turbo-scheduled is probably the closest equivalent it has to
dumping a CFG. You can also look at the other --trace-turbo* flags to see
if any of them suits your needs better.

On Fri, Mar 16, 2018 at 5:27 AM Thierry Sans  wrote:

> Hi,
>
> With v8, is it possible to compile *(but not execute) and dump the CFG
> (Control Flow Graph)? I know it was possible before with Hydrogen.
>
> Thanks.
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Are functions which defined using eval or new Function() optimized?

2018-03-04 Thread Jakob Kummerow
On Sat, Mar 3, 2018 at 9:17 AM Koray <burakko...@gmail.com> wrote:

> Hello Jakob,
>
> Thank you for your response. I will make sure to design my application
> accordingly.
>
> My next question would be, does v8 optimize according to new prototype
> changes after a while?


Yes.


> Or should I restart the application in certain
> periods to make sure the application is optimized with newly added
> functions?
>

That should not be necessary. Of course you can experiment with it to see
if it makes a difference.


> My next question is, do all functions have to be in a file in order to
> optimization to not be broken?


That's pretty much the same as your first question: if you create functions
with eval, it doesn't matter where the source text came from.


> Because my idea was to keep all
> functions in a database and then add them to prototypes whenever
> application's restarted.
>

That should be fine.

For completeness' sake I'll mention: there are many forms of optimizations;
e.g. certain tricks to improve startup speed assume the common pattern of
parsing code from files. By cooking up your own initialization mechanism,
you'll probably miss out on those, but if you have uncommon requirements,
then it's of course perfectly fine to devise your own set of tradeoffs.


>
> On 3/2/18, Jakob Kummerow <jkumme...@chromium.org> wrote:
> > Functions created with eval or new Function will get optimized (after a
> > while, just like other functions -- nothing is optimized on first use).
> >
> > That said, modifying prototypes after the fact tends to have a
> performance
> > impact, because V8 makes optimizations (all over the place) based on the
> > assumption that prototypes don't change much. When they do, optimized
> code
> > built on such assumptions must be discarded. That may or may not be an
> > issue for your use case, the only way to find out is to try.
> >
> >
> >
> > On Fri, Mar 2, 2018 at 7:47 AM Koray <burakko...@gmail.com> wrote:
> >
> >> Forwarding here from Node.js group as this one is more appropriate.
> >>
> >> Hello,
> >>
> >> I have a real time application which will require constant updates /
> >> bug fixes. So I will be constantly defining new functions on
> >> prototypes or constructors.
> >>
> >> My question is, will there be a difference between functions which
> >> were hard coded and functions defined using eval or Function
> >> constructor? If so, will require() be possibly able to get around
> >> this?
> >>
> >> Note: Functions will be used multiple times throughout the lifetime of
> >> the application. Giving this information just in case if they are
> >> being optimized after the first usage.
> >> Thank you
> >>
> >> --
> >> --
> >> v8-users mailing list
> >> v8-users@googlegroups.com
> >> http://groups.google.com/group/v8-users
> >> ---
> >> You received this message because you are subscribed to the Google
> Groups
> >> "v8-users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to v8-users+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> > --
> > --
> > v8-users mailing list
> > v8-users@googlegroups.com
> > http://groups.google.com/group/v8-users
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "v8-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to v8-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Are functions which defined using eval or new Function() optimized?

2018-03-02 Thread Jakob Kummerow
Functions created with eval or new Function will get optimized (after a
while, just like other functions -- nothing is optimized on first use).

That said, modifying prototypes after the fact tends to have a performance
impact, because V8 makes optimizations (all over the place) based on the
assumption that prototypes don't change much. When they do, optimized code
built on such assumptions must be discarded. That may or may not be an
issue for your use case, the only way to find out is to try.



On Fri, Mar 2, 2018 at 7:47 AM Koray  wrote:

> Forwarding here from Node.js group as this one is more appropriate.
>
> Hello,
>
> I have a real time application which will require constant updates /
> bug fixes. So I will be constantly defining new functions on
> prototypes or constructors.
>
> My question is, will there be a difference between functions which
> were hard coded and functions defined using eval or Function
> constructor? If so, will require() be possibly able to get around
> this?
>
> Note: Functions will be used multiple times throughout the lifetime of
> the application. Giving this information just in case if they are
> being optimized after the first usage.
> Thank you
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Intent to ship: BigInt, BigInt64Array, BigUint64Array

2018-03-02 Thread Jakob Kummerow
Note that this is a v8/JavaScript feature, so this post is just an FYI for
blink-dev — no signoff from Blink API owners is required.


*Contact emails*

jkumme...@chromium.org, n...@chromium.org


*Explainer*

https://github.com/tc39/proposal-bigint/blob/master/README.md


*Spec*

https://tc39.github.io/proposal-bigint


*Summary*

This proposal brings arbitrary-precision integers to JavaScript, along with
new TypedArrays with signed and unsigned 64-bit integer elements.


*Is this feature supported on all six Blink platforms (Windows, Mac, Linux,
Chrome OS, Android, and Android WebView)?*

Yes.


*Debuggability*

As of this writing, DevTools support is being worked on. It will be
available before shipping.

All the usual DevTools features will work for code containing BigInts.


*Interoperability risk*

Edge: No public signals

Firefox: In development:
https://bugzilla.mozilla.org/show_bug.cgi?id=1366287

Safari: In development: https://bugs.webkit.org/show_bug.cgi?id=179001

Web developers: Positive, e.g.
https://github.com/tc39/proposal-bigint/issues/53


*Compatibility risk*

BigInt literals were invalid syntax before.

The "BigInt", "BigInt64Array", "BigUint64Array" constructors could clash
with user-defined globals.


*Activation risk*

The semantics of the BigInt proposal are not polyfillable (it would require
operator overloading).


*Tests*

test262 contains tests for BigInt, BigInt64Array, BigUintArray, which V8
passes.

V8 also has its own tests:
https://chromium.googlesource.com/v8/v8/+/master/test/mjsunit/harmony/bigint


*Tracking bug*

crbug.com/v8/6791


*Entry on the feature dashboard*

https://www.chromestatus.com/features/5371603852460032


*Requesting approval to ship?*

Yes.

We would like to ship BigInts on ToT in ~3 weeks, in time for Chrome 67.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Profiling: what is "LoadIC: A load IC from the snapshot"?

2018-03-01 Thread Jakob Kummerow
Depending on usage patterns, you might see a further speed boost if you
split your objects into two parts, where one has the same shape for all
objects and the other is type dependent, roughly:

class Thing {
  constructor(type, specific, ...) {
this.type = type;
this.other_common_field = ...;

// If type === 100, this is a Foo; if type === 101, it's a Bar; etc.
this.type_specific_stuff = specific;
  }
}

var x = new Thing(100, new Foo(...), ...);  // Maybe wrap in a factory?

if (x.type === 100) {
  var data = x.type_specific_stuff.foo_field;  // Both loads are
monomorphic, yay!
}



On Thu, Mar 1, 2018 at 12:31 PM Andrew Wilcox 
wrote:

> can anyone tell me what LoadIC is?
>>
>>
>
>> The thing that handles property loads (like foo.bar;).
>
>
> Thank you Jacob!
>
>
> Seeing it take 22% is rare. Is your app heavy on polymorphic property
>> loads?
>
>
> Yes, I'm writing an interpreter and it was doing a *lot* of instanceof
> checks.  Since I don't have undefined or null values in my interpreter,
> rather than use x instanceof Foo I can instead give Foo instances a
> "type" property of e.g. 100 and use x.type === 100, which is faster.  So
> indeed yes, now it's doing a lot of polymorphic property loads! :-)  Makes
> perfect sense, thanks!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Profiling: what is "LoadIC: A load IC from the snapshot"?

2018-03-01 Thread Jakob Kummerow
The thing that handles property loads (like foo.bar;).

Seeing it take 22% is rare. Is your app heavy on polymorphic property loads?


On Thu, Mar 1, 2018 at 9:44 AM Andrew Wilcox 
wrote:

> My prof output starts off with
>
>  [JavaScript]:
>ticks  total  nonlib   name
>   12065   22.7%   22.7%  LoadIC: A load IC from the snapshot
>27325.1%5.1%  Builtin: StrictEqual
>
> and I was wondering, can anyone tell me what LoadIC is?
>
> Thanks!
>
> Andrew
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] --print-code does not work

2018-02-23 Thread Jakob Kummerow
Correction: Looking at the code, it turns out that --print-code still does
what the name implies: it prints all code (optimized code, regexp code,
wasm code). It's just that there is no unoptimized code any more (which
arguably was the flag's primary use case in the past).


On Mon, Feb 12, 2018 at 1:45 AM 'Mathias Bynens' via v8-users <
v8-users@googlegroups.com> wrote:

> Tracking issue for the removal of --print-code:
> https://bugs.chromium.org/p/v8/issues/detail?id=7437
>
> On Fri, Feb 9, 2018 at 11:22 PM, Jakob Kummerow <jkumme...@chromium.org>
> wrote:
>
>> If --print-opt-code prints nothing, then probably your function isn't
>> getting optimized. Try calling it more often.
>>
>> --print-code is "technically correct" in the sense that it prints all of
>> the unoptimized machine code that V8 doesn't generate any more ;-)
>> (We should remove the flag.)
>>
>>
>> On Fri, Feb 9, 2018 at 1:18 AM Istvan Tabanyi <st...@powerednow.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I compiled v8 from sources successfully, but
>>> --print-code/--print-opt-code gives me no output at all.
>>> --print-bytecode works fine, --print-all-code prints something, but the
>>> actual code is definitely not in the output(Created a simple function with
>>> unique name, called in a loop, grepped for it and nothing)
>>>
>>> Tried release and debug builds, also with custom options like this:
>>> gn gen out.gn/x64.debug --args='is_debug=true target_cpu="x64"
>>> v8_target_cpu="x64" v8_enable_disassembler=true'
>>>
>>> I tried to look for tutorials on this topic, but most of it really
>>> outdated and using make/gyp.
>>> Can someone give me some tips about this? And sorry if this is not the
>>> right place to ask questions like this.
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Tuning v8 settings for short-lived process

2018-02-15 Thread Jakob Kummerow
My intuition is that no flags will provide significant performance gains.
The flags controlling the garbage collector are quite carefully tuned and
probably best left alone.

If most (of the possibly-avoidable) time is spent parsing and loading, then
garbage collection probably doesn't have much influence. You could try to
profile your process to figure out where most time is spent, maybe that can
identify areas for optimization. See
https://github.com/v8/v8/wiki/V8-Profiler for detailed instructions.

Unfortunately there is no magic --run-twice-as-fast flag -- if we had one,
we would turn it on by default :-)


On Thu, Feb 15, 2018 at 12:52 PM Kevin Burke  wrote:

> Hi there,
> I have a short lived v8 process - a Node.js test suite that takes 10
> seconds to run. It spends about half of its time loading Javascript in
> require() blocks. Obviously one way to cut down on the startup time is to
> cut down on the number of things that need to be loaded; I am working on
> that.
>
> Do you have any intuition of whether tuning v8 options from the defaults
> provided by Node.js will be able to achieve significant performance gains?
> If so, which should I try to play around with? I have been doing some
> reading but - and I would love to be shown wrong here - it doesn't seem
> like the Node community is too too familiar with e.g. tweaking the
> "semi_space_growth_factor" to get good performance. I'm not a GC expert
> myself, unfortunately.
>
> Using default options and profiling using GNU Time, the process uses ~210
> MB in ten seconds, 131% and has 80,000 page faults. It would be OK if it
> used up to 1.5GB of RAM. We typically run on Macs, but any intuition about
> useful v8 options would be helpful.
>
> Thanks,
> Kevin
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is there a way out from dictionary mode?

2018-02-14 Thread Jakob Kummerow
>
> I think I understand what you mean. Dictionary mode is faster when you
> want to use your object like a dictionary.
>

More generally, dictionary mode is faster for adding/removing/reconfiguring
properties (and, depending on circumstances, sometimes also for
reading/writing existing properties at high-degree polymorphic sites).


> However, if I were to delete a property of some important prototype lots
> of objects use, I'm guessing that would cause performance issues in the
> whole application.
>

*Modifying* prototypes in any way *can* have a widespread performance
impact, especially when it's done in the middle of execution. Depending on
circumstances, deleting a prototype's property might not be worse than
other modifications to that prototype. (Fun fact: we *currently *(there are
plans to change this) keep prototypes (almost) always in non-dictionary
mode, but modifying them is slow regardless.)


> On Thursday, February 15, 2018 at 12:01:55 AM UTC+2, Jakob Kummerow wrote:
>>
>> Probably not. There are exceptions, but I'm hesitating to be specific
>> because these are internal implementation details that can and will change
>> over time.
>>
>> Also, "fast" is relative. Dictionary mode exists because it is faster for
>> some operations. Shape-tracked objects are faster for other situations. For
>> complex use cases, it can be difficult to estimate which mode works better.
>>
>>
>> On Wed, Feb 14, 2018 at 12:47 PM Greg Rosenbaum <life@gmail.com>
>> wrote:
>>
>>> I understand that I delete an object from a property, i.e.:
>>>
>>> delete obj.property
>>>
>>> It will enter dictionary mode. If I do this only once, and the object is
>>> used throughout the application, will it at some point become fast again?
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is there a way out from dictionary mode?

2018-02-14 Thread Jakob Kummerow
Probably not. There are exceptions, but I'm hesitating to be specific
because these are internal implementation details that can and will change
over time.

Also, "fast" is relative. Dictionary mode exists because it is faster for
some operations. Shape-tracked objects are faster for other situations. For
complex use cases, it can be difficult to estimate which mode works better.


On Wed, Feb 14, 2018 at 12:47 PM Greg Rosenbaum 
wrote:

> I understand that I delete an object from a property, i.e.:
>
> delete obj.property
>
> It will enter dictionary mode. If I do this only once, and the object is
> used throughout the application, will it at some point become fast again?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] --print-code does not work

2018-02-09 Thread Jakob Kummerow
If --print-opt-code prints nothing, then probably your function isn't
getting optimized. Try calling it more often.

--print-code is "technically correct" in the sense that it prints all of
the unoptimized machine code that V8 doesn't generate any more ;-)
(We should remove the flag.)


On Fri, Feb 9, 2018 at 1:18 AM Istvan Tabanyi  wrote:

> Hi,
>
> I compiled v8 from sources successfully, but --print-code/--print-opt-code
> gives me no output at all.
> --print-bytecode works fine, --print-all-code prints something, but the
> actual code is definitely not in the output(Created a simple function with
> unique name, called in a loop, grepped for it and nothing)
>
> Tried release and debug builds, also with custom options like this:
> gn gen out.gn/x64.debug --args='is_debug=true target_cpu="x64"
> v8_target_cpu="x64" v8_enable_disassembler=true'
>
> I tried to look for tutorials on this topic, but most of it really
> outdated and using make/gyp.
> Can someone give me some tips about this? And sorry if this is not the
> right place to ask questions like this.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Large build size

2018-02-07 Thread Jakob Kummerow
That does indeed seem very large. On Linux with a current checkout (and
without v8_static_library=true), my out/x64.release/obj/v8_base directory
with all the .o files is only 29MB.

Unfortunately, I have no idea what might be causing the difference in your
case. Do any *.o files stand out as very big? Have you tried deleting the
output directory (remember to save your args.gn first!) and compiling
everything from scratch? It's a blunt instrument but sometimes helps get
rid of old cruft...


On Wed, Feb 7, 2018 at 3:58 PM Ryan Dahl  wrote:

> Hi,
>
> I've noticed that the build size in the latest V8 releases is very large.
>
> For example, on 6.5.257, I get
>
> -rw-r--r--  1 rld  staff   1.1G Feb  7 18:49 out/v8build/obj//libv8_base.a
>
> It's similarly large on 6.6.164. I'm experiencing this on OSX and here is
> the configuration I'm using:
>
> is_component_build=false
> is_debug=false
> v8_deprecation_warnings=true
> v8_enable_gdbjit=false
> v8_enable_i18n_support=false
> v8_experimental_extra_library_files=[]
> v8_extra_library_files=[]
> v8_imminent_deprecation_warnings=true
> v8_static_library=true
> v8_target_cpu="x64"
> v8_untrusted_code_mitigations=false
> v8_use_external_startup_data=false
> v8_use_snapshot=false
>
> Any suggestions on how to reduce the size? I'm surprised that the build
> size has gone from under 100M to over 1G in the span of a few years - is
> this a bug on my end or working as intended?
>
>
> Thanks,
> Ryan
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Can "threading" be implemented by mapping v8 heap to shared memory in linux?

2018-01-08 Thread Jakob Kummerow
No, you cannot simply share all memory to get multi-threading. For
safely/correctly working with shared memory, you need
locking/synchronization primitives as well as certain guarantees in the
language's memory model. JavaScript is not designed for such purposes.


On Mon, Jan 8, 2018 at 3:52 PM Bogdan  wrote:

> I don't know all details, I just a regular node developer who came up with
> idea of "threading" in js and hope anybody with deep knowledge will clarify
> some things. Javascript have old problem of lacking threading and all
> advices of using multiple processes doesn't help because there are
> important tasks  (for example in-memory database or managing application
> cache) which needs shared memory to utilize all cpu cores and having full
> copy of that memory and synchronizing it by coping data over channels
> doesn't make sense. Recently I've found out an interesting linux feature
> like shader memory with shm_open and mmap which can allow zero-copy and
> zero-overhead access to shared memory from different processes. There are
> also some node modules which exposes this feature to javascript but seems
> like all they can do is exposing  shared memory to javascript as an array
> which means all object managing, garbage collector, and other useful
> features we need to do all by ourselves. So I am wondering can v8 (if
> cannot now, maybe in it will with little hacking) allow to just map all
> heap into shared buffer so we can use the same objects from another process
> without copying?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Is v8-dev mailing list unavailable?

2017-12-23 Thread Jakob Kummerow
It's a known issue and will get fixed; however due to the holiday season it
is taking some time.


On Sat, Dec 23, 2017 at 8:28 PM  wrote:

> Why anyone fix this?
>>
> Why anyone won't fix this?
>
> 2017年12月24日日曜日 4時25分29秒 UTC+9 b...@b6n.ch:
>>
>> Now v8-dev group is showed as spam, so I can't see any posts.
>> Why anyone fix this?
>>
>> https://groups.google.com/forum/#!forum/v8-dev
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Problem building V8 (v6.1.534) on armv5TEJ without VFP/Neon

2017-12-11 Thread Jakob Kummerow
V8 requires ARMv6 and VFPv2 as a minimum.


On Mon, Dec 11, 2017 at 1:51 AM  wrote:

> Hello everyone,
>
> Currently i am trying to build V8 (v6.1.534) on ARM926EJ-S ( armv5TEJ
> without VFP nor NEON) with the current config
> "./tools/cross_build_gcc.sh
> /home/crossdev/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi- arm.debug
> arm_version=5 armfloatabi=softfp armfpu=default armthumb=on backtrace=on
> debugsymbols=on gdbjit=on"
>
> "amfloatabi" should be "soft", however, from the Makefile there are only 2
> possible solution: hard and softfp [line 207:/v8/Makefile].
> During the building, i keep getting error "#error
> "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"  [line
> 176:/v8/src/arm/assembler-arm.cc]
> I tried different options but it doesn't help.
> I dig deeper into the source codes and it seems to me that V8 engine only
> support armv6, armv7 and armv8 (need either VFP or NEON)   [line
> 58:/v8/src/arm/assembler-arm.cc] and [line 200:/v8/Makefile].
>
> My question is: does V8 Engine support armv5 and does it need VFP or NEON
> to work?
>
> Thank you.
> Thang Tran
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to build a fixed version of V8 and its dependencies.

2017-11-27 Thread Jakob Kummerow
The depot_tools system makes this easy, actually:

git checkout 
gclient sync
ninja -C out/ d8

(If you go back far enough before ninja was supported, replace the last
command with the equivalent make/GYP based build.)


On Mon, Nov 27, 2017 at 9:23 AM Edd Barrett  wrote:

> Hi Mathias,
>
> Thanks for your swift response.
>
> On Monday, November 27, 2017 at 1:40:05 PM UTC, Mathias Bynens wrote:
>>
>> This is not a direct answer to your question, but we already host
>> prebuilt `d8` binaries for Linux on 32-bit and 64-bit architectures. We
>> plan on doing the same for other operating systems:
>> https://bugs.chromium.org/p/v8/issues/detail?id=5918 By using a
>> precompiled binary, you could bypass compiling from source together.
>>
>
>
> That's good to know, but for our purposes we really do need to build from
> source:
>
>  * We have patches to grant access to the monotonic clock and performance
> counters.
>  * The experiment should be fully repeatable from source.
>
> I think it's something the V8 team should consider for the future.
>
> Cheers
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] BSON to v8::Object performance issue

2017-11-14 Thread Jakob Kummerow
There are a bunch of optimizations going into object literal handling, so
the two versions are not at all equivalent: the JS version is expected to
be much faster. To make them more comparable, you could model the same
control flow in JS, roughly:

var input = {
"_id": {
"$oid": "5a00bad8f759511811e030ba"
},
"attributes": ...
};
function process(o) {
var result = {};
for (var key of Object.keys(o)) {
var value = o[key];
if (typeof value === "Number") {
...
} else if ... {

} else if (typeof value === "object") {
result[key] = process(value);
}
return result;
}
var output;
for (var i = 0; i < 26400; i++) {
output = process(input);
}

I don't see anything obviously wrong with your code.

However, if there are any assumptions you can make, maybe you can optimize
it. For example: do all your objects have the same shape? If so, using a
constructor function and just filling in the values should be faster than
assembling them one property at a time.


On Tue, Nov 14, 2017 at 11:46 AM Jean-Marc Le Roux <
jeanmarc.ler...@gmail.com> wrote:

> Hello,
>
> I'm trying to create NodeJS bindings for libbson.
> One of the things I need is to be able to transform a bson_t document into
> a v8::Object.
> Loading, iterating on bson_t documents and matching them with
> MongoDB-style queries it very fast: 50ms to load from my HDD, iterate and
> filter 26000 bson_t documents.
> On the same machine, converting the same BSON documents into v8::Object is
> painfully slow.
> So I suspect I missed something.
>
> Here is my code:
>
> Local
> iterator_to_value(Isolate* isolate, const bson_iter_t* iter)
> {
> switch (bson_iter_type(iter))
> {
> case BSON_TYPE_INT32:
> return Number::New(isolate, bson_iter_int32(iter));
> break;
> case BSON_TYPE_INT64:
> return Number::New(isolate, bson_iter_int64(iter));
> break;
> case BSON_TYPE_DOUBLE:
> return Number::New(isolate, bson_iter_double(iter));
> break;
> case BSON_TYPE_DOCUMENT:
> {
> bson_iter_t sub_iter;
> bson_iter_recurse(iter, _iter);
>
> Local obj = Object::New(isolate);
> while (bson_iter_next(_iter))
> {
> const char* key = bson_iter_key(_iter);
>
> obj->Set(
> String::NewFromUtf8(isolate, key),
> iterator_to_value(isolate, _iter)
> );
> }
>
> return obj;
> }
> break;
> case BSON_TYPE_ARRAY:
> {
> bson_iter_t sub_iter;
> uint32_t length;
> const uint8_t* array_data;
>
> bson_iter_array(iter, , _data);
> bson_iter_recurse(iter, _iter);
>
> Local array = Array::New(isolate);
> int i = 0;
>
> while (bson_iter_next(_iter))
> {
> array->Set(i++, iterator_to_value(isolate, _iter));
> }
>
> return array;
> }
> break;
> case BSON_TYPE_OID:
> {
> const bson_oid_t* oid = bson_iter_oid(iter);
> char oid_buffer[25];
>
> bson_oid_to_string(oid, oid_buffer);
>
> return String::NewFromOneByte(isolate, (uint8_t*)oid_buffer);
> }
> break;
> case BSON_TYPE_UTF8:
> {
> uint32_t length;
> return String::NewFromUtf8(isolate, bson_iter_utf8(iter,
> ));
> }
> break;
> }
>
> return Null(isolate);
> }
>
> Local
> fill_object(Isolate* isolate, Local& obj, const bson_t* document)
> {
> bson_iter_t iter;
> if (bson_iter_init(, document))
> {
> while (bson_iter_next())
> {
> const char* key = bson_iter_key();
>
> obj->Set(
> String::NewFromUtf8(isolate, key),
> iterator_to_value(isolate, )
> );
> }
> }
>
> return obj;
> }
>
> As you can see, it's very straight forward.
> *Transforming 26400 bson_t into v_::Object takes 1.23s.*
>
> I tried doing what I believe to be the same code in pure JS with a
> representative sample Object :
>
> var array = [];
> for (var i = 0; i < 25000; ++i)
> {
> array.push({
> "_id": {
>   "$oid": "5a00bad8f759511811e030ba"
> },
> "attributes": [
>   {
> "key": "smartshape.scene.node.path|default",
> "value": "/scene/Lot444.scene",
> "type": "imported"
>   },
>   {
> "key": "max x",
> "value": 196.5773162841797,
> "type": "computed"
>   },
>   {
> "key": "max y",
> "value": 18.55002021789551,
> "type": "computed"
>   },
>   {
> "key": "max z",
> "value": 

Re: [v8-users] internal fields

2017-11-06 Thread Jakob Kummerow
>
> 3. What difference does it make to v8 if the internal field is an aligned
>> pointer or not? Is the ability to set/get aligned pointers a consistency
>> check so assumptions can be made? Does the interface check the alignment?
>> (Not critical for me, I don't think, but I'd like to understand.)
>>
>
> I doubt it matters... basically internal fields seem to be user-data
> fields that store the value so your user code can later retrieve it.
> Internally I wouldn't expect V8 to ever actually do anything with those
> fields. Since they are usually pointers that are stored, aligned buffers
> will be more optimal.
>

It actually does matter, and the interface does check for alignment. The
reason is that V8 relies on those pointers being aligned: it uses this fact
as part of the mechanism for deciding to ignore them.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Can I manually fulfill feedback vector to achieve aot compilation?

2017-10-26 Thread Jakob Kummerow
No, it is not possible to populate the feedback vector manually. A lot of
its contents are pointers to dynamically generated objects on the heap.


On Thu, Oct 26, 2017 at 3:05 PM Bogdan Orlov  wrote:

> Is it possible to compile js code with TurboFan without running it in
> interpreter mode by manually fulfilling feedback vector by informations of
> types getting from typescript compiler? I so, is it possible to compile v8
> with my code without touching jit-system so I can run it on ios devices? I
> understand that without jit-system any deopts will be 'stop-the-world'
> error but this is not a problem when we have strict type system (therefore
> no more speculation on types which makes all deopts). Typescript of course
> has dynamic parts but this can be limited by adding restriction to linter
> and new types like smi and int32 to match v8 types
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Can somebody explain the --predictable flag?

2017-09-24 Thread Jakob Kummerow
Essentially, --predictable turns off anything in V8 that is known to cause
changes in behavior from one run to the next: multiple thread usage (it
restricts V8 to using *just one thread*, no background threads at all), the
random number generator in Math.random(), and anything else we could think
of (which I can't think of right now ;-) ). It is intended for debugging
flaky problems (by making them reproducible), but sometimes it has the side
effect of hiding flaky problems...

On Sun, Sep 24, 2017 at 8:52 PM, Brandon Jonson 
wrote:

> Hello All!
>
> I have V8 embedded in a multi threaded app. The app uses locker/unlocker
> and all seems to work just fine in those regards (no locker errors or full
> on app crashes). I do have an edge case though I thought I'd get some input
> on. If I basically pound the isolate (utilizing locker of course) from
> multiple threads v8 will eventually FREEZE on a resolve and never respond.
> Below is the line it freezes on...
>
> resolver->Resolve(String::NewFromUtf8(isolate, msg));
>
> It doesn't crash the app...it just won't ever move on from that line of
> code, waiting for V8. It's as if V8 decided to just not respond anymore but
> I'm not seeing any indication of an error. Also if I change this to an
> actual function call it will do the same thing (so not necessarily Promise
> related).
>
> The crazy thing is that when I add the --predictable flag that issue goes
> away. I understand they replaced set_max_available_threads, allowing the
> Platform to handle the work and that this --predictable flag basically
> forces the Platform to use one thread for background processes (I think).
> My assumption the freeze is occurring because of too many threads?
>
> Anyway I was hoping somebody a hell of a lot smarter than me could explain
> what this flag is changing and what fresh hell did I open myself up to by
> enabling it.
>
> Thank You!
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Is "extend" keyword a performance antipattern???

2017-09-24 Thread Jakob Kummerow
"extends" is not an anti-pattern.

Of course monomorphic code is fastest. Polymorphic/megamorphic loads and
stores have to do more work (specifically, dynamic dispatch), which is
going to take a bit more time. Class hierarchies are one way how developers
*can* create polymorphic code; what you have here is an example of that.
But that doesn't mean that inheritance itself is a problem, or that
polymorphism is a problem.

The reason this is different from C++ vtables is because JavaScript isn't
C++. JavaScript is a dynamic language, and engines must strike a balance
between achieving fast execution when the object hierarchies are not
modified much, and still having acceptable performance when developers make
use of JavaScript's dynamic capabilities and do modify the object hierarchy
at runtime. So engines should not have internal mechanics that are too
rigid, and would cause huge performance drops when code does something
valid but "unexpected". It's easy to point at one pattern and say "clearly
this should be handled better", but when you look at a variety of large
codebases, they use so many different patterns that it becomes very unclear
what internal object representation model would work best on average.

FWIW, the original example is essentially equivalent to simple
"traditional" polymorphic patterns like the following, which uses no
inheritance and no "extends":

function DoIt(obj) { obj.done++; }

function Cat() {}
function Dog() {}
// etc.

var c = new Cat();
DoIt(c);  // Only one type so far -> monomorphic
var d = new Dog();
DoIt(d);  // Two types -> polymorphic
// etc.

On Sun, Sep 24, 2017 at 3:51 PM, Caitlin Potter  wrote:

> So yes, the load/store for `this.done++` can't be reduced to simple
> machine ops when `doIt` is megamorphic, as far as I can tell. (5+ receiver
> maps should make the load/stores megamorphic, or at least that's what
> https://github.com/v8/v8/blob/9a0d5d9700ee269cbe7abee6d62733
> 163dadac14/src/ic/ic.h#L33-L35 seems to indicate).
>
> That doesn't necessarily mean LoadIC is going to be slow, I guess it
> depends on how often you the receiver map is missing from the cache. Slower
> than the inlined monomorphic in-object field load/store, but probably not
> "anti-pattern" slow.
>
> I could be wrong about this, but I think the CallIC for individual calls
> to `doIt` can be inlined with different type feedback information for the
> load/store, so if that shows up in hot code which is monomorphic or
> polymorphic, it might produce better code than your example there.
>
> That said, I'm half guessing about all of this, so I'll leave the rest of
> this thread for more knowledgeable people.
>
> On Sunday, September 24, 2017 at 12:07:58 PM UTC-4, Bogdan Orlov wrote:
>>
>> After removing all intermediate %OptimizeFunctionOnNextCall()  and
>> putting at the end (after usage of all Animal subclasses for enough
>> feedback) like this
>>
>> class Animal {
>>   constructor(){
>> this.done = 0
>>   }
>>   doIt(){
>> this.done++
>>   }
>> }
>> class Cat extends Animal {}
>> class Dog extends Animal {}
>> class Dog1 extends Animal {}
>> class Dog2 extends Animal {}
>> class Dog3 extends Animal {}
>>
>> function test(){
>>   var cat = new Cat();
>>   cat.doIt();
>>   cat.doIt();
>>   cat.doIt();
>>   var dog = new Dog();
>>   dog.doIt();
>>   dog.doIt();
>>   dog.doIt();
>>   var dog1 = new Dog1();
>>   dog1.doIt();
>>   dog1.doIt();
>>   dog1.doIt();
>>   var dog2 = new Dog2();
>>   dog2.doIt();
>>   dog2.doIt();
>>   dog2.doIt();
>>   var dog3 = new Dog3();
>>   dog3.doIt();
>>   dog3.doIt();
>>   dog3.doIt();
>>   %OptimizeFunctionOnNextCall(dog3.doIt)
>>   dog3.doIt()
>> }
>> test()
>>
>> I got this output:
>>
>> 0x2df967b05180 0  55 push rbp
>> 0x2df967b05181 1  4889e5 REX.W movq rbp,rsp
>> 0x2df967b05184 4  56 push rsi
>> 0x2df967b05185 5  57 push rdi
>> 0x2df967b05186 6  493ba5480c REX.W cmpq rsp,[r13+0xc48]
>> 0x2df967b0518d d  0f866900   jna 0x2df967b051fc  <+0x7c>
>> 0x2df967b0519313  488b75f8   REX.W movq rsi,[rbp-0x8]
>> 0x2df967b0519717  48b80300 REX.W movq rax,0x3
>> 0x2df967b051a121  488b5510   REX.W movq rdx,[rbp+0x10]
>> 0x2df967b051a525  498b8dd005 REX.W movq rcx,[r13+0x5d0]
>> 0x2df967b051ac2c  488bd9 REX.W movq rbx,rcx
>> 0x2df967b051af2f  e8ccd7f4ff call 0x2df967a52980
>> (LoadICTrampoline);; code: LOAD_IC
>> 0x2df967b051b434  a801   test al,0x1
>> 0x2df967b051b636  0f855700   jnz 0x2df967b05213  <+0x93>
>> 0x2df967b051bc3c  488bd8 REX.W movq rbx,rax
>> 0x2df967b051bf3f  48c1eb20   REX.W shrq rbx, 32
>> 0x2df967b051c343  83ebff subl rbx,0xff
>> 0x2df967b051c646  0f804c00   jo 0x2df967b05218  <+0x98>
>> 0x2df967b051cc4c  48c1e320   REX.W shlq rbx, 32
>> 0x2df967b051d050  48bf0500 REX.W movq rdi,0x5
>> 

Re: [v8-users] How to log javascript calls

2017-09-19 Thread Jakob Kummerow
See https://www.chromium.org/developers/how-tos/run-chromium-with-flags. In
short, run Chrome or Chromium with --js-flags="--trace". Prepare to see *a
lot* of output.

On Tue, Sep 19, 2017 at 3:02 PM, Huginn <saumya@gmail.com> wrote:

> I am not finding a way to where is the --trace flag supposed to be used?
> is there a guide somewhere...?
>
>
> Sorry for noob questions
>
> On Friday, September 1, 2017 at 11:08:49 AM UTC-5, Jakob Kummerow wrote:
>>
>> Have you found the existing --trace flag? Does it fit your needs?
>>
>> On Fri, Sep 1, 2017 at 8:45 AM, Huginn <saumy...@gmail.com> wrote:
>>
>>> Hi, I would like to be able to make a patch that allows one to log all
>>> javascript calls when loading a webpage. I was wondering what resources i
>>> would need to look at to achieve this. Thanks
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: View assembly code for built in functions

2017-09-18 Thread Jakob Kummerow
ArrayPush is implemented in C++, see src/builtins/builtins-array.cc. The
code object you've disassembled is a small wrapper/trampoline stub, the
first step in the C++ entry sequence.

In general, there is no single way to inspect "built-in functions", because
there are several ways to implement them (a few are still in handwritten
assembly; many are in C++ [exposed as "runtime functions" or "builtins"]
and CodeStubAssembler; some are in JavaScript), and that implies different
ways to dump their code. Many functions also have several implementations,
e.g. a fast path in a generated stub (FastArrayPush is an example), with a
C++ fallback for non-fast cases.

On Mon, Sep 18, 2017 at 5:40 AM, Rong Jie  wrote:

> You need to build V8 with v8_enable_disassembler enabled (disabled by
> default in release build). See https://cs.chromium.org/
> chromium/src/v8/BUILD.gn?type=cs=v8_enable_disassembler
>
>
> On Monday, September 18, 2017 at 5:23:09 PM UTC+8, Marija wrote:
>>
>> Hi,
>>
>> Is it possible to see generated assembly code for built-in functions? If
>> I use just print_code with a simple program, like [].push(1), nothing is
>> generated.
>> Is --print_builtin_code flag the right thing to use? For array push the
>> output looks like:
>>
>> kind = BUILTIN
>> name = ArrayPush
>> compiler = unknown
>> Instructions (size = 10)
>> 0x246f7340 0  bb20c45908 mov ebx,0x859c420   ;; external
>> reference (Builtin_ArrayPush)
>> 0x246f7345 5  e9f682feff jmp 0x246df640
>>  (AdaptorWithBuiltinExitFrame);; code: BUILTIN
>>
>>
>> RelocInfo (size = 3)
>> 0x246f7341  external reference (Builtin_ArrayPush)  (0x859c420)
>> 0x246f7346  code target (BUILTIN)  (0x246df640)
>>
>> There is another code for FastArrayPush.
>>
>> Can you also help me to understand the output if the flag
>> --print_builtin_code is the right thing to use?
>>
>> Thanks!
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Building v8 5.9 on Centos 6

2017-09-08 Thread Jakob Kummerow
GCC 4.8.4 definitely works, so 4.8.2 is probably fine too.

On Fri, Sep 8, 2017 at 2:57 AM, Chris Hillery  wrote:

> Thanks for the reply, Jakob. As I mentioned, I do have gcc 4.8.2 already
> running on Centos 6, which should be new enough to build v8 5.9, correct?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How does V8 compiles and executes JavaScript events?

2017-09-05 Thread Jakob Kummerow
On Mon, Sep 4, 2017 at 4:07 PM, Hanyun Tao <taohany...@gmail.com> wrote:

> Hi Jakob!
>
> I'm reading the Invoke(..) function you mentioned, and I believe the
> following part of the code plays an important role in executing the
> JavaScript but I cannot fully understand it.
>
>   typedef Object* (*JSEntryFunction)(Object* new_target, Object* target,
>  Object* receiver, int argc,
>  Object*** args);
>
>
>   Handle code = is_construct
>   ? isolate->factory()->js_construct_entry_code()
>   : isolate->factory()->js_entry_code();
>
>
>   {
> // Save and restore context around invocation and block the
> // allocation of handles without explicit handle scopes.
> SaveContext save(isolate);
> SealHandleScope shs(isolate);
> JSEntryFunction stub_entry = FUNCTION_CAST(code->
> entry());
>
>
> if (FLAG_clear_exceptions_on_js_entry) isolate->clear_pending_
> exception();
>
>
> // Call the function through the right JS entry stub.
> Object* orig_func = *new_target;
> Object* func = *target;
> Object* recv = *receiver;
> Object*** argv = reinterpret_cast<Object***>(args);
> if (FLAG_profile_deserialization && target->IsJSFunction()) {
>   PrintDeserializedCodeInfo(Handle::cast(target));
> }
> RuntimeCallTimerScope timer(isolate, ::JS_Execution);
> value = CALL_GENERATED_CODE(isolate, stub_entry, orig_func, func, recv
> ,
> argc, argv);
>   }
>
>
> I could not find some good document to help me understand those data
> structures especially JSEntryFunction ,and Handle.  It would be
> really helpful if you can give me some document that talks about the
> definition of V8's basic data structures like Code.
>

Code:
https://cs.chromium.org/chromium/src/v8/src/objects.h?type=cs=class+code=package:chromium=3646
(as the name suggests, it's the kind of object V8 uses to store generated
code)
Handle:
https://cs.chromium.org/chromium/src/v8/src/handles.h?type=cs=class+Handle=package:chromium=92
(a GC safe pointer to a HeapObject)

Look around the code for more! :-)

For the functionality of the above code, here is my understanding (guess).
>
> The first part of the code defines a special type of object named
> JSEntryFunction.
>

That's a C++ typedef defining a particular (C++) function signature.

The next part of the code tries to obtain the executable code by calling
> isolate->factory()->js_entry_code();  , which might be the part that
> triggers the (re-)compilation or finds the existing compiled code.
>

No, it's the "stub" that handles calling into generated code. The function
being called is target, and as you can see, it is passed as an argument to
the call.
"Invoke" does not deal with compilation. As I wrote before:

> a v8::internal::JSFunction has a code() property. That's either the
> existing compiled code, or a stub that will trigger (re-)compilation based
> on the script() in the JSFunction's shared_function_info(). It will be
> retrieved and called by the JSEntryStub.

You've identified the place where the JSEntryStub is called. That stub will
look up the function's stored code and call it. This "code" could be
another stub that triggers compilation if needed.

The reset of the code executes the generated code.
>
> Could you please verify if my understanding is correct?
>
> Thanks a lot!
>
> On Thursday, August 31, 2017 at 3:36:53 PM UTC-4, Jakob Kummerow wrote:
>>
>> A v8::Function maps to a v8::internal::JSFunction, which has a code()
>> property. That's either the existing compiled code, or a stub that will
>> trigger (re-)compilation based on the script() in the JSFunction's
>> shared_function_info(). It will be retrieved and called by the
>> JSEntryStub.
>>
>> You might want to put your instrumentation into Invoke(...) in
>> execution.cc.
>>
>> On Thu, Aug 31, 2017 at 11:56 AM, Hanyun Tao <taoha...@gmail.com> wrote:
>>
>>> Hi Jakob,
>>>
>>> Thank you for answering my questions!
>>>
>>> I would like to modify V8's internals to support such functionality. But
>>> before I start I would like to learn a little more about how chromium
>>> interact with V8 to process JavaScript event.
>>>
>>> By reading the source code, I believe that the WebKit rendering engine
>>> will call *v8::Function::Call* in api.cc, and after that the V8 engine
>>> will execute the Javascript code. Am I correct?
>>>
>>> If this is how things going to work, could you please point out where in
&g

Re: [v8-users] Why element kind transition can't cause the cache to miss

2017-09-05 Thread Jakob Kummerow
What cache are you talking about?

Different elements kinds do cause inline cache misses.

On Tue, Sep 5, 2017 at 3:08 AM, cyril  wrote:

> Hi all,
>
> Why element kind transition can't cause the cache to miss?
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to log javascript calls

2017-09-01 Thread Jakob Kummerow
Have you found the existing --trace flag? Does it fit your needs?

On Fri, Sep 1, 2017 at 8:45 AM, Huginn  wrote:

> Hi, I would like to be able to make a patch that allows one to log all
> javascript calls when loading a webpage. I was wondering what resources i
> would need to look at to achieve this. Thanks
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How does V8 compiles and executes JavaScript events?

2017-08-31 Thread Jakob Kummerow
A v8::Function maps to a v8::internal::JSFunction, which has a code()
property. That's either the existing compiled code, or a stub that will
trigger (re-)compilation based on the script() in the JSFunction's
shared_function_info(). It will be retrieved and called by the JSEntryStub.

You might want to put your instrumentation into Invoke(...) in execution.cc.

On Thu, Aug 31, 2017 at 11:56 AM, Hanyun Tao <taohany...@gmail.com> wrote:

> Hi Jakob,
>
> Thank you for answering my questions!
>
> I would like to modify V8's internals to support such functionality. But
> before I start I would like to learn a little more about how chromium
> interact with V8 to process JavaScript event.
>
> By reading the source code, I believe that the WebKit rendering engine
> will call *v8::Function::Call* in api.cc, and after that the V8 engine
> will execute the Javascript code. Am I correct?
>
> If this is how things going to work, could you please point out where in
> this process, V8 compiles the code, or "read" the compiled code correspond
> to the JavaScript?
>
> Thank you!
>
> On Wednesday, August 30, 2017 at 8:39:00 PM UTC-4, Jakob Kummerow wrote:
>>
>> Object addresses are not exposed either. You would have to build such
>> instrumentation into V8's internals.
>>
>> On Tue, Aug 29, 2017 at 12:32 PM, Hanyun Tao <taoha...@gmail.com> wrote:
>>
>>> Thank you Jakob!
>>>
>>> I can understand why it is hidden from external access. But would it be
>>> possible for the user to get access to the instruction addresses of the
>>> compiled code?
>>>
>>> We are studying the cache performance of JavaScript execution and we
>>> want to know if it is possible to prefetch the instructions in the next
>>> event handlers into the cache before it is executed based on the
>>> information collected in the v8 engine.
>>>
>>> Best regards,
>>>
>>> On Tuesday, August 29, 2017 at 12:29:33 PM UTC-4, Jakob Kummerow wrote:
>>>>
>>>> No, compiled code is an internal implementation detail and as such is
>>>> hidden from JavaScript and other external access. If there ever is a way
>>>> for users to get to compiled code, then it's a (probably severe security)
>>>> bug and we would like to hear about it! :-)
>>>>
>>>> On Mon, Aug 28, 2017 at 9:03 PM, Hanyun Tao <taoha...@gmail.com> wrote:
>>>>
>>>>> Hi Jakob,
>>>>>
>>>>> Thanks again!
>>>>>
>>>>> According to what you have said, v8 compiles the event handlers are
>>>>> installed(compiled?) before it is executed. If it is true, then I believe
>>>>> v8 will store the compiled code somewhere in the system.
>>>>> Would it be possible for the user to get access to the compiled code?
>>>>>
>>>>> Best regards,
>>>>>
>>>>> On Monday, August 28, 2017 at 1:29:29 PM UTC-4, Jakob Kummerow wrote:
>>>>>>
>>>>>> The main API entry point for compilation is
>>>>>> v8::ScriptCompiler::Compile().
>>>>>>
>>>>>> I don't think event handling itself triggers compilation; but I'm not
>>>>>> an expert on that part of the system. AFAIK event handlers are installed
>>>>>> during page load (or more precisely: DOM element creation); they may 
>>>>>> still
>>>>>> be compiled on-demand on first use but that's not controlled via the V8 
>>>>>> API.
>>>>>>
>>>>>> On Mon, Aug 28, 2017 at 9:06 AM, Hanyun Tao <taoha...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Jakob,
>>>>>>>
>>>>>>> Thank you for replying!
>>>>>>>
>>>>>>> To be more specific, I'm looking for the point (function) that
>>>>>>> initiate the compilation process.
>>>>>>>
>>>>>>> In my understanding, when handling an "event", the renderer process
>>>>>>> in the browser will figure out the JavaScript related to the event, and 
>>>>>>> ask
>>>>>>> the V8 engine to execute it by calling some api function.
>>>>>>>
>>>>>>> Inside those api function, there should be a point where V8 initiate
>>>>>>> the compilation process, and that is what I'm looking for.
>>>>>>>
>>>>

Re: [v8-users] v8 6.0.286.52 test-unboxed-doubles.cc is failing.

2017-08-04 Thread Jakob Kummerow
All tests are important. And all the test-unboxed-doubles tests pass with a
regular build (Release or Debug) of the unmodified sources at that revision.

I would suggest that you try to narrow down which difference between your
build and the official build causes these tests to fail. (Is it gcc vs.
clang? is it one of your patches? is it one of your build settings? All of
these seem unlikely, but there must be a difference *somewhere*.)

On Fri, Aug 4, 2017 at 9:32 AM,  wrote:

> I managed to build v8 on arch linux using gcc7, here you can find the full
> configuration for the package: https://aur.archlinux.org/packages/v8/
>
> I've used this patch for building on gcc7: https://github.com/
> nodejs/node/commit/d9a8f80c0dea64d7c95eac48f8f57d7a25ea7edf
>
> this is my rendition of the patch, had to change one hunk:
>
> compile-patch: https://aur.archlinux.org/cgit/aur.git/
> tree/gcc7.patch?h=v8=3bd1540d3de247333eeebc5de5e1534f710da314
>
> But i had to cut also a function and a test to make the package compile
> and test:
> test-patch: https://aur.archlinux.org/cgit/aur.git/tree/ctest.patch?
> h=v8=3bd1540d3de247333eeebc5de5e1534f710da314
>
> My question is: is this test important?
>
> The test is failing giving a stacktrace: failing on line 144 of
> text-unboxed-doubles.cc
>
> Do you need the stacktrace to confirm ?
>
>
>
> === cctest/test-unboxed-doubles/LayoutDescriptorBasicFast ===
> #
> # Fatal error in ../../test/cctest/test-unboxed-doubles.cc, line 144
> # Check failed: layout_desc->IsFastPointerLayout().
> #
>
>  C stack trace ===
>
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(v8::base::debug::StackTrace::StackTrace()+0xe) [0x7fc27d11729e]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libplatform.so(+0x5073) [0x7fc27d0f8073]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(V8_Fatal+0xe2) [0x7fc27d114822]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0xbc68da)
> [0xf5449f78da]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x7ef53a)
> [0xf54462053a]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x79f870)
> [0xf5445d0870]
> /usr/lib/libc.so.6(__libc_start_main+0xea) [0x7fc27b6c44ca]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x7ef19a)
> [0xf54462019a]
> Received signal 6
> Command: /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest
> --random-seed=-742090116 test-unboxed-doubles/LayoutDescriptorBasicFast
> --nohard-abort --nodead-code-elimination --nofold-constants
>
>
>
> [00:03|%   0|+  14|-   1]: debugger/debug/ignition/debug-
> step-prefix-byteco...
>
>
> [00:03|%   0|+  15|-   1]: debugger/debug/debug-stepout-scope-part6
>
> [00:03|%   0|+  16|-   1]: debugger/debug/debug-stepout-scope-part3
>
> [00:03|%   0|+  17|-   1]: debugger/debug/debug-scopes
>
> [00:03|%   0|+  17|-   2]: cctest/test-unboxed-doubles/
> LayoutDescriptorBasi...
>
>
> === cctest/test-unboxed-doubles/LayoutDescriptorBasicFast ===
> #
> # Fatal error in ../../test/cctest/test-unboxed-doubles.cc, line 144
> # Check failed: layout_desc->IsFastPointerLayout().
> #
>
>  C stack trace ===
>
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(v8::base::debug::StackTrace::StackTrace()+0xe) [0x7f999eaab29e]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libplatform.so(+0x5073) [0x7f999ea8c073]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(V8_Fatal+0xe2) [0x7f999eaa8822]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0xbc68da)
> [0xe3a8e358da]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x7ef53a)
> [0xe3a8a5e53a]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x79f870)
> [0xe3a8a0e870]
> /usr/lib/libc.so.6(__libc_start_main+0xea) [0x7f999d0584ca]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest(+0x7ef19a)
> [0xe3a8a5e19a]
> Received signal 6
> Command: /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/cctest
> --random-seed=-742090116 --no-turbo 
> test-unboxed-doubles/LayoutDescriptorBasicFast
> --nohard-abort --nodead-code-elimination --nofold-constants
>
>
>
> [00:03|%   0|+  17|-   3]: cctest/test-unboxed-doubles/
> LayoutDescriptorHelp...
>
>
> === cctest/test-unboxed-doubles/LayoutDescriptorHelperAllDoubles ===
> #
> # Fatal error in ../../test/cctest/test-unboxed-doubles.cc, line 1253
> # Check failed: first_non_tagged_field_offset == end_of_region_offset.
> #
>
>  C stack trace ===
>
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(v8::base::debug::StackTrace::StackTrace()+0xe) [0x7f5fcd66629e]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libplatform.so(+0x5073) [0x7f5fcd647073]
> /home/marcs/DevLab/aur/v8/src/v8/out.gn/Release/./libv8_
> libbase.so(V8_Fatal+0xe2) [0x7f5fcd663822]
>  

Re: [v8-users] Error graph-builder-tester.h:172:56: error: no matching function for call to 'v8::internal::compiler::SimplifiedOperatorBuilder::ChangeFloat64ToTagged()' when trying to build V8 with GC

2017-08-02 Thread Jakob Kummerow
On Wed, Aug 2, 2017 at 1:04 PM, Georgi Sotirov  wrote:

> Yes, sure. We have gcc-4.8 bots on our waterfall and they're happy. Feel
>> free to submit a patch  for
>> gcc-7.1 support :-)
>>
>
> GCC 4.8 is at least 4 years old and as I see in GitHub V8 is under very
> active development, so strange that only newer GCC versions are not
> considered...
>

GCC 4.8 is what ships in Ubuntu Trusty, which is still our main development
platform. Usually ensuring that older toolchains are still supported is
more difficult (and hence more important) than supporting newer toolchains.
Most people build with the bundled clang; GCC support is mostly community
driven at this point. The fact that it has been broken for a while until
you found it tells you how few people care about it...


> A patch commenting out the offending function? OK, I could submit such
> patch, but I'm not sure this is the right solution and I do not know V8's
> source at all to make a real fix.
>

Unused functions, especially in tests, can just be deleted. (No point in
commenting out code that doesn't work, just drop it.)


> When I asked about version, I did mean version, not cloning instructions.
>> "fetch v8" gives you a different thing every day, because V8 is under
>> active development. (You can "git pull && gclient sync" to stay up to date
>> after the initial "fetch v8".)
>>
>
> Yes, I got you point, but I find V8 version numbering as confusing as the
> official documentation and the procedure
>  I
> referred was the only one working for me so far. And I pretty much
> understand what cloning means, so at least it's clear the problem is in the
> most recent source. However, I'm just trying to build V8 library without
> having to read tons of documentation and learning new tools (mostly used
> internally in Google as it seems), because V8 is not my primary development
> interest, but just a dependency I need to satisfy.
>

I wasn't asking you to learn any new tool or understand V8 version
numbering. I was just saying: next time you report a problem, please
indicate the version you were using. The git hash of your most recent
commit is perfectly fine for that.


> Anyway, now that I was able to build V8 with the help of the people from
> this group (including you) how could I install it? There is no "make
> install":
>
> $ make install
> $ make: *** No rule to make target 'install'.  Stop.
>
>
Indeed, there is no "make install". V8 is designed to be embedded/bundled;
installing it as a system library does not make much sense.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Error graph-builder-tester.h:172:56: error: no matching function for call to 'v8::internal::compiler::SimplifiedOperatorBuilder::ChangeFloat64ToTagged()' when trying to build V8 with GC

2017-08-01 Thread Jakob Kummerow
Feel free to delete the offending function
(in test/cctest/compiler/graph-builder-tester.h:171-173), it doesn't seem
to be used (which is presumably why clang doesn't complain here).

Also, next time, please indicate the version of V8 that you're compiling.

On Tue, Aug 1, 2017 at 8:40 AM, Georgi Sotirov  wrote:

> Hello,
>
> I'm trying to build V8 with the following command:
>
> time make V=1 ia32.release GYPFLAGS='-Dclang=0 -Dwerror=
> -Dcomponent=shared_library'
>
> with GCC 7.1.0, but I'm stuck with the following error:
>
> g++ '-DV8_GYP_BUILD' '-DCR_CLANG_REVISION=308728-3'
> '-DV8_TARGET_ARCH_IA32' '-DENABLE_GDB_JIT_INTERFACE'
> '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS'
> '-DV8_INTL_SUPPORT' '-DV8_USE_EXTERNAL_STARTUP_DATA'
> '-DV8_CHECK_MICROTASKS_SCOPES_CONSISTENCY' '-DBUILDING_V8_SHARED'
> '-DUSING_V8_BASE_SHARED' '-DUSING_V8_PLATFORM_SHARED'
> '-DENABLE_HANDLE_ZAPPING' -I../. -I../include  -Wall -Wno-unused-parameter
> -pthread -Wmissing-field-initializers -Wno-strict-overflow 
> -fno-strict-aliasing
> -fvisibility=hidden -fPIC -Wno-uninitialized -B/usr/src/v8/third_party/
> binutils/Linux_ia32/Release/bin -msse2 -mfpmath=sse -mmmx -B/usr/src/v8/
> third_party/binutils/Linux_ia32/Release/bin -msse2 -mfpmath=sse -mmmx -m32
> -m32 -fdata-sections -ffunction-sections -O3 -fdata-sections 
> -ffunction-sections
> -O3 -Wnon-virtual-dtor -fno-exceptions -fno-rtti -std=gnu++11 -MMD -MF /
> usr/src/v8/out/ia32.release/.deps//usr/src/v8/out/ia32.
> release/obj.target/cctest/test/cctest/compiler/test-js-context-specialization.o.d.raw
>   -c -o /usr/src/v8/out/ia32.release/obj.target/cctest/test/cctest/
> compiler/test-js-context-specialization.o ../test/cctest/compiler/test-
> js-context-specialization.cc
> In file included from ../test/cctest/compiler/test-js-context-
> specialization.cc:16:0:
> .././test/cctest/compiler/graph-builder-tester.h: In member function 
> 'v8::internal::compiler::Node*
> v8::internal::compiler::GraphBuilderTester
> ::ChangeFloat64ToTagged(v8::internal::compiler::Node*)':
> .././test/cctest/compiler/graph-builder-tester.h:172:56: error: no
> matching function for call to 'v8::internal::compiler::
> SimplifiedOperatorBuilder::ChangeFloat64ToTagged()'
>  return NewNode(simplified()->ChangeFloat64ToTagged(), a);
> ^
> In file included from .././test/cctest/compiler/graph-builder-tester.h:15:
> 0,
>  from ../test/cctest/compiler/test-js-context-
> specialization.cc:16:
> .././src/compiler/simplified-operator.h:409:19: note: candidate: const v8
> ::internal::compiler::Operator* v8::internal::compiler::Simpli
> fiedOperatorBuilder::ChangeFloat64ToTagged(v8::internal::compiler::
> CheckForMinusZeroMode)
>const Operator* ChangeFloat64ToTagged(CheckForMinusZeroMode);
>^
> .././src/compiler/simplified-operator.h:409:19: note:   candidate expects
> 1 argument, 0 provided
> make[1]: *** [test/cctest/cctest.target.ia32.release.mk:386: /usr/src/v8/
> out/ia32.release/obj.target/cctest/test/cctest/compiler/test-js-context-
> specialization.o] Error 1
> rm bdc92efe44eca1954fdff70fd086c7e138d0fbb1.intermediate
> make[1]: Leaving directory '/usr/src/v8/out'
> make: *** [Makefile:315: ia32.release] Error 2
>
> Any help is appreciated.
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Build V8 on linux with GCC and system headers

2017-07-31 Thread Jakob Kummerow
On Mon, Jul 31, 2017 at 11:24 AM, Georgi Sotirov 
wrote:

> Arg... Any way to disable turning of warnings to errors?
>>
>
> Found it myself :-)
>
> make ia32.release GYPFLAGS='-Dclang=0 -Dwerror='
>
> ...or simply: make ia32.release werror=no

are these flags described somewhere?
>

Yes, in the Makefile
 :-)

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Build V8 on linux with GCC and system headers

2017-07-31 Thread Jakob Kummerow
To use the system compiler, try:

$ make ia32.release GYPFLAGS=-Dclang=0

I don't know whether it will also use system headers though.

(Also note that the make/GYP-based build is deprecated. The new hotness is
"gn"; see the wiki  for
instructions. tools/dev/gm.py gives you an experience that's very similar
to the Makefile.)


On Mon, Jul 31, 2017 at 9:49 AM, Georgi Sotirov  wrote:

> Is there a way to build V8 natively on linux with system's compiler (GCC),
> library and headers? How to make the build use GCC, system headers from
> /usr/include, instead of /usr/src/v8/build/linux/debian_jessie_i386-
> sysroot/usr/?
>
> $ time make ia32.release
> PYTHONPATH="/usr/src/v8/tools/generate_shim_headers:/usr/
> src/v8/gypfiles::/usr/src/v8/tools/gyp/pylib:" \
> GYP_GENERATORS=make \
> tools/gyp/gyp --generator-output="out" gypfiles/all.gyp \
>   -Igypfiles/standalone.gypi --depth=. \
>   -Dv8_target_arch=ia32 \
> -Dtarget_arch=ia32 \
>\
>   -S.ia32.release  -Dv8_enable_backtrace=1 -Darm_fpu=default -
> Darm_float_abi=default
> make[1]: Entering directory '/usr/src/v8/out'
>   ACTION Generating inspector protocol sources from protocol json
> definition /usr/src/v8/out/ia32.release/obj/gen/src/js_protocol.stamp
>   TOUCH /usr/src/v8/out/ia32.release/obj.target/src/inspector/protoc
> ol_compatibility.stamp
>   TOUCH bdc92efe44eca1954fdff70fd086c7e138d0fbb1.intermediate
>   ACTION Generating inspector protocol sources from protocol json
> bdc92efe44eca1954fdff70fd086c7e138d0fbb1.intermediate
>   TOUCH /usr/src/v8/out/ia32.release/obj.target/src/inspector/protoc
> ol_generated_sources.stamp
>   ACTION src_inspector_inspector_gyp_inspector_injected_script_
> target_convert_js_to_cpp_char_array /usr/src/v8/out/ia32.release/obj/gen/
> src/inspector/injected-script-source.h
>   TOUCH /usr/src/v8/out/ia32.release/obj.target/src/inspector/inspec
> tor_injected_script.stamp
>   ACTION src_inspector_inspector_gyp_inspector_debugger_script_
> target_convert_js_to_cpp_char_array /usr/src/v8/out/ia32.release/obj/gen/
> src/inspector/debugger-script.h
>   TOUCH /usr/src/v8/out/ia32.release/obj.target/src/inspector/inspec
> tor_debugger_script.stamp
>   CXX(target) /usr/src/v8/out/ia32.release/obj.target/v8_base/gen/src/insp
> ector/protocol/Protocol.o
> In file included from /usr/src/v8/out/ia32.release/obj/gen/src/inspector/
> protocol/Protocol.cpp:7:
> In file included from /usr/src/v8/out/ia32.release/obj/gen/src/inspector/
> protocol/Protocol.h:8:
> In file included from /usr/src/v8/out/ia32.release/obj/gen/src/inspector/
> protocol/Forward.h:8:
> In file included from .././src/inspector/string-util.h:8:
> In file included from /usr/src/v8/build/linux/debian_jessie_i386-sysroot/
> usr/lib/gcc/i586-linux-gnu/4.8/../../../../include/c++/4.8/memory:72:
> In file included from /usr/src/v8/build/linux/debian_jessie_i386-sysroot/
> usr/lib/gcc/i586-linux-gnu/4.8/../../../../include/c++/4.8/iosfwd:40:
> In file included from /usr/src/v8/build/linux/debian_jessie_i386-sysroot/
> usr/lib/gcc/i586-linux-gnu/4.8/../../../../include/c++/4.8/bits/postypes.h
> :40:
> In file included from /usr/src/v8/build/linux/debian_jessie_i386-sysroot/
> usr/lib/gcc/i586-linux-gnu/4.8/../../../../include/c++/4.8/cwchar:44:
> /usr/src/v8/build/linux/debian_jessie_i386-sysroot/usr/include/wchar.h:39:
> 11: fatal error: 'stdarg.h' file not found
> # include 
>   ^~
> 1 error generated.
> make[1]: *** [src/v8_base.target.ia32.release.mk:725: /usr/src/v8/out/ia32
> .release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o] Error 1
> rm bdc92efe44eca1954fdff70fd086c7e138d0fbb1.intermediate
> make[1]: Leaving directory '/usr/src/v8/out'
> make: *** [Makefile:315: ia32.release] Error 2
>
> For information I'm trying to build on Slackware Linux.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Can you Set the CurrentIsolate

2017-07-28 Thread Jakob Kummerow
On Fri, Jul 28, 2017 at 12:36 PM, Ian Bull  wrote:

> The problem with Enter() is that if you're already Entered, now you're in
> there twice. So if it's a patchwork solution that checks if the MyIsolate
> != Isolate::GetCurrent, and then calls MyIsolate->Enter(), I could started
> entering an unknown number of times (I may already be entered, just not the
> "current one"). This blows up later on when you try to Dispose() the
> isolate. Of course I could track the number of times I performed this
> patchwork solution, and before Dispose is called, I could call Exit() that
> number of times, but now were really getting hacky.
>
> I was hoping for an easy way to tell V8 that "this isolate" is the
> current, without any side effects.
>

Enter() and Exit() are the way to do this. They should always show up in
pairs, and then no "patchwork solution" should be necessary. E.g. if your
callback Enter()s another Isolate, it should afterwards Exit() from that
Isolate again, which will restore the previous state. In other words,
consider the following sequence:

Isolate* A ...;

A->Enter();
// A == Isolate::GetCurrent()
...
Isolate* B ...;
B->Enter();
// B == Isolate::GetCurrent()
...
B->Exit();
// A == Isolate::GetCurrent(), no second call to A->Enter() is necessary



>
> On Fri, 28 Jul 2017 at 12:28 Zac Hansen  wrote:
>
>> This is just a guess, but does v8::Isolate::Enter do it?
>>
>> https://v8.paulfryzel.com/docs/master/classv8_1_1_isolate.html#
>> aec80bb49b6b7647ff75e8f2cc9484ea3
>>
>>
>>
>> On Friday, July 28, 2017 at 11:56:16 AM UTC-7, Ian Bull wrote:
>>>
>>> I know Isolate::GetCurrent is deprecated, but it's still being used
>>> inside V8 itself in places, and there are times when it's getting the wrong
>>> isolate. [1] for example.
>>>
>>> [1] String::Value::Value(v8::Local obj) : str_(NULL),
>>> length_(0)  // in api.cc
>>>
>>> I created Isolate A, and inside a callback, I create some new Isolates,
>>> Lock and Unlock. Then when I return from the callback, the
>>> Isolate::GetCurrent no longer points to Isolate A, and in some cases points
>>> to null. I am always tracking which Isolate I'm using, and it's pretty easy
>>> to detect that the wrong "current isolate" is set. Is there a way to tell
>>> V8 that Isolate::GetCurrent should now point to a particular Isolate?
>>>
>>> Cheers,
>>> Ian
>>>
>> --
>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is it safe to consume v8::Private methods?

2017-07-14 Thread Jakob Kummerow
Gautham, I think you might be misunderstanding how the Maybe<> API is
supposed to be used. When used correctly, it is absolutely safe and will
never crash.

- Maybe::FromJust() / MaybeLocal::ToLocalChecked() are intended for when
you know for sure that the Maybe / MaybeLocal is not empty. Usually, the
only case when you would know that is when you've just checked.
- Maybe::IsNothing() / Maybe::IsJust() / MaybeLocal::IsEmpty() are intended
for doing precisely that check.

Typical usage looks like:

MaybeLocal result = ...;
if (result.IsEmpty()) {
  // Handle error case, e.g. print a warning.
  return false;
} else {
  // .ToLocalChecked is safe to use here :-)
  do_something_with(result.ToLocalChecked());
}

For convenience, there are also the Maybe::FromMaybe() /
MaybeLocal::ToLocal() helpers:

Maybe maybe_x = ...;
int x = maybe_x.FromMaybe(-1);
// same as:
// int x = maybe_x.IsJust() ? maybe_x.FromJust() : -1;

Of course you can also use Private Symbols if you prefer; but there's
really no reason to avoid private fields for stability reasons.

Hope this helps,
Jakob

On Fri, Jul 14, 2017 at 12:00 AM, Ben Noordhuis  wrote:

> On Fri, Jul 14, 2017 at 5:52 AM, Gautham B A
>  wrote:
> > No, .ToLocalChecked() is called by my code, not from V8.
> >
> > I would like to know if the APIs under v8::Private namespace has been
> battle
> > tested.
>
> Node.js uses them and I'm fairly sure Chromium does too, so yes, I
> think you can say it's battle tested.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] question on the sample file process.cc

2017-07-02 Thread Jakob Kummerow
If you look at the source of gin::V8ToString, you will see that it only
handles string arguments. Try output[request.host] = "1", or consider using
a map<std::string, int>, or change your implementation to perform
number-to-string conversions as needed.

On Fri, Jun 30, 2017 at 10:38 PM, wxz <xzwang2...@gmail.com> wrote:

> Thanks for the explanation, but it's still blur to me.  I'm trying to wrap
> those two maps into an interceptor class.  Please see the attached.  It
> works for lines such as:
> if (option.verbose)
>
> but it fails on lines:
> output[request.host] = 1;
>
> The script runs, but the final output is:
> google.com:
> google.net:
> google.org:
> yahoo.com:
>
> Instead, the correct result should be:
> google.com: 1
> google.net: 1
> google.org: 1
> yahoo.com: 3
>
> On Friday, June 30, 2017 at 11:21:11 AM UTC-4, Jakob Kummerow wrote:
>>
>> There are no conversions happening. In the script, "output" is a regular
>> JavaScript object, with all the behavior you would expect.
>>
>> On the C++ side, "output" is a map<string, string>, but "output_obj" is
>> a JavaScript object created from that map (via the WrapMap(output)
>> call), and that's what's exposed to the script.
>>
>>
>> On Fri, Jun 30, 2017 at 3:31 PM, wxz <xzwan...@gmail.com> wrote:
>>
>>> a follow up question, in the script, the 'output' map is used as
>>> map<string, int>:
>>>
>>> output[request.host] = 1;
>>> output[request.host]++
>>>
>>> however, it's a map<string, string> in c++ side, which part of the c++
>>> code handles such conversion?
>>>
>>>
>>> On Thursday, June 29, 2017 at 5:07:20 PM UTC-4, Jakob Kummerow wrote:
>>>
>>>> The equivalent of options.verbose is options["verbose"] (note the
>>>> quotes). Does that help?
>>>>
>>>> On Thu, Jun 29, 2017 at 10:07 PM, wxz <xzwan...@gmail.com> wrote:
>>>>
>>>>> hi all,
>>>>>
>>>>> there are two maps used in this example, one for 'options', one for
>>>>> 'output'. My question is, why is that in the script, the brackets [] works
>>>>> for 'output', but not for 'options'?
>>>>>
>>>>> For example, if change the line:
>>>>> options.verbose  ===> options[verbose]
>>>>> it returns error: verbose is not defined
>>>>>
>>>>> However, 'output[request.host]' is perfectly fine.
>>>>>
>>>>> The two maps are installed with the same code, the wrap/unwrap are the
>>>>> same, what's the difference?
>>>>>
>>>>> I guess my confusion is what exactly does bracket mean here? Does it
>>>>> invoke the named property interceptor?
>>>>>
>>>>> --
>>>>> --
>>>>> v8-users mailing list
>>>>> v8-u...@googlegroups.com
>>>>> http://groups.google.com/group/v8-users
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "v8-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to v8-users+u...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] question on the sample file process.cc

2017-06-30 Thread Jakob Kummerow
There are no conversions happening. In the script, "output" is a regular
JavaScript object, with all the behavior you would expect.

On the C++ side, "output" is a map<string, string>, but "output_obj" is a
JavaScript object created from that map (via the WrapMap(output) call), and
that's what's exposed to the script.


On Fri, Jun 30, 2017 at 3:31 PM, wxz <xzwang2...@gmail.com> wrote:

> a follow up question, in the script, the 'output' map is used as
> map<string, int>:
>
> output[request.host] = 1;
> output[request.host]++
>
> however, it's a map<string, string> in c++ side, which part of the c++
> code handles such conversion?
>
>
> On Thursday, June 29, 2017 at 5:07:20 PM UTC-4, Jakob Kummerow wrote:
>
>> The equivalent of options.verbose is options["verbose"] (note the
>> quotes). Does that help?
>>
>> On Thu, Jun 29, 2017 at 10:07 PM, wxz <xzwan...@gmail.com> wrote:
>>
>>> hi all,
>>>
>>> there are two maps used in this example, one for 'options', one for
>>> 'output'. My question is, why is that in the script, the brackets [] works
>>> for 'output', but not for 'options'?
>>>
>>> For example, if change the line:
>>> options.verbose  ===> options[verbose]
>>> it returns error: verbose is not defined
>>>
>>> However, 'output[request.host]' is perfectly fine.
>>>
>>> The two maps are installed with the same code, the wrap/unwrap are the
>>> same, what's the difference?
>>>
>>> I guess my confusion is what exactly does bracket mean here? Does it
>>> invoke the named property interceptor?
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Announcement: V8's x87 port is going away

2017-06-30 Thread Jakob Kummerow
Ever since V8's "ia32" port (for 32-bit x86 platforms) has started
requiring SSE2 instruction support in 2014, there has been an "x87" port to
allow V8 to continue to run on x86 hardware that does not support SSE2
instructions.

Due to a lack of stakeholders in the "x87" port, and the ongoing
maintenance burden it creates for the team, we are planning to drop it from
the V8 repository. (Note that the "ia32" port is unaffected and will
continue to be actively developed.)

If you have any concerns about this deprecation, please speak up now.
Otherwise the removal will happen in two weeks.

--Jakob

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] question on the sample file process.cc

2017-06-29 Thread Jakob Kummerow
The equivalent of options.verbose is options["verbose"] (note the quotes).
Does that help?

On Thu, Jun 29, 2017 at 10:07 PM, wxz  wrote:

> hi all,
>
> there are two maps used in this example, one for 'options', one for
> 'output'. My question is, why is that in the script, the brackets [] works
> for 'output', but not for 'options'?
>
> For example, if change the line:
> options.verbose  ===> options[verbose]
> it returns error: verbose is not defined
>
> However, 'output[request.host]' is perfectly fine.
>
> The two maps are installed with the same code, the wrap/unwrap are the
> same, what's the difference?
>
> I guess my confusion is what exactly does bracket mean here? Does it
> invoke the named property interceptor?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: How to build V8 on Raspberry Pi (3 model B) ?

2017-06-02 Thread Jakob Kummerow
On Fri, Jun 2, 2017 at 5:37 PM, aleReimondo 
wrote:

> Issue reported at https://bugs.chromium.org/p/v8/issues/detail?id=6458
>

Don't hold your breath, but feel free to help ;-)

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: How to build V8 on Raspberry Pi (3 model B) ?

2017-06-02 Thread Jakob Kummerow
On Fri, Jun 2, 2017 at 5:10 PM, aleReimondo 
wrote:

> Confirmed the malfunction of the build toolset on the Raspberry Pi.
> It has been reproduced started from clean SDCard (Raspbian OS) and
> following wiki procedures to build V8 without observing any other issues
> during installation and setup.
> So, I will consider this a BUG of Chrome toolset and wait to be repaired
> soon.
> IMHO the downloaded binary of gn is wrong on the Raspery Pi 3 (Raspbian
> OS).
>

Interesting observation.
Yes, it looks like it is assumed that nobody builds on an ARM device; this
site

 says:

> Due to the lack of ARM hardware with the grunt to build Chromium native,
> cross compiling is currently the recommended method of building for ARM.


V8 has instructions for cross-compiling:
https://github.com/v8/v8/wiki/Cross-compiling-for-ARM (these are targeting
Android, but it should be easy to adapt them).

As an alternative: while there don't seem to be pre-built gn binaries for
you to download, you can build your own gn from source. However, I'm not
familiar with that process so I can't give more detailed hints, I only know
that it is possible.


> Ale
> p.d. Why are we downloading binaries? the reason to use py scripting is to
> do not transfer binary...  please remove scripting (best) or binary
> downloads in the toolset :-P
>

Well, gn is a binary tool, that's by design... The Python scripts around it
are just for convenience.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to dump jit code and its corresponding bytecode.

2017-06-02 Thread Jakob Kummerow
Look at the existing flags FLAG_print_opt_code and FLAG_print_bytecode,
their implementations should help you figure out how to do this.

On Fri, Jun 2, 2017 at 8:07 AM, Yuan Pinghai  wrote:

> I want to dump each piece of dynamically generated code. Meanwhile, if its
> corresponding bytecode is available, I also dump the bytecode and record
> the starting line number of the script code (i.e. recording the script name
> and the line number). For this purpose, i inserted code snippets in
> functions which would invoke "factory->NewCode". The following code is what
> i inserted into "CodeGenerator::GenerateCode()". However, my code can
> only successfully dump jit'ed code, but cannot dump bytecodes and record
> the script information. How can I solve this problem? Thanks!
>
> Bye the way, i am working on Version 6.0.99, the latest commit is
> 71c1795aea7573672dd264568357c0f49afc7321.
>
> --- a/src/compiler/code-generator.cc
> +++ b/src/compiler/code-generator.cc
> @@ -256,7 +256,34 @@ Handle CodeGenerator::GenerateCode() {
>if (info->ShouldEnsureSpaceForLazyDeopt()) {
>  Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result);
>}
> -
> +   //dump_jit_code(code, info);
> +
> +   byte* nvstart = code->instruction_start();
> +   //code->instruction_size();
> +   int nvlen = code->body_size();
> +
> +   int type = 0;
> +   if (code->is_crankshafted())
> +   type += (1 << 0);
> +   if (code->is_turbofanned())
> +   type += (1 << 1);
> +
> +   printf("%p, %i, %i \n", nvstart, nvlen, type);
> +
> +   std::unique_ptr debug_name = info->GetDebugName();
> +   OFStream os(stdout);
> +   os << debug_name.get()<< std::endl;
> +
> +   if (info->has_bytecode_array()){
> +   Handle  bytecodes = info->bytecode_array();
> +   bytecodes->Print(os);
> +   }
> +
> +   

Re: [v8-users] How to build V8 on Raspberry Pi (3 model B) ?

2017-06-01 Thread Jakob Kummerow
It's not exactly a bug. v8gen.py, by design, replicates the configuration
of the respective buildbot, and that buildbot uses arm simulator builds.

It's really easy to change the build configuration locally though: just run gn
args out.gn/arm.release, and in the editor that opens, set target_cpu =
"arm".

On Thu, Jun 1, 2017 at 8:18 PM, Ben Noordhuis  wrote:

> On Thu, Jun 1, 2017 at 6:36 PM, aleReimondo
>  wrote:
> > Thank you for your fast response!
> >
> > I tried tools/dev/v8gen.py arm.release
> >  but got error
> >
> > 
> ---
> > pi@raspberrypi:~/v8 $ tools/dev/v8gen.py arm.release -vv
> > 
> 
> > /usr/bin/python -u tools/mb/mb.py gen -f infra/mb/mb_config.pyl -m
> > developer_default -b arm.release out.gn/arm.release
> >
> >   Writing """\
> >   is_debug = false
> >   target_cpu = "x86"
> >   v8_target_cpu = "arm"
> >   """ to /home/pi/v8/out.gn/arm.release/args.gn.
> >
> >   /home/pi/v8/buildtools/linux64/gn gen out.gn/arm.release --check
> >   Traceback (most recent call last):
> > File "tools/mb/mb.py", line 60, in Main
> >   ret = self.args.func()
> > File "tools/mb/mb.py", line 257, in CmdGen
> >   return self.RunGNGen(vals)
> > File "tools/mb/mb.py", line 786, in RunGNGen
> >   ret, _, _ = self.Run(cmd, env=env)
> > File "tools/mb/mb.py", line 1380, in Run
> >   ret, out, err = self.Call(cmd, env=env,
> buffer_output=buffer_output)
> > File "tools/mb/mb.py", line 1394, in Call
> >   env=env)
> > File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
> >   errread, errwrite)
> > File "/usr/lib/python2.7/subprocess.py", line 1335, in
> _execute_child
> >   raise child_exception
> >   OSError: [Errno 8] Exec format error
> > Traceback (most recent call last):
> >   File "tools/dev/v8gen.py", line 304, in 
> > sys.exit(gen.main())
> >   File "tools/dev/v8gen.py", line 298, in main
> > return self._options.func()
> >   File "tools/dev/v8gen.py", line 166, in cmd_gen
> > gn_outdir,
> >   File "tools/dev/v8gen.py", line 208, in _call_cmd
> > stderr=subprocess.STDOUT,
> >   File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
> > raise CalledProcessError(retcode, cmd, output=output)
> > subprocess.CalledProcessError: Command '['/usr/bin/python', '-u',
> > 'tools/mb/mb.py', 'gen', '-f', 'infra/mb/mb_config.pyl', '-m',
> > 'developer_default', '-b', 'arm.release', 'out.gn/arm.release']'
> returned
> > non-zero exit status 1
> > 
> ---
>
> Hm, that looks like a bug to me - target_arch should be "arm", not
> "x86" and it shouldn't try to compile using the x86_64 version of
> clang.  Consider filing a bug report.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to pass the second parameter of ObjectTemplate::New in Google V8?

2017-05-12 Thread Jakob Kummerow
Same question: http://stackoverflow.com/questions/43909594/

On Fri, May 12, 2017 at 7:40 PM, Ben Noordhuis  wrote:

> On Thu, May 11, 2017 at 11:02 AM, XadillaX Scarlet
>  wrote:
> > I know creating an ObjectTemplate and we can do several things to it.
> But my
> > question is not about those well-known things.
> >
> > I want to know how to pass the second parameter.
> >
> > As the official guide said:
> >
> > Each function template has an associated object template. This is used to
> > configure objects created with this function as their constructor.
> >
> > And the second parameter of ObjectTemplate::New is a constructor typed by
> > FunctionTemplate.
> >
> > static Local New(Isolate *isolate,
> Local
> > constructor = Local());
> >
> > That means something like this:
> >
> > void Constructor(const FunctionCallbackInfo& args)
> > {
> > // ...
> > }
> >
> > Local _constructor = FunctionTemplate::New(isolate,
> > Constructor);
> > Local tpl = ObjectTemplate::New(isolate, _constructor);
> >
> > Who can give me a demo that how to implement the Constructor function.
> >
> > I tried this, but failed:
> >
> > void Constructor(const FunctionCallbackInfo& args)
> > {
> > Isolate* isolate = args.GetIsolate();
> > args.This()->Set(String::NewFromUtf8(isolate, "value"),
> > Number::New(isolate, 233));
> > args.GetReturnValue().Set(args.This());
> > }
> >
> > By the way, I know the use case of accessors and so on, I just want to
> know
> > how to use the second parameter.
>
> When you say 'failed', what exactly do you mean?  Is the function not
> called or don't you see the .value property on the new object?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Cryptic out-of-memory error

2017-05-11 Thread Jakob Kummerow
On Thu, May 11, 2017 at 3:38 PM, Jochen Eisinger <joc...@chromium.org>
wrote:

> Thank you for the detailed bug report.
>
> I tried reproducing this on the latest version of V8, but couldn't observe
> the behavior you described.
>
> Have you considered updating to at least the latest stable version of V8?
>

...which would be branch-heads/5.8 (currently 5.8.283.38)


>
> On Wed, May 10, 2017 at 7:50 PM Andre Cunha <andre.lv.cu...@gmail.com>
> wrote:
>
>> I've managed to reproduce the problem using just V8's hello_world example
>> (source code attached). I just added a loop around the creation and
>> destruction of the Isolate (this is what happens in each cycle of my stress
>> test). When I run the process and monitor it in "top", the RES column stays
>> constant at around 26 MB, but the VIRT column grows indefinitely; after
>> about 7 minutes, the VIRT column reaches around 33 GB, and the process
>> crashes (the value of "CommitLimit" in my machine, got from /proc/meminfo,
>> is 35,511,816 kB).
>>
>> Following Michael's suggestion, I changed file src/heap/spaces.cc so that
>> it prints a stack trace when it's about to return NULL. I'm also sending
>> the stack trace attached. I use V8 5.6.326.42 in Fedora 25, x86_64.
>>
>> Just to explain why I'm doing this test: in the library I'm working on,
>> the user can create a certain kind of thread and send requests to it. Each
>> thread needs to run JS code (received from the user), so it creates its own
>> Isolate when it needs to, and destroys it when the Isolate is no longer
>> necessary. One of our stress tests involves the constant creation and
>> destruction of such threads, as well as constantly sending requests to the
>> same thread. It was in this context that I found this problem.
>>
>> On Monday, May 8, 2017 at 12:50:37 PM UTC-3, Andre Cunha wrote:
>>>
>>> @Michael Lippautz, I'll try adding a breakpoint if AllocateChunk returns
>>> NULL; hopefully, I'll get more information about the problem.
>>>
>>> @Jakob Kummerow, yes, I'm calling Isolate::Dispose() in every isolate
>>> after using it. I'll also observe the VIRT column and see if it shows any
>>> abnormality.
>>>
>>> Thank you!
>>>
>>> On Monday, May 8, 2017 at 11:07:44 AM UTC-3, Jakob Kummerow wrote:
>>>>
>>>> My guess would be an address space leak (should show up in the "VIRT"
>>>> column of "top" on Linux). Are you calling "isolate->Dispose()" on any
>>>> isolate you're done with?
>>>>
>>>> On Mon, May 8, 2017 at 4:01 PM, Michael Lippautz <mlip...@chromium.org>
>>>> wrote:
>>>>
>>>>> V8 usually fails there if it cannot allocate a 512KiB page from the
>>>>> operating system/
>>>>>
>>>>> You could try hooking in AllocateChunk [1] and see why it is returning
>>>>> NULL and trace back through the underlying calls.
>>>>>
>>>>> Best, Michael
>>>>>
>>>>> [1]: https://cs.chromium.org/chromium/src/v8/src/heap/
>>>>> spaces.cc?q=AllocateChunk=package:chromium=739
>>>>>
>>>>> On Mon, May 8, 2017 at 3:27 PM Andre Cunha <andre.l...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I have embedded v8 into a project for the company I work for, and
>>>>>> during some stress tests, I've encountered a weird out-of-memory error.
>>>>>> After considerable investigation, I still have no idea of what might be
>>>>>> going on, so I'm reaching out to you in hope of some insight.
>>>>>>
>>>>>> So here is a summary of the scenario: in each test iteration, I
>>>>>> create an Isolate, run some short JS code fragments, and then destroy the
>>>>>> isolate. After the execution of each code fragment, I perform some 
>>>>>> variable
>>>>>> manipulations from my C++ code using V8's API, prior to running the next
>>>>>> fragment. I repeat thousands of such iterations over the same input (it's
>>>>>> valid), and I expect no memory leaks and no crashes. However, after 
>>>>>> about 3
>>>>>> hours, V8 crashes with an out-of-memory error of no apparent reason.
>>>>>>
>>>>>> I have run the code though valgrind and using address sanitizing, and
>>>>

Re: [v8-users] Cryptic out-of-memory error

2017-05-08 Thread Jakob Kummerow
My guess would be an address space leak (should show up in the "VIRT"
column of "top" on Linux). Are you calling "isolate->Dispose()" on any
isolate you're done with?

On Mon, May 8, 2017 at 4:01 PM, Michael Lippautz 
wrote:

> V8 usually fails there if it cannot allocate a 512KiB page from the
> operating system/
>
> You could try hooking in AllocateChunk [1] and see why it is returning
> NULL and trace back through the underlying calls.
>
> Best, Michael
>
> [1]: https://cs.chromium.org/chromium/src/v8/src/heap/
> spaces.cc?q=AllocateChunk=package:chromium=739
>
> On Mon, May 8, 2017 at 3:27 PM Andre Cunha 
> wrote:
>
>> Hello,
>>
>> I have embedded v8 into a project for the company I work for, and during
>> some stress tests, I've encountered a weird out-of-memory error. After
>> considerable investigation, I still have no idea of what might be going on,
>> so I'm reaching out to you in hope of some insight.
>>
>> So here is a summary of the scenario: in each test iteration, I create an
>> Isolate, run some short JS code fragments, and then destroy the isolate.
>> After the execution of each code fragment, I perform some variable
>> manipulations from my C++ code using V8's API, prior to running the next
>> fragment. I repeat thousands of such iterations over the same input (it's
>> valid), and I expect no memory leaks and no crashes. However, after about 3
>> hours, V8 crashes with an out-of-memory error of no apparent reason.
>>
>> I have run the code though valgrind and using address sanitizing, and no
>> memory leaks were detected. Additionally, I monitor memory consumption
>> throughout the test; the program's memory usage is stable, without any
>> peak, and when V8 crashes the system has a lot of available memory (more
>> than 5 Gib). I have used V8's API to get heap usage statistics after each
>> successful iteration; the values are always the same, and are shown below
>> (they are included in an attached file, typical_memory.txt):
>>
>> ScriptEngine::Run: finished running at 2017-05-05T13:20:34
>>   used_heap_size   : 46.9189 Mib
>>   total_heap_size  : 66.1562 Mib
>>   Space 0
>> name   : new_space
>> size   : 8 Mib
>> used_size  : 2.47314 Mib
>> available_size : 5.39404 Mib
>>   Space 1
>> name   : old_space
>> size   : 39.5625 Mib
>> used_size  : 31.6393 Mib
>> available_size : 5.51526 Mib
>>   Space 2
>> name   : code_space
>> size   : 10.4375 Mib
>> used_size  : 6.16919 Mib
>> available_size : 0 B
>>   Space 3
>> name   : map_space
>> size   : 8.15625 Mib
>> used_size  : 6.63733 Mib
>> available_size : 80 B
>>   Space 4
>> name   : large_object_space
>> size   : 0 B
>> used_size  : 0 B
>> available_size : 11.1015 Gib
>>
>> When V8 crashes, it prints a heap summary, which I'm sending attached
>> (file heap_after_error.txt). I also save a core dump. Sometimes, the
>> system crashes during the creation of an Isolate; sometimes, during the
>> creation of a Context; typically, it crashes during snapshot
>> deserialization. However, the top of the stack is always the same, and it's
>> reproduced below (also included attached, file stacktrace.txt).
>>
>> #7  v8::internal::OS::Abort () at ../../src/base/platform/
>> platform-posix.cc:230
>> #8  0x7ff15a2f922f in v8::Utils::ReportOOMFailure
>> (location=0x7ff15b20f62e "Committing semi space failed.",
>> is_heap_oom=false) at ../../src/api.cc:381
>> #9  0x7ff15a2f918e in v8::internal::V8::FatalProcessOutOfMemory
>> (location=0x7ff15b20f62e "Committing semi space failed.",
>> is_heap_oom=false) at ../../src/api.cc:352
>> #10 0x7ff15aa3fefc in v8::internal::Heap::EnsureFromSpaceIsCommitted
>> (this=0x7ff12c0bdde0) at ../../src/heap/heap.cc:1234
>> #11 0x7ff15aa3ed34 in v8::internal::Heap::PerformGarbageCollection
>> (this=0x7ff12c0bdde0, collector=v8::internal::MARK_COMPACTOR,
>> gc_callback_flags=v8::kNoGCCallbackFlags) at
>> ../../src/heap/heap.cc:1308
>> #12 0x7ff15aa3e2ab in v8::internal::Heap::CollectGarbage
>> (this=0x7ff12c0bdde0, collector=v8::internal::MARK_COMPACTOR,
>> gc_reason=v8::internal::GarbageCollectionReason::kDeserializer,
>> collector_reason=0x7ff15b20f07a "GC in old space requested",
>> gc_callback_flags=v8::kNoGCCallbackFlags) at
>> ../../src/heap/heap.cc:1002
>> #13 0x7ff15a33cdee in v8::internal::Heap::CollectGarbage
>> (this=0x7ff12c0bdde0, space=v8::internal::OLD_SPACE,
>> gc_reason=v8::internal::GarbageCollectionReason::kDeserializer,
>> callbackFlags=v8::kNoGCCallbackFlags) at ../../src/heap/heap-inl.h:681
>> #14 0x7ff15aa3d069 in v8::internal::Heap::CollectAllGarbage
>> (this=0x7ff12c0bdde0, flags=2,
>> 

Re: [v8-users] Why does a combination of optimization flags(--always-opt --turbo) and code caching show bad performance?

2017-04-21 Thread Jakob Kummerow
As Jochen already said on chromium-dev, --always-opt does not make things
faster. This is expected. The purpose of the flag is to flush out certain
kinds of bugs when running tests, at the cost of a big slowdown.

Code caching has limits. It cannot cache everything.

The default configuration is what we believe gives the best performance in
general cases. There are no "secret" flags to make things faster.

On Fri, Apr 21, 2017 at 9:27 AM, Jin Chul Kim  wrote:

> Hello,
>
> I am trying to reduce a execution time on general cases. My approach is a
> combination of two features: fully optimized code generation + code caching.
> In my experiment, I figured out that code caching is very powerful. By the
> way, the execution time was significantly increased when I was using the
> following flags: --always-opt. I know turboFan was enabled on the recent V8
> code. Here are my question.
>
> 1. As far as I know, code caching does not need code compilation to
> generate machine(native) code. Is that correct?
>
> I checked trace with --trace-opt. There were many lines for optimizing and
> compilation on code caching. why did them happen?
>
> [compiling method 0xed4b9e340c1  = 0xed4b9e31ea1)> using TurboFan]
> [optimizing 0xed4b9e340c1  0xed4b9e31ea1)> - took 0.081, 0.356, 0.039 ms]
> [compiling method 0x3d3958a8f609  0xed4b9e41829)> using TurboFan]
> [optimizing 0x3d3958a8f609  0xed4b9e41829)> - took 0.109, 0.560, 0.060 ms]
> [compiling method 0x3d3958a93a81  0xed4b9e3d401)> using TurboFan]
> [optimizing 0x3d3958a93a81  0xed4b9e3d401)> - took 0.028, 0.086, 0.011 ms]
> ...
>
> 2. Do you explain why execution time is significantly increased on w/ opt.
> + w/ caching (examples 4) and 5) below)?
>
> If I was using the flag(--always-opt), the compiler may generates
> optimized or unoptimized code. Then, I think the second run should be same
> or better performance than the first run because it does not require
> compilation and just loads binary. Please see my experiment result as below:
>
> - baseline: w/o opt. + w/o caching
> 1) 24.06 secs
>
> - w/o opt. + w/ caching
> 2) 1st run(save native code): 24.35 secs
> 3) 2nd run(load native code): 16.94 secs
>
> - w/ opt. + w/ caching
> 4) 1st run(save native code): 75.12 secs
> 5) 2nd run(load native code): 74.02 secs
>
> 3. How may I generate an optimal code to decrease an execution time on
> code caching?
>
> Many thanks,
> Jinchul
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] V8 uses huge amounts of memory for "dictionary" objects with ~50 properties

2017-04-13 Thread Jakob Kummerow
We are aware that dictionary-mode objects are not particularly memory
efficient right now, and are working on improving that.

With the current implementation, every used entry in a property dictionary
requires 3 words (=8 bytes each on 64-bit), one word each for the
property's name, value, and details (writable/enumerable/configurable).
Additionally, dictionaries grow when usage exceeds 2/3 of capacity; this is
in order to keep the probability of collisions low.
When they grow, they grow by a factor of 4x. (That smells like a bug; I
would guess that the intention was to let them grow by 2x, but the
multiplication is done twice.)

What ends up happening is that for objects with 43 properties, the
dictionary has capacity 64, consuming 64 * 3 (words per entry) * 8 (bytes
per word) = 1536 bytes (+ 7 words metadata). When you add the 44th
property, it is grown to capacity 256, now consuming 256 * 3 * 8 = 6144
bytes (+7 words metadata). On the bright side, you can then grow your
objects all the way up to 170 properties without increasing memory usage.
So the overhead you're measuring will depend a lot on just how many
properties you're adding.


Side note: if you know the set of properties that will be added in advance
(just not their order), then it might be a good idea to initialize all of
them in the object's constructor, and fill in their actual values later, so
that you'll benefit from faster and slimmer objects. Roughly:
function MyObject() {
  this.prop1 = undefined;
  this.prop2 = undefined;
  // etc...
}
function OnNetworkReceived(object, prop, value) {
  object[prop] = value;  // prop is "prop1" or "prop2" or ...
}


On Thu, Apr 13, 2017 at 1:20 PM, Russ P  wrote:

> Hello,
>
> I've been working on a project that adds properties to objects in a
> variable order as they come in over the network (hidden classes and similar
> optimizations can't be applied). I've noticed that V8, on both Chrome and
> Node, uses huge amounts of memory to represent them compared to other JS
> engines.  I'm testing on Windows.
>
> In 64-bit V8, an object with 50 simple properties with integer values uses
> ~6000 bytes of memory, which works out to >100 bytes overhead per entry.
>  32-bit is somewhat better at ~3000 bytes per object and >45 bytes overhead
> per entry, but it's still really bad.
>
> In comparison, the same 50-property objects were only ~900 bytes each in
> Firefox and Edge.  That's 3-6X less!
>
> I've included a test that shows the issue if you'd like to try it out:
> https://repl.it/HIMc/7.  Be sure to turn off infinite loop protection in
> settings.  After running it, you can force a gc and check the browser's
> memory usage (divide by 20, that's the test # of objects).
>
> Anyone else seen similar problems?  That seems like a crazy amount of
> overhead per property.
>
> -Russ
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Why for loop will become faster if divided in two loop?

2017-04-12 Thread Jakob Kummerow
I cannot reproduce a difference here; both versions appear to have the same
speed. (Of course there's some noise in the data, as always; so if you do
just a single run of each version, then either one could get lucky or
unlucky.)

On Wed, Apr 12, 2017 at 12:02 PM, Rong Jie  wrote:

> I think this might be due to loop fission optimization (
> https://en.wikipedia.org/wiki/Loop_fission), even GCC (C++ compiler)
> sometimes does that when appropriate.
>

V8 doesn't do loop fission.


> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] v8 version: 4.6.2, appear "segment fault" when call the api "LowMemoryNotification"

2017-04-10 Thread Jakob Kummerow
Version 4.6.2 is just a daily snapshot that has never been officially
supported, and by now is severely outdated. Nobody knows or cares whether
it has bugs. You should use the tip of a supported branch, e.g. right now
branch-heads/5.7, see e.g.
https://gist.github.com/domenic/aca7774a5d94156bfcc1 for a detailed writeup.

Generally speaking, crashes during garbage collection can have any number
of reasons, including both V8 bugs and bugs in your embedding application.

As a side note: are you sure that triggering emergency GCs manually is what
you want? Usually it's best to just let the GC do its thing. A lot of
thought and effort is going into the internal heuristics for when to do how
much work, to ensure that you're getting a great tradeoff between short
pauses, high performance, and low memory consumption.


On Mon, Apr 10, 2017 at 11:39 AM, Ivan Y  wrote:

> Hi, here
>
> when I use the api "LowMemoryNotification", my program will appear
> "segment fault" at times, I just want to know whether this is a known bug
> in version 4.6.2.
>
> (1) call position in my program:
>
>
> 
>
>
> (2) the backtrace from coredump file
>
>
> 
>
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How to debug the v8 src code by exec `tools/run-tests.py --outdir out.gn/x64.debug`

2017-04-10 Thread Jakob Kummerow
There's no existing support for this. Pausing on breakpoints requires
running in a debugger, which run-tests.py doesn't implement.

As a workaround, you could put an UNREACHABLE() into the source where you'd
want to break and then run the test suite. run-tests.py will then print the
command line for any failing test(s), which you can use to run that test in
isolation within your debugger (after removing the UNREACHABLE() again).

Hope this helps,
Jakob

On Mon, Apr 10, 2017 at 10:31 AM, Early  wrote:

> Hi,I want to debug the v8 src code while runing the `tools/run-tests.py
> --outdir out.gn/x64.debug`.
> So, is there any way to help me to pause on a breakpoint which was set on
> a cc file in v8/src, when I run the `tools/run-tests.py --outdir
> out.gn/x64.debug`?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Have the no snapshot startup times gotten significantly longer in the last 6-12 months? 3s => 20s+

2017-04-04 Thread Jakob Kummerow
Yes, just to confirm:

Starting without snapshot, especially in Debug mode, has become much
slower, because more work is being done there (mostly compilation of
builtins and bytecode handlers).

This is working as intended. I.e. it's not considered a bug/problem, will
not be improved over time, in fact it could get even slower and we wouldn't
care.

The officially supported/recommended thing to do is to build with snapshot.


On Tue, Apr 4, 2017 at 1:24 AM, Zac Hansen  wrote:

> Got some info on IRC -- apparently there is now a "code stub assembler"
> that does a bunch of work on startup.
>
> I stopped the program a few times during startup and it was confirmed,
> looking at the stack traces, that that was in fact what was going on.
>
> Moral of this story:  use snapshots.
>
> On Monday, April 3, 2017 at 12:48:52 AM UTC-7, Zac Hansen wrote:
>
>> I just updated my v8 build and noticed a dramatic slowdown in startup
>> times.
>>
>> I'd always used no snapshots for convenience because the startup penalty
>> was insignificant (maybe around 3s?) but ever since I updated it's up
>> around 20s now.
>>
>> Is this a known behavior or am I doing something else wrong maybe?
>>
>> Thank you.
>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Is V8::JSON::Parse really needed against JSON inputs?

2017-03-16 Thread Jakob Kummerow
Of course it's possible to make C++ objects accessible to JS, that's what
V8's API is for. You'll have to provide accessors for fields you want to
expose. See
https://github.com/v8/v8/wiki/Embedder's-Guide#accessing-dynamic-variables.

On Thu, Mar 16, 2017 at 6:04 PM, Abhishek Singh <singhabhishek@gmail.com
> wrote:

> Hi,
>
> (responses inline)
>
> On 16-Mar-2017, at 21:53, Jakob Kummerow <jkumme...@chromium.org> wrote:
>
> What do you mean by "native JS JSON"?
>
>
> Apologies, it isn’t technically correct term. I meant javascript object
> carved out of string representation.
>
> JSON ("JavaScript Object Notation") is a standardized format for string
> representations of objects. "JSON.stringify" creates this string
> representation for a given object, "JSON.parse" creates a new object from
> this string representation. If you want to transfer a string, and then
> create an object from it, then JSON.Parse (which is exposed as
> V8::JSON::Parse in the V8 API) is the way to go.
>
>
> (Depending on your use case, instead of transferring a JSON string,
> passing around an ArrayBuffer with externalized data might be a better fit.
> Then there would be no conversions to string and back.)
>
>
> For current use case, I need to operate on few top level fields of JS
> object(made out of stringified representation on already JSON marshalled
> data) - so I think ArrayBuffer might not work out. Sample ex:
>
> function OnUpdate(doc, meta) {
>
> if (doc.type == “credit_score”) {
> var res = CalculateCreditScore(doc)
> }
> }
>
> 2 args passed to OnUpdate->Call() are already JSON marshalled(but present
> as string, so was hoping if I could avoid marshalling it twice). I suppose,
> I would have to stick JSON.parse to handle above kind of use case.
>
> Is there a way to expose a custom encoded data(flatbuffer encoded
> probably, it’s cpu footprint looks good) to JS world and access fields from
> it - i.e. args passed to OnUpdate->Call() could be stringified flatbuffer
> encoded data and then somehow we could access fields in flatbuffer schema
> directly from JS?
>
>
>
>
> On Thu, Mar 16, 2017 at 3:39 PM, Abhishek Singh <
> singhabhishek@gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying to send JSON data to user supplied JS code, which is executed
>> by V8. What I've realised is even if user data is JSON marshalled, I've to
>> explicitly do V8::JSON::Parse on it, so that value received in JS world is
>> native JS JSON. Is that really necessary? Performance penalty because of
>> it, is quite high(screenshot of profile attached).
>>
>>
>>
>> <https://lh3.googleusercontent.com/-y9ml-f0jE8c/WMqjEdHXcrI/Duo/CiSBic1JwaIxui5NmJvOOpOQpziuVu1ZwCLcB/s1600/Screen%2BShot%2B2017-03-16%2Bat%2B19.53.08.png>
>>
>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] PSA: FunctionEntryHook Isolate parameter will require a no-snapshot build

2017-03-07 Thread Jakob Kummerow
The v8::Isolate::CreateParams struct that you can pass to a v8::Isolate has
an entry_hook field which can be used to specify a FunctionEntryHook
callback, which is a C++ function that will be called at various points
during program execution (mostly whenever a new function is entered).

When https://codereview.chromium.org/2733203002 lands, then if you build
with GN, passing a custom FunctionEntryHook to newly created Isolates will
only work with no-snapshot builds. You can use the GN arg v8_use_snapshot =
false to get such a build.

GYP builds are not affected by the change at this time.

Specifying a FunctionEntryHook has always had the implied effect that an
existing snapshot was ignored, and V8 bootstrapped from scratch. The reason
for that is that part of the contents of the snapshot have to be different
when a FunctionEntryHook is present. The reason the build flag requirement
is now being made explicit is because builds with snapshot will lose the
ability to bootstrap from scratch, whereas no-snapshot builds will
(obviously) retain it.

Tracking bug: https://bugs.chromium.org/p/v8/issues/detail?id=6055

Questions, comments, concerns? Please speak up now.

Cheers,
Jakob

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Cross-compile for arm64 (iOS)

2017-03-04 Thread Jakob Kummerow
See cross-compiling instructions at
https://github.com/v8/v8/wiki/Cross-compiling%20for%20ARM

iOS is not supported because Apple doesn't allow non-system apps to
JIT-compile code, and V8 relies on JIT compilation.

On Sat, Mar 4, 2017 at 5:39 PM, Lukas Kollmer 
wrote:

> I'm trying to run v8 on iOS (arm64).
>
> When I build for arm using `make arm64`, no libv8_base.a file is generated
> and all generated object files (*.o) are actually for x86. How can I cross
> compile v8 for arm64?
>
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Isolate Creation Times

2017-02-24 Thread Jakob Kummerow
I've commented on the bug. TL;DR: compile with snapshot, and in Release
mode.

On Fri, Feb 24, 2017 at 3:06 PM, Brendan Bates 
wrote:

> Posted here: https://bugs.chromium.org/p/v8/issues/detail?id=6014.
>
> Let me know if there are any other tests or information I can provide.
>
> On Friday, February 24, 2017 at 1:04:02 AM UTC-5, Jochen Eisinger wrote:
>>
>> Hey
>>
>> That sounds odd. Could you file a bug at crbug.com/v8/new and provide
>> the gn args you used for building?
>>
>> Thanks
>> Jochen
>>
>> Brendan Bates  schrieb am Do., 23. Feb. 2017,
>> 18:07:
>>
>>> I should also note that I can replicate this by simply running the d8
>>> executable, which seems to take about 5 seconds to bootstrap.
>>>
>>>
>>> On Thursday, February 23, 2017 at 10:59:47 AM UTC-5, Brendan Bates wrote:

 I'm posting here to see if anyone has experienced this recently.

 We upgraded our scripting environment from *5.1.281.65 *to *5.7.492.44*.
 Everything as far as building with GN has gone
 smoothly, however one odd issue is with the timing of the isolate
 creation:


 _isolate = Isolate::New(createParams);


 This used to be nearly instantaneous (few ms at most), now it's taking
 about 5 seconds on my Windows 10 64-bit
 environment (with a 32-bit build).  The allocator in the createParams
 is using the default v8 allocator.  Will using an
 empty snapshop help?  If we have 20 scripts loaded, that's 100 seconds
 of startup time... way too much.  Any help
 would be appreciated.  Thanks!

>>> --
>>> --
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] performance.now resolution

2017-02-03 Thread Jakob Kummerow
Some sort of rounding error, yes. The internal representation (before
converting the value to float) is microseconds. Actual precision depends on
the operating system, as the comment in time.h says:

  // Returns a platform-dependent high-resolution tick count. Implementation
>   // is hardware dependent and may or may not return sub-millisecond
>   // resolution.  THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND
>   // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED.


Also, note that V8 itself doesn't know about "performance.now()". It is up
to embedders to provide this functionality -- Chromium has an
implementation, d8 has its own (which is what I'm talking about above), I
don't know about node.js.

On Wed, Feb 1, 2017 at 10:08 AM, Brian Hicks  wrote:

> The spec for performance.now says that the resulting values should be
> accurate to the thousandth of a millisecond. In my testing, I'm getting
> values even more precise than that, down to the ten trillionth place (13
> digits past the decimal)
>
> So my question: is it safe to rely on the values beyond the thousandth
> place, or is this some sort of rounding error or measurement noise?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Streams and InternalPackedArray queue scalability

2017-01-18 Thread Jakob Kummerow
Interesting case :-)

The implementation of InternalPackedArray is essentially the same as plain
JavaScript "Array", the biggest difference is that InternalPackedArray is
not exposed to websites and therefore not monkey-patchable.
Array.shift() is inherently slow, because it requires all remaining
elements to be moved. (Array.push()/Array.pop() are much faster.)
V8 uses a nasty trick to make Array.shift() fast: object left-trimming,
where the object header is moved, so that the elements themselves can stay
in place. This is an ugly hack and we would like to get rid of it.
Left-trimming is not possible in "large object space", a special area of
V8's heap for large objects. The limit for what constitutes a "large
object" is the regular heap's page size, which is 512KB.
Arrays over-allocate their backing store in steps; when you start with "new
Array()" and keep push()ing onto it, the sequence of backing store
capacities is 4, 23, 52, 95, 160, 257, 403, 622, 950, 1442, 2180, 3287,
4948, 7439, 11176, 16781, 25189, 37801, *56719*, 85096, 127661, ...
So when the 56720th element is pushed, the backing store is grown to 85096
* 8 bytes = 680768 bytes > 512KB, so the new backing store must be
allocated in large-object space. Every subsequent shift() on that array is
an O(n) operation.
The reason the threshold is four times as high on your Android tablet is
because we ship 32-bit Chrome builds to Android (so you can fit 2x as many
pointers into the same space), and older V8 versions use 1MB pages (so you
can fit 2x as large objects into regular pages).

Long story short:
• your patch looks fine
• worrying about deopts is probably unnecessary, but only measuring will
tell for sure
• then again switching between two implementations is probably also
unnecessary (encapsulating the behavior you want into one class is probably
cleaner)
• you can split at 32768, sure, or at any random integer between 1 and
5 (I wouldn't rely on the specific numbers I quoted above, because
that's an implementation detail and could change at any time)
• ideally you don't use Array.shift() at all, and instead have a "cursor"
index for the next element to be consumed; drop the Queue's "front" when
cursor === front.length (this would probably work well with a chunk size in
the [100..1000] range or so)
• if the chunks you're queuing are indeed typically 1K or bigger, then you
probably don't need to bother with arrays at all, and can just use a plain
simple linked list (because a few pointers of overhead per element are
negligible if they give you guaranteed O(1) push/shift performance
regardless of queue length), like so:

class Queue {
  constructor() {
this.size = 0;
this.front = null;
this.back = null;
  }

  get length() { return this.size; }

  push(element) {
++this.size;
if (this.size === 1) {
  this.front = this.back = { value: element, next: null };
} else {
  var node = { value: element, next: null };
  this.back.next = node;
  this.back = node;
}
  }

  shift() {
--this.size;
var result = this.front.value;
this.front = this.front.next;
return result;
  }
}

On Wed, Jan 18, 2017 at 8:24 AM, Jochen Eisinger 
wrote:

> +Domenic Denicola 
>
> On Wed, Jan 18, 2017 at 4:25 AM Adam Rice  wrote:
>
>> I work on the Chrome implementation of ReadableStream and WritableStream
>> . They are implemented in Javascript
>> using v8 extras.
>>
>> They currently use an InternalPackedArray to implement a queue structure,
>> however I have found a scalability issue. The benchmarks and repro can be
>> found at http://crbug.com/681493 ("ReadableStream, WritableStream get
>> dramatically slower when queue grows to 56720 chunks").
>>
>> I have a proposed fix at http://crrev.com/2637863002. If possible, I
>> would like someone who is familiar with the implementation of
>> InternalPackedArray to review it.
>>
>> Particular things I'd like to know:
>>
>>- Is it worth worrying about deopt or would it be better to use
>>InternalPackedArray for small queues and only switch to Queue for larger
>>ones?
>>- Is 32768 a good size to split the arrays at? Can we be reasonably
>>sure that it is small enough to get good behaviour on all platforms and
>>architectures?
>>
>> and if possible
>>
>>- why does performance change so dramatically at a threshold?
>>
>> Thanks,
>> Adam Rice
>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> 

Re: [v8-users] What is difference between v8::Object::Has() and v8::Object::HasOwnProperty()?

2016-12-07 Thread Jakob Kummerow
See https://tc39.github.io/ecma262/#sec-hasproperty vs.
https://tc39.github.io/ecma262/#sec-hasownproperty.


On Wed, Dec 7, 2016 at 2:48 PM, kent williams 
wrote:

> If this is documented anywhere, I haven't found it.
>
> What is difference between v8::Object::Has() and
> v8::Object::HasOwnProperty()?
>
> for example:
>
> var x = { HasThisProperty : true };
>
> Both functions return true.
>
> What would be a case where one was true and the other false?
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Setting an execution limit

2016-11-21 Thread Jakob Kummerow
There is always a stack limit, which always prevents infinite recursion; as
well as, in fact, finite but very deep recursion.

As Ben said, the only way to prevent infinite or long-running loops is by
interrupting the program from another thread. You may have heard of
the *Halting
Problem*, TL;DR: there really can be no other way, because in the general
case it is *impossible* to predict whether a loop will terminate at all,
and how soon.

There is no way to set a limit for executed instructions. You could hack
it, but it's going to be non-trivial.

On Sun, Nov 20, 2016 at 11:11 PM,  wrote:

> I don't think there's any way. V8 JavaScript code is compiled to native
> code, and no instrumentation is really possible on that.
>
> On Sunday, November 20, 2016 at 10:18:24 AM UTC-8, James Lovejoy wrote:
>>
>> Really I need something a little more deterministic than a time limit. Is
>> there a way to set an instruction limit? Or perhaps something similar to
>> lua_sethook (http://pgl.yoyo.org/luai/i/lua_sethook) in Lua which calls
>> a callback every given number of instructions.
>>
>> On Sun, Nov 20, 2016 at 4:02 AM, Ben Noordhuis 
>> wrote:
>>
>>> On Sat, Nov 19, 2016 at 10:11 PM, James Lovejoy 
>>> wrote:
>>> > Hi,
>>> >
>>> > Is there a way to set a hard execution limit in the V8 engine? I want
>>> to be
>>> > able to prevent things like infinite loops and recursions. I realise
>>> that
>>> > since V8 compiles to machine code I don't get a program counter or
>>> anything.
>>> > I feel like setting the "stack limit" is the right way to go but the
>>> usage
>>> > of this feature from the documentation is unclear. Can someone guide
>>> me as
>>> > to how to achieve such a limit?
>>> >
>>> > James
>>>
>>> If 'execution limit' means 'time limit': start a watchdog thread and
>>> call v8::Isolate::TerminateExecution() from that thread on timeout.
>>> It must be a thread, it's not safe to call from a signal handler.
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "v8-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/v8-users/Qwdd66xCtTU/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


<    1   2   3   4   5   6   >