I was just perusing the v8 source and I ran across its ability to inline native calls. For example, Math.random() basically follows the following execution chain:
Math.random() - math.js
RandomHeapNumber - runtime.h
HGraphBuilder::GenerateRandomHeapNumber - hydrogen.cc
Interested, I kept looking around and realized that Math.random is basically a set of assembly instructions located in places like src/x64/full-codegen.cc.
What I'm wondering is if it's possible to emulate the same behavior from an embedded application?