You can create a snapshot with native code.. the problem is that you will need to change the v8 source, so you will end up with a fork of v8, and will have to
manuallly change it every time you want to sync with upstream.
See the code the v8 itself generates for methods in javascript
See the src/builtin dir for implementations..
Note the differences in wrapping:
TF_BUILTIN -> Uses the TurboFan backend directly, and you are basically writing a portable assembly
in C++ code, that TurboFan will translate to machine code according to the host machine
Also the trick there is to use 'CodeStubAssembler' which will give you access to the TurboFan frontend
For instance in builtins-array-gen.cc the 'ArrayBuiltinCodeStubAssembler' class used in TF_BUILTIN(builtin_method, ArrayBuiltinCodeStubAssembler)
inherits from 'CodeStubAssembler'
Then you have 'BUILTIN(builtin_method)' which is implemented in C++
Once you create your methods you will need to change 'src/builtins/builtins-definitions.h'
and add a reference to the created methods there with 'CPP(Method)' for C++ code or 'TFS(Method) / TFJ(Method)' for
methods created using the turbofan frontend.
Once you create your builtins, and add it to definitions, you will need to change src/bootstrap.cc
and add them to the references and possibly to the runtime global object if you want..
Note that if you do that, anywhere you use this custom v8 of yours this custom runtime will be available...
Thats the only way im aware, that you can embed native code in the snapshot