How JavaScript core methods are implemented? -
is there reference or online site in can see how javascript core library methods push(), join(), split()
etc implemented other language (glib c)
it varies implementation (within reason, implementation has fundamentally follow the spec). can see details of how v8 (chrome's engine) , spidermonkey (mozilla's) work, they're both open source:
for example, how v8 implements array#push
(the line number in link rot):
function arraypush() { if (is_null_or_undefined(this) && !is_undetectable(this)) { throw maketypeerror("called_on_null_or_undefined", ["array.prototype.push"]); } var n = to_uint32(this.length); var m = %_argumentslength(); (var = 0; < m; i++) { this[i+n] = %_arguments(i); } this.length = n + m; return this.length; }
Comments
Post a Comment