Is there any way by which I can explore native code in Javascript? I want to see what Function() class has in it.
Asked
Active
Viewed 5,579 times
9
-
Ehh? There's a specification, if you'd like that? JavaScript is determined by it, and as so, for a non-browser-specific way to look at it, that's the way you want to go. – Sune Rasmussen May 20 '10 at 10:37
-
not exactly byte code...but the native classes and functions. For example if you write alert(Function) then you see Function(){[native code]}. So I want to explore this native code. – alter May 20 '10 at 19:24
2 Answers
3
You could have a look at the source code of an open source browser such as Firefox.

Jesper
- 202,709
- 46
- 318
- 350
-
-
1@marcioAlmada: At runtime, no. The code for `Function` (and most other built-ins) isn't Javascript; it's native code. In order to do it at runtime, the script engine would have to have an embedded native-code disassembler or something. Which none that i know of do. – cHao Jun 29 '12 at 18:09
2
I've always wanted to do this myself. On a side note, here's how to view assembly language code generated by the V8 JS engine for Chromium (I haven't tried it yet): How can I see the machine code generated by v8?

Community
- 1
- 1

Marc Kirkwood
- 21
- 2