wellKnownIntrinsicObjects.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. // Copyright (C) 2018 the V8 project authors. All rights reserved.
  2. // This code is governed by the BSD license found in the LICENSE file.
  3. /*---
  4. description: |
  5. An Array of all representable Well-Known Intrinsic Objects
  6. ---*/
  7. const WellKnownIntrinsicObjects = [
  8. {
  9. intrinsicName: "%Array%",
  10. globalNameOrSource: "Array"
  11. },
  12. {
  13. intrinsicName: "%ArrayBuffer%",
  14. globalNameOrSource: "ArrayBuffer"
  15. },
  16. {
  17. intrinsicName: "%ArrayBufferPrototype%",
  18. globalNameOrSource: "ArrayBuffer.prototype"
  19. },
  20. {
  21. intrinsicName: "%ArrayIteratorPrototype%",
  22. globalNameOrSource: "Object.getPrototypeOf([][Symbol.iterator]())"
  23. },
  24. {
  25. intrinsicName: "%ArrayPrototype%",
  26. globalNameOrSource: "Array.prototype"
  27. },
  28. {
  29. intrinsicName: "%ArrayProto_entries%",
  30. globalNameOrSource: "Array.prototype.entries"
  31. },
  32. {
  33. intrinsicName: "%ArrayProto_forEach%",
  34. globalNameOrSource: "Array.prototype.forEach"
  35. },
  36. {
  37. intrinsicName: "%ArrayProto_keys%",
  38. globalNameOrSource: "Array.prototype.keys"
  39. },
  40. {
  41. intrinsicName: "%ArrayProto_values%",
  42. globalNameOrSource: "Array.prototype.values"
  43. },
  44. {
  45. intrinsicName: "%AsyncFromSyncIteratorPrototype%",
  46. globalNameOrSource: "undefined"
  47. },
  48. {
  49. intrinsicName: "%AsyncFunction%",
  50. globalNameOrSource: "(async function() {}).constructor"
  51. },
  52. {
  53. intrinsicName: "%AsyncFunctionPrototype%",
  54. globalNameOrSource: "(async function() {}).constructor.prototype"
  55. },
  56. {
  57. intrinsicName: "%AsyncGenerator%",
  58. globalNameOrSource: "Object.getPrototypeOf((async function * () {})())"
  59. },
  60. {
  61. intrinsicName: "%AsyncGeneratorFunction%",
  62. globalNameOrSource: "Object.getPrototypeOf(async function * () {})"
  63. },
  64. {
  65. intrinsicName: "%AsyncGeneratorPrototype%",
  66. globalNameOrSource: "Object.getPrototypeOf(async function * () {}).prototype"
  67. },
  68. {
  69. intrinsicName: "%AsyncIteratorPrototype%",
  70. globalNameOrSource: "((async function * () {})())[Symbol.asyncIterator]()"
  71. },
  72. {
  73. intrinsicName: "%Atomics%",
  74. globalNameOrSource: "Atomics"
  75. },
  76. {
  77. intrinsicName: "%Boolean%",
  78. globalNameOrSource: "Boolean"
  79. },
  80. {
  81. intrinsicName: "%BooleanPrototype%",
  82. globalNameOrSource: "Boolean.prototype"
  83. },
  84. {
  85. intrinsicName: "%DataView%",
  86. globalNameOrSource: "DataView"
  87. },
  88. {
  89. intrinsicName: "%DataViewPrototype%",
  90. globalNameOrSource: "DataView.prototype"
  91. },
  92. {
  93. intrinsicName: "%Date%",
  94. globalNameOrSource: "Date"
  95. },
  96. {
  97. intrinsicName: "%DatePrototype%",
  98. globalNameOrSource: "Date.prototype"
  99. },
  100. {
  101. intrinsicName: "%decodeURI%",
  102. globalNameOrSource: "decodeURI"
  103. },
  104. {
  105. intrinsicName: "%decodeURIComponent%",
  106. globalNameOrSource: "decodeURIComponent"
  107. },
  108. {
  109. intrinsicName: "%encodeURI%",
  110. globalNameOrSource: "encodeURI"
  111. },
  112. {
  113. intrinsicName: "%encodeURIComponent%",
  114. globalNameOrSource: "encodeURIComponent"
  115. },
  116. {
  117. intrinsicName: "%Error%",
  118. globalNameOrSource: "Error"
  119. },
  120. {
  121. intrinsicName: "%ErrorPrototype%",
  122. globalNameOrSource: "Error.prototype"
  123. },
  124. {
  125. intrinsicName: "%eval%",
  126. globalNameOrSource: "eval"
  127. },
  128. {
  129. intrinsicName: "%EvalError%",
  130. globalNameOrSource: "EvalError"
  131. },
  132. {
  133. intrinsicName: "%EvalErrorPrototype%",
  134. globalNameOrSource: "EvalError.prototype"
  135. },
  136. {
  137. intrinsicName: "%Float32Array%",
  138. globalNameOrSource: "Float32Array"
  139. },
  140. {
  141. intrinsicName: "%Float32ArrayPrototype%",
  142. globalNameOrSource: "Float32Array.prototype"
  143. },
  144. {
  145. intrinsicName: "%Float64Array%",
  146. globalNameOrSource: "Float64Array"
  147. },
  148. {
  149. intrinsicName: "%Float64ArrayPrototype%",
  150. globalNameOrSource: "Float64Array.prototype"
  151. },
  152. {
  153. intrinsicName: "%Function%",
  154. globalNameOrSource: "Function"
  155. },
  156. {
  157. intrinsicName: "%FunctionPrototype%",
  158. globalNameOrSource: "Function.prototype"
  159. },
  160. {
  161. intrinsicName: "%Generator%",
  162. globalNameOrSource: "Object.getPrototypeOf((function * () {})())"
  163. },
  164. {
  165. intrinsicName: "%GeneratorFunction%",
  166. globalNameOrSource: "Object.getPrototypeOf(function * () {})"
  167. },
  168. {
  169. intrinsicName: "%GeneratorPrototype%",
  170. globalNameOrSource: "Object.getPrototypeOf(function * () {}).prototype"
  171. },
  172. {
  173. intrinsicName: "%Int8Array%",
  174. globalNameOrSource: "Int8Array"
  175. },
  176. {
  177. intrinsicName: "%Int8ArrayPrototype%",
  178. globalNameOrSource: "Int8Array.prototype"
  179. },
  180. {
  181. intrinsicName: "%Int16Array%",
  182. globalNameOrSource: "Int16Array"
  183. },
  184. {
  185. intrinsicName: "%Int16ArrayPrototype%",
  186. globalNameOrSource: "Int16Array.prototype"
  187. },
  188. {
  189. intrinsicName: "%Int32Array%",
  190. globalNameOrSource: "Int32Array"
  191. },
  192. {
  193. intrinsicName: "%Int32ArrayPrototype%",
  194. globalNameOrSource: "Int32Array.prototype"
  195. },
  196. {
  197. intrinsicName: "%isFinite%",
  198. globalNameOrSource: "isFinite"
  199. },
  200. {
  201. intrinsicName: "%isNaN%",
  202. globalNameOrSource: "isNaN"
  203. },
  204. {
  205. intrinsicName: "%IteratorPrototype%",
  206. globalNameOrSource: "Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))"
  207. },
  208. {
  209. intrinsicName: "%JSON%",
  210. globalNameOrSource: "JSON"
  211. },
  212. {
  213. intrinsicName: "%JSONParse%",
  214. globalNameOrSource: "JSON.parse"
  215. },
  216. {
  217. intrinsicName: "%Map%",
  218. globalNameOrSource: "Map"
  219. },
  220. {
  221. intrinsicName: "%MapIteratorPrototype%",
  222. globalNameOrSource: "Object.getPrototypeOf(new Map()[Symbol.iterator]())"
  223. },
  224. {
  225. intrinsicName: "%MapPrototype%",
  226. globalNameOrSource: "Map.prototype"
  227. },
  228. {
  229. intrinsicName: "%Math%",
  230. globalNameOrSource: "Math"
  231. },
  232. {
  233. intrinsicName: "%Number%",
  234. globalNameOrSource: "Number"
  235. },
  236. {
  237. intrinsicName: "%NumberPrototype%",
  238. globalNameOrSource: "Number.prototype"
  239. },
  240. {
  241. intrinsicName: "%Object%",
  242. globalNameOrSource: "Object"
  243. },
  244. {
  245. intrinsicName: "%ObjectPrototype%",
  246. globalNameOrSource: "Object.prototype"
  247. },
  248. {
  249. intrinsicName: "%ObjProto_toString%",
  250. globalNameOrSource: "Object.prototype.toString"
  251. },
  252. {
  253. intrinsicName: "%ObjProto_valueOf%",
  254. globalNameOrSource: "Object.prototype.valueOf"
  255. },
  256. {
  257. intrinsicName: "%parseFloat%",
  258. globalNameOrSource: "parseFloat"
  259. },
  260. {
  261. intrinsicName: "%parseInt%",
  262. globalNameOrSource: "parseInt"
  263. },
  264. {
  265. intrinsicName: "%Promise%",
  266. globalNameOrSource: "Promise"
  267. },
  268. {
  269. intrinsicName: "%PromisePrototype%",
  270. globalNameOrSource: "Promise.prototype"
  271. },
  272. {
  273. intrinsicName: "%PromiseProto_then%",
  274. globalNameOrSource: "Promise.prototype.then"
  275. },
  276. {
  277. intrinsicName: "%Promise_all%",
  278. globalNameOrSource: "Promise.all"
  279. },
  280. {
  281. intrinsicName: "%Promise_reject%",
  282. globalNameOrSource: "Promise.reject"
  283. },
  284. {
  285. intrinsicName: "%Promise_resolve%",
  286. globalNameOrSource: "Promise.resolve"
  287. },
  288. {
  289. intrinsicName: "%Proxy%",
  290. globalNameOrSource: "Proxy"
  291. },
  292. {
  293. intrinsicName: "%RangeError%",
  294. globalNameOrSource: "RangeError"
  295. },
  296. {
  297. intrinsicName: "%RangeErrorPrototype%",
  298. globalNameOrSource: "RangeError.prototype"
  299. },
  300. {
  301. intrinsicName: "%ReferenceError%",
  302. globalNameOrSource: "ReferenceError"
  303. },
  304. {
  305. intrinsicName: "%ReferenceErrorPrototype%",
  306. globalNameOrSource: "ReferenceError.prototype"
  307. },
  308. {
  309. intrinsicName: "%Reflect%",
  310. globalNameOrSource: "Reflect"
  311. },
  312. {
  313. intrinsicName: "%RegExp%",
  314. globalNameOrSource: "RegExp"
  315. },
  316. {
  317. intrinsicName: "%RegExpPrototype%",
  318. globalNameOrSource: "RegExp.prototype"
  319. },
  320. {
  321. intrinsicName: "%Set%",
  322. globalNameOrSource: "Set"
  323. },
  324. {
  325. intrinsicName: "%SetIteratorPrototype%",
  326. globalNameOrSource: "Object.getPrototypeOf(new Set()[Symbol.iterator]())"
  327. },
  328. {
  329. intrinsicName: "%SetPrototype%",
  330. globalNameOrSource: "Set.prototype"
  331. },
  332. {
  333. intrinsicName: "%SharedArrayBuffer%",
  334. globalNameOrSource: "SharedArrayBuffer"
  335. },
  336. {
  337. intrinsicName: "%SharedArrayBufferPrototype%",
  338. globalNameOrSource: "SharedArrayBuffer.prototype"
  339. },
  340. {
  341. intrinsicName: "%String%",
  342. globalNameOrSource: "String"
  343. },
  344. {
  345. intrinsicName: "%StringIteratorPrototype%",
  346. globalNameOrSource: "Object.getPrototypeOf(new String()[Symbol.iterator]())"
  347. },
  348. {
  349. intrinsicName: "%StringPrototype%",
  350. globalNameOrSource: "String.prototype"
  351. },
  352. {
  353. intrinsicName: "%Symbol%",
  354. globalNameOrSource: "Symbol"
  355. },
  356. {
  357. intrinsicName: "%SymbolPrototype%",
  358. globalNameOrSource: "Symbol.prototype"
  359. },
  360. {
  361. intrinsicName: "%SyntaxError%",
  362. globalNameOrSource: "SyntaxError"
  363. },
  364. {
  365. intrinsicName: "%SyntaxErrorPrototype%",
  366. globalNameOrSource: "SyntaxError.prototype"
  367. },
  368. {
  369. intrinsicName: "%ThrowTypeError%",
  370. globalNameOrSource: "(function() { 'use strict'; return Object.getOwnPropertyDescriptor(arguments, 'callee').get })()"
  371. },
  372. {
  373. intrinsicName: "%TypedArray%",
  374. globalNameOrSource: "Object.getPrototypeOf(Uint8Array)"
  375. },
  376. {
  377. intrinsicName: "%TypedArrayPrototype%",
  378. globalNameOrSource: "Object.getPrototypeOf(Uint8Array).prototype"
  379. },
  380. {
  381. intrinsicName: "%TypeError%",
  382. globalNameOrSource: "TypeError"
  383. },
  384. {
  385. intrinsicName: "%TypeErrorPrototype%",
  386. globalNameOrSource: "TypeError.prototype"
  387. },
  388. {
  389. intrinsicName: "%Uint8Array%",
  390. globalNameOrSource: "Uint8Array"
  391. },
  392. {
  393. intrinsicName: "%Uint8ArrayPrototype%",
  394. globalNameOrSource: "Uint8Array.prototype"
  395. },
  396. {
  397. intrinsicName: "%Uint8ClampedArray%",
  398. globalNameOrSource: "Uint8ClampedArray"
  399. },
  400. {
  401. intrinsicName: "%Uint8ClampedArrayPrototype%",
  402. globalNameOrSource: "Uint8ClampedArray.prototype"
  403. },
  404. {
  405. intrinsicName: "%Uint16Array%",
  406. globalNameOrSource: "Uint16Array"
  407. },
  408. {
  409. intrinsicName: "%Uint16ArrayPrototype%",
  410. globalNameOrSource: "Uint16Array.prototype"
  411. },
  412. {
  413. intrinsicName: "%Uint32Array%",
  414. globalNameOrSource: "Uint32Array"
  415. },
  416. {
  417. intrinsicName: "%Uint32ArrayPrototype%",
  418. globalNameOrSource: "Uint32Array.prototype"
  419. },
  420. {
  421. intrinsicName: "%URIError%",
  422. globalNameOrSource: "URIError"
  423. },
  424. {
  425. intrinsicName: "%URIErrorPrototype%",
  426. globalNameOrSource: "URIError.prototype"
  427. },
  428. {
  429. intrinsicName: "%WeakMap%",
  430. globalNameOrSource: "WeakMap"
  431. },
  432. {
  433. intrinsicName: "%WeakMapPrototype%",
  434. globalNameOrSource: "WeakMap.prototype"
  435. },
  436. {
  437. intrinsicName: "%WeakSet%",
  438. globalNameOrSource: "WeakSet"
  439. },
  440. {
  441. intrinsicName: "%WeakSetPrototype%",
  442. globalNameOrSource: "WeakSet.prototype"
  443. }
  444. ];
  445. WellKnownIntrinsicObjects.forEach(wkio => {
  446. var actual;
  447. try {
  448. actual = new Function("return " + wkio.globalNameOrSource)();
  449. } catch (exception) {
  450. // Nothing to do here.
  451. }
  452. wkio.reference = actual;
  453. });