This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ v8 git:(69191fe7d6) eshost -t _test.js | |
┌────────────────┬───────────┐ | |
│ chakra │ 4 │ | |
├────────────────┼───────────┤ | |
│ javascriptcore │ 4 │ | |
├────────────────┼───────────┤ | |
│ spidermonkey │ 4 │ | |
├────────────────┼───────────┤ | |
│ v8 │ undefined │ | |
├────────────────┼───────────┤ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(Number.prototype,Symbol.iterator,{ | |
*value({ start = 0, step = 1 } = {}) { | |
var inc = this > 0 ? step : -step; | |
for (let i = start; Math.abs(i) <= Math.abs(this); i += inc) { | |
yield i; | |
} | |
}, | |
enumerable: false, | |
writable: true, | |
configurable: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://web.archive.org/web/20160310120458/http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions | |
// in whatever-extras.js | |
import Whatever from './whatever.js'; | |
export extension Extensions = Whatever.protoype { | |
somethingComplex: function() { ... } | |
} | |
// in user code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function observed({kind, key, placement, descriptor, initializer}, privateFieldMaker) { | |
assert(kind == "field"); | |
assert(placement == "own"); | |
// Create a new anonymous private name as a key for a class element | |
let { get, set } = privateFieldMaker(); | |
let underlyingDescriptor = { enumerable: false, configurable: false, writable: true }; | |
let underlying = { kind, key: storage, placement, descriptor: underlyingDescriptor, initializer }; | |
return { | |
kind: "method", | |
key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ v8 (1f0419da93) ✗ python parse-mem.py | |
AST Node Count Total Size | |
VariableProxy 22049 529.2 kb | |
Literal 5635 90.176 kb | |
FunctionLiteral 968 77.52 kb | |
ObjectLiteral::Property 2430 58.344 kb | |
Assignment 1066 25.608 kb | |
ObjectLiteral 648 20.768 kb | |
Call 820 19.704 kb | |
ExpressionStatement 1191 19.072 kb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class X extends Promise { | |
static get [Symbol.species]() { | |
return Y; | |
} | |
} | |
class Y { | |
constructor(executor) { | |
return new Proxy(new Promise(executor), {}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
class A { | |
constructor(arg) { | |
return arg; | |
} | |
} | |
class C extends A { | |
#x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!(function(e) { | |
function t(r) { | |
if (n[r]) return n[r].exports; | |
var o = (n[r] = { exports: {}, id: r, loaded: !1 }); | |
return e[r].call(o.exports, o, o.exports, t), (o.loaded = !0), o.exports; | |
} | |
var n = {}; | |
return (t.m = e), (t.c = n), (t.p = "./"), t(0); | |
})( | |
(function(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original: | |
import("module/id").then(...); | |
// Node.js (synchronous require; easy): | |
Promise.resolve().then(_ => require("module/id")).then(...); | |
// AMD (async require; non-standard): | |
new Promise(resolve => require("module/id", resolve)).then(...); | |
// Webpack 2 (require.ensure is Webpack-specific): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunasekaran@gunasekaran-macbookair ~/code/scratch [8:11:32] | |
> $ node | |
> var bluebird = require('bluebird'); | |
undefined | |
> function f() { | |
... Promise.resolve().then(() => console.log('1')); | |
... bluebird.resolve().then(() => console.log('2')); | |
... Promise.resolve().then(() => console.log('3')); | |
... } | |
undefined |
NewerOlder