Hi dan,

Glad to hear things are working for you. The functions you're looking at
are intrinsic/runtime functions, and that syntax is the "natives" syntax,
enabled for user code with the "--allow-natives-syntax" flag. Some people
have used this in the past to e.g. track optimisation behaviour, like this
(no longer in-date) documentation from bluebird
<https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#1-tooling>
.

Those functions are found in C++, not in Javascript, as they are runtime
calls. They are declared in src/runtime/runtime.h, where you can also find
the documentation of the %Foo and %_Foo syntax. The definitions are in the
.cc files under src/runtime, prefixed with "Runtime_" -- e.g. %GetArrayKeys
is defined in runtime-array.cc
<https://cs.chromium.org/chromium/src/v8/src/runtime/runtime-array.cc?l=455&rcl=a3d09098655de3c43eec029fec2a766d63f36caf>
(btw,
https://cs.chromium.org/ is a great way of browsing the code). Similarly
you can find the C++ definition of %IsSmi by searching for Runtime_IsSmi
<https://cs.chromium.org/search/?q=Runtime_IsSmi>.

%_IsSmi, with the underscore, is an inlined intrinsic (specifically, an
intrinsic that *can* be inlined by the compiler). In the interpreter, for
example, this is in the supported intrinsics list
<https://cs.chromium.org/chromium/src/v8/src/interpreter/interpreter-intrinsics.h?l=16&rcl=a3d09098655de3c43eec029fec2a766d63f36caf>,
so we output an InvokeIntrinsic bytecode
<https://cs.chromium.org/chromium/src/v8/src/interpreter/bytecode-array-builder.cc?l=1407&rcl=a3d09098655de3c43eec029fec2a766d63f36caf>
rather
than a runtime call bytecode, which has an generated assembly handler
which, during execution, dispatches on the intrinsic's id
<https://cs.chromium.org/chromium/src/v8/src/interpreter/interpreter-intrinsics-generator.cc?l=98&rcl=a3d09098655de3c43eec029fec2a766d63f36caf>
and for IsSmi does the Smi check
<https://cs.chromium.org/chromium/src/v8/src/interpreter/interpreter-intrinsics-generator.cc?l=189&rcl=a3d09098655de3c43eec029fec2a766d63f36caf>.
The optimizing compiler has similar logic.

Hope that helps -- V8 is a complex codebase due to the interplay between
C++, javascript, generated assembly, etc., so don't expect to be able to
easily find where everything is defined or how everything works without
serious digging.

- Leszek

On Mon, Aug 20, 2018 at 6:14 PM dan Med <litokis.ta...@gmail.com> wrote:

> How do these function get called
> %GetArrayKeys
> cause i can't seem to find them in the /src/array.js
> as well as  %_IsSmi in the same file
>
> 2018-08-20 19:04 GMT+02:00 dan Med <litokis.ta...@gmail.com>:
>
>> Yes i will use it
>>
>>
>> 2018-08-20 15:57 GMT+02:00 <danny.p...@gmail.com>:
>>
>>> I have uploaded a .Net 4.5 application that I wrote over the weekend to
>>> configure and build V8. It's available here: V8Builder
>>> <https://github.com/dannypike/V8Builder>.
>>>
>>> In the README are TL;DR-style instructions if you don't want to use the
>>> GUI (or can't build it and don't have a friend with a C# compiler).
>>>
>>> I gave up trying to write simple instructions, it was much easier to
>>> write an application instead.
>>>
>>> Hope it helps,
>>>
>>> Dan
>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> v8-dev@googlegroups.com
>>> http://groups.google.com/group/v8-dev
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-dev+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
> --
> --
> v8-dev mailing list
> v8-dev@googlegroups.com
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to