1#
2#  Built-in objects
3#
4
5# YAML conventions:
6#
7#   - Indent by two, indent lists of objects too.
8#   - Quoted used for keys, explicit string values, hex data, attributes.
9#     Not used for classes, built-in ID values, etc, unless necessary.
10#   - Double quotes used throughout to allow escaping.
11#
12# Top level object format is mostly self explanatory, a few notes:
13#
14#    - The "id" string is used for referencing objects from property table
15#    - Class names must match array in genbuiltins.py
16#    - If the top level object is a function:
17#      - varargs: if true, function is vararg (nargs = DUK_VARARGS)
18#      - nargs: nargs (ignored if varargs true); if missing, default from 'length' property
19#      - magic: see below
20#      - native: native function name
21#      - callable: true/false, depending on function
22#      - constructable: true/false, depending on function
23#      - special_call: true/false, used for .call(), .apply(), etc which
24#        need special casing in runtime call handling
25#    - To disable an object without removing its metadata, you can
26#      use 'disable: true'.
27#    - If the object is dependent on Duktape configuration, you can make the
28#      object optional using e.g. 'present_if: DUK_USE_BUFFEROBJECT_SUPPORT'.
29#      If the value is a list, the object is present if all listed options are
30#      enabled (logical AND).
31#    - If the object needs a DUK_BIDX_xxx define in Duktape source code, which
32#      also implies it'll get a slot in thr->builtins[] array, use 'bidx: true'.
33#
34# Property format:
35#
36#    - key: verbatim string key, codepoints U+0000...U+00FF map to bytes,
37#           so that \u0082 is 0x82 prefix, \u00FF is 0xFF prefix, etc.  Key
38#           can also be a symbol, with the same format as for symbol values.
39#    - value: see below
40#    - attributes: string of format /w?e?c?a?/, e.g. "wc" is writable and
41#                  configurable
42#        + w: writable
43#        + e: enumerable
44#        + c: configurable
45#        + a: accessor (determined automatically, not necessary to give explicitly)
46#    - auto_lightfunc: if true (which is default), function property may be
47#      automatically converted to a lightfunc if other automatic lightfunc
48#      conversion criteria are met; use "auto_lightfunc: false" to prevent
49#      lightfunc conversion
50#    - May also have feature tags like "es6: true" to indicate property
51#      is related to a specific standard
52#    - To disable a property without removing its metadata, you can use
53#      'disable: true'.
54#    - If the property is dependent on Duktape configuration, you can make the
55#      property optional using e.g. 'present_if: DUK_USE_BUFFEROBJECT_SUPPORT'.
56#      List of options is interpreted as for objects (logical AND).
57#
58# Property value format:
59#
60#    - ECMAScript undefined:
61#      - type: undefined
62#    - Plain YAML/JSON null (parses as Python None)
63#      - treated as ECMAScript null
64#    - Plain string:
65#      - treated as plain string, string data as with keys
66#    - Plain symbol:
67#      - type: symbol
68#      - variant: global, wellknown, hidden, userhidden
69#      - string: symbol string without any prefix
70#      - NOTE: ES2015 well-known symbols are local symbols with 'string' as
71#        their description, and a fixed suffix never overlapping with
72#        runtime local symbols
73#      - NOTE: "hidden symbols" are Duktape specific internal properties
74#        (called just internal properties in 1.x)
75#    - Plain number:
76#      - treated as a fastint/ieee double
77#    - IEEE double:
78#      - type: double
79#      - bytes: IEEE bytes in big endian format, hex encoded
80#      - NOTE: if you define a NaN, make sure it is in the Duktape normalized
81#        form (see bi_global 'NaN' property): otherwise strange things will
82#        happen with packed duk_tval
83#    - Buffer:
84#      - type: buffer
85#      - NOTE: not supported yet, type is reserved
86#    - Pointer:
87#      - type: pointer
88#      - NOTE: not supported yet, type is reserved
89#    - Lightfunc:
90#      - type: lightfunc
91#      - native: native function name
92#      - magic: -128 to 127
93#      - length: 0 to 15
94#      - nargs: 0 to 14; or varargs: true
95#      - varargs: if true, target has variable arguments
96#    - Reference to a built-in object:
97#      - type: object
98#        id: ID string of target object
99#    - Accessor (setter/getter):
100#      - type: accessor
101#      - getter_id: object ID of getter
102#      - setter_id: object ID of setter
103#    - Native function shorthand; alternative to defining a function as a
104#      native object and referencing it using an ID:
105#      - type: function (implicitly callable)
106#      - callable: default is true
107#      - constructable: default is false
108#      - native: native function name
109#      - length: function .length (optional, defaults to 0)
110#      - nargs: function nargs (optional, defaults to length)
111#      - varargs: if true, function is vararg (nargs = DUK_VARARGS)
112#      - magic: magic value for function (see below)
113#      - name: optional, provides .name property (non-writable, non-enumerable, non-configurable)
114#      - special_call: recognized in shorthand
115#    - Accessor (setter/getter) shorthand:
116#      - type: accessor
117#      - callable: default is true
118#      - constructable: default is false
119#      - getter: native function name
120#      - setter: native function name
121#      - getter_magic: magic value for getter
122#      - setter_magic: magic value for setter
123#      - getter_nargs: nargs value for getter
124#      - setter_nargs: nargs value for setter
125#      - getter_length: length value for getter (0 if missing)
126#      - setter_length: length value for setter (0 if missing)
127#    - Structured object shorthand:
128#      - type: structured
129#      - value: arbitrary JSON-like value
130#      - NOTE: value is converted into object(s) with properties
131#        similarly to JSON.parse() results: properties will be
132#        writable, enumerable, and configurable, inherit from
133#        Object.prototype, etc.
134#
135# Magic format:
136#
137#    - Plain number: direct magic value
138#    - Array iterator magic:
139#      - type: array_iter
140#      - funcname: function name, e.g. "forEach"
141#    - Built-in object index:
142#      - type: bidx
143#      - id: id of built-object, idx to thr->builtins[]
144#    - One-argument math function:
145#      - type: math_onearg
146#      - funcname: name of function, e.g. "cos"
147#    - Two-argument math function:
148#      - type: math_twoarg
149#      - funcname: name of function, e.g. "atan2"
150#    - Typed array constructor
151#      - type: typedarray_constructor
152#      - elem: element type, e.g. "int8"
153#      - shift: shift for element size (0 = 1 byte element, 2 = 4 byte element etc)
154
155objects:
156
157  # internal prototype: implementation specific
158  #  Smjs: Object.prototype
159  #  Rhino: Object.prototype
160  #  V8: *not* Object.prototype, but prototype chain includes Object.prototype
161  # external prototype: apparently not set
162  # external constructor: apparently not set
163  # internal class: implemented specific
164  #  Smjs: "global"
165  #  Rhino: "global"
166  #  V8: "global"
167  #
168  # E5 Sections B.2.1 and B.2.2 describe non-standard properties which are
169  # included below but flagged as extensions.
170
171  - id: bi_global
172    class: global
173    internal_prototype: bi_object_prototype
174    bidx: true
175
176    properties:
177      # 'globalThis' binding giving easy to access to the global object.
178      # Not yet standard, see https://github.com/tc39/proposal-global.
179      - key: "globalThis"
180        value:
181          type: object
182          id: bi_global
183        attributes: "wc"
184        # This could be stripped when DUK_USE_GLOBAL_BUILTIN is disabled
185        # but keep for now (the property is quite fundamental).
186        present_if: DUK_USE_GLOBAL_BINDING
187
188      - key: "NaN"
189        value:
190          type: double
191          bytes: "7ff8000000000000"  # DBL_NAN
192        attributes: ""
193        present_if: DUK_USE_GLOBAL_BUILTIN
194      - key: "Infinity"
195        value:
196          type: double
197          bytes: "7ff0000000000000"  # DBL_POSITIVE_INFINITY
198        attributes: ""
199        present_if: DUK_USE_GLOBAL_BUILTIN
200      - key: "undefined"
201        value:
202          type: undefined
203        attributes: ""
204        # This could be stripped when DUK_USE_GLOBAL_BUILTIN is disabled
205        # ("void 0" is the same and safer) but it's commonly used so keep.
206
207      - key: "Object"
208        value:
209          type: object
210          id: bi_object_constructor
211        present_if: DUK_USE_OBJECT_BUILTIN
212      - key: "Function"
213        value:
214          type: object
215          id: bi_function_constructor
216        present_if: DUK_USE_FUNCTION_BUILTIN
217      - key: "Array"
218        value:
219          type: object
220          id: bi_array_constructor
221        present_if: DUK_USE_ARRAY_BUILTIN
222      - key: "String"
223        value:
224          type: object
225          id: bi_string_constructor
226        present_if: DUK_USE_STRING_BUILTIN
227      - key: "Boolean"
228        value:
229          type: object
230          id: bi_boolean_constructor
231        present_if: DUK_USE_BOOLEAN_BUILTIN
232      - key: "Number"
233        value:
234          type: object
235          id: bi_number_constructor
236        present_if: DUK_USE_NUMBER_BUILTIN
237      - key: "Date"
238        value:
239          type: object
240          id: bi_date_constructor
241        present_if: DUK_USE_DATE_BUILTIN
242      - key: "RegExp"
243        value:
244          type: object
245          id: bi_regexp_constructor
246        present_if: DUK_USE_REGEXP_SUPPORT
247      - key: "Error"
248        value:
249          type: object
250          id: bi_error_constructor
251      - key: "EvalError"
252        value:
253          type: object
254          id: bi_eval_error_constructor
255      - key: "RangeError"
256        value:
257          type: object
258          id: bi_range_error_constructor
259      - key: "ReferenceError"
260        value:
261          type: object
262          id: bi_reference_error_constructor
263      - key: "SyntaxError"
264        value:
265          type: object
266          id: bi_syntax_error_constructor
267      - key: "TypeError"
268        value:
269          type: object
270          id: bi_type_error_constructor
271      - key: "URIError"
272        value:
273          type: object
274          id: bi_uri_error_constructor
275      - key: "Math"
276        value:
277          type: object
278          id: bi_math
279        present_if: DUK_USE_MATH_BUILTIN
280      - key: "JSON"
281        value:
282          type: object
283          id: bi_json
284        present_if: DUK_USE_JSON_BUILTIN
285
286      # CBOR
287      - key: "CBOR"
288        value:
289          type: object
290          id: bi_cbor
291        present_if: DUK_USE_CBOR_BUILTIN
292
293      # Duktape specific
294      - key: "Duktape"
295        value:
296          type: object
297          id: bi_duktape
298        duktape: true
299        # Remains present even when disabled: needed for error augmentation internally.
300        #present_if: DUK_USE_DUKTAPE_BUILTIN
301
302      # ES2015
303      - key: "Proxy"
304        value:
305          type: object
306          id: bi_proxy_constructor
307        es6: true
308        present_if: DUK_USE_ES6_PROXY
309      - key: "Reflect"
310        value:
311          type: object
312          id: bi_reflect
313        es6: true
314        present_if: DUK_USE_REFLECT_BUILTIN
315      - key: "Symbol"
316        value:
317          type: object
318          id: bi_symbol_constructor
319        es6: true
320        present_if: DUK_USE_SYMBOL_BUILTIN
321      - key: "Promise"
322        value:
323          type: object
324          id: bi_promise_constructor
325        es6: true
326        present_if: DUK_USE_PROMISE_BUILTIN
327
328      # Node.js Buffer
329      - key: "Buffer"
330        value:
331          type: object
332          id: bi_nodejs_buffer_constructor
333        nodejs_buffer: true
334        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
335
336      # TypedArray
337      - key: "ArrayBuffer"
338        value:
339          type: object
340          id: bi_arraybuffer_constructor
341        typedarray: true
342        es6: true
343        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
344      - key: "DataView"
345        value:
346          type: object
347          id: bi_dataview_constructor
348        typedarray: true
349        es6: true
350        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
351      - key: "Int8Array"
352        value:
353          type: object
354          id: bi_int8array_constructor
355        typedarray: true
356        es6: true
357        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
358      - key: "Uint8Array"
359        value:
360          type: object
361          id: bi_uint8array_constructor
362        typedarray: true
363        es6: true
364        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
365      - key: "Uint8ClampedArray"
366        value:
367          type: object
368          id: bi_uint8clampedarray_constructor
369        typedarray: true
370        es6: true
371        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
372      - key: "Int16Array"
373        value:
374          type: object
375          id: bi_int16array_constructor
376        typedarray: true
377        es6: true
378        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
379      - key: "Uint16Array"
380        value:
381          type: object
382          id: bi_uint16array_constructor
383        typedarray: true
384        es6: true
385        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
386      - key: "Int32Array"
387        value:
388          type: object
389          id: bi_int32array_constructor
390        typedarray: true
391        es6: true
392        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
393      - key: "Uint32Array"
394        value:
395          type: object
396          id: bi_uint32array_constructor
397        typedarray: true
398        es6: true
399        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
400      - key: "Float32Array"
401        value:
402          type: object
403          id: bi_float32array_constructor
404        typedarray: true
405        es6: true
406        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
407      - key: "Float64Array"
408        value:
409          type: object
410          id: bi_float64array_constructor
411        typedarray: true
412        es6: true
413        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
414
415      # Functions
416      - key: "eval"
417        value:
418          type: function
419          native: duk_bi_global_object_eval
420          length: 1
421          magic: 15  # see duk_js_call.c
422          special_call: true
423        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
424        present_if: DUK_USE_GLOBAL_BUILTIN
425      - key: "parseInt"
426        value:
427          type: object
428          id: bi_parse_int
429        present_if: DUK_USE_GLOBAL_BUILTIN
430      - key: "parseFloat"
431        value:
432          type: object
433          id: bi_parse_float
434        present_if: DUK_USE_GLOBAL_BUILTIN
435      - key: "isNaN"
436        value:
437          type: function
438          native: duk_bi_global_object_is_nan
439          length: 1
440        present_if: DUK_USE_GLOBAL_BUILTIN
441      - key: "isFinite"
442        value:
443          type: function
444          native: duk_bi_global_object_is_finite
445          length: 1
446        present_if: DUK_USE_GLOBAL_BUILTIN
447      - key: "decodeURI"
448        value:
449          type: function
450          native: duk_bi_global_object_decode_uri
451          length: 1
452        present_if: DUK_USE_GLOBAL_BUILTIN
453      - key: "decodeURIComponent"
454        value:
455          type: function
456          native: duk_bi_global_object_decode_uri_component
457          length: 1
458        present_if: DUK_USE_GLOBAL_BUILTIN
459      - key: "encodeURI"
460        value:
461          type: function
462          native: duk_bi_global_object_encode_uri
463          length: 1
464        present_if: DUK_USE_GLOBAL_BUILTIN
465      - key: "encodeURIComponent"
466        value:
467          type: function
468          native: duk_bi_global_object_encode_uri_component
469          length: 1
470        present_if: DUK_USE_GLOBAL_BUILTIN
471
472      # Non-standard extensions: E5 Sections B.2.1 and B.2.2
473      #
474      # "length" is not specified explicitly in E5 but it follows the
475      # general argument count rule.  V8 also agrees on the lengths.
476
477      - key: "escape"
478        value:
479          type: function
480          native: duk_bi_global_object_escape
481          length: 1
482        section_b: true
483        present_if:
484          - DUK_USE_SECTION_B
485          - DUK_USE_GLOBAL_BUILTIN
486      - key: "unescape"
487        value:
488          type: function
489          native: duk_bi_global_object_unescape
490          length: 1
491        section_b: true
492        present_if:
493          - DUK_USE_SECTION_B
494          - DUK_USE_GLOBAL_BUILTIN
495
496      # Encoding API: https://encoding.spec.whatwg.org/
497      - key: "TextEncoder"
498        value:
499          type: object
500          id: bi_textencoder_constructor
501        encoding_api: true
502        present_if: DUK_USE_ENCODING_BUILTINS
503      - key: "TextDecoder"
504        value:
505          type: object
506          id: bi_textdecoder_constructor
507        encoding_api: true
508        present_if: DUK_USE_ENCODING_BUILTINS
509
510      # High resolution time API: https://www.w3.org/TR/hr-time/
511      # Firefox and Chrome: accessor with 'ec' attributes, setter
512      # allows overwrite.
513      # Use data property with 'wec' for now.
514      - key: "performance"
515        value:
516          type: object
517          id: bi_performance
518        attributes: "wec"
519        performance_api: true
520        present_if: DUK_USE_PERFORMANCE_BUILTIN
521
522  - id: bi_parse_int
523    class: Function
524    internal_prototype: bi_function_prototype
525    native: duk_bi_global_object_parse_int
526    callable: true
527    constructable: false
528    bidx: false
529    present_if: DUK_USE_OBJECT_BUILTIN
530
531    properties:
532      - key: "length"
533        value: 2
534        attributes: "c"
535
536  - id: bi_parse_float
537    class: Function
538    internal_prototype: bi_function_prototype
539    native: duk_bi_global_object_parse_float
540    callable: true
541    constructable: false
542    bidx: false
543    present_if: DUK_USE_OBJECT_BUILTIN
544
545    properties:
546      - key: "length"
547        value: 1
548        attributes: "c"
549
550  - id: bi_global_env
551    class: ObjEnv
552    duktape: true
553    bidx: true
554
555    # The internal 'target' property is now part of duk_hobjenv and handled
556    # specially by RAM built-in init code.  ROM built-ins provide an explicit
557    # initializer based on these properties.
558
559    objenv_target: bi_global
560    objenv_has_this: 0
561
562    properties: []
563
564  - id: bi_object_constructor
565    class: Function
566    internal_prototype: bi_function_prototype
567    native: duk_bi_object_constructor
568    callable: true
569    constructable: true
570    bidx: true
571    present_if: DUK_USE_OBJECT_BUILTIN
572
573    properties:
574      - key: "length"
575        value: 1
576        attributes: "c"
577      - key: "prototype"
578        value:
579          type: object
580          id: bi_object_prototype
581        attributes: ""
582      - key: "name"
583        value: "Object"
584        attributes: "c"
585
586      - key: "getPrototypeOf"
587        value:
588          type: function
589          native: duk_bi_object_getprototype_shared
590          length: 1
591          magic: 1
592      - key: "setPrototypeOf"
593        value:
594          type: function
595          native: duk_bi_object_setprototype_shared
596          length: 2
597          magic: 1
598        es6: true
599      - key: "getOwnPropertyDescriptor"
600        value:
601          type: function
602          native: duk_bi_object_constructor_get_own_property_descriptor
603          length: 2
604          magic: 0
605      - key: "getOwnPropertyNames"
606        value:
607          type: function
608          native: duk_bi_object_constructor_keys_shared
609          length: 1
610          magic: 1
611      - key: "assign"
612        value:
613          type: function
614          native: duk_bi_object_constructor_assign
615          length: 2
616          varargs: true
617        es6: true
618        present_if: DUK_USE_ES6
619      - key: "create"
620        value:
621          type: function
622          native: duk_bi_object_constructor_create
623          length: 2
624      - key: "defineProperty"
625        value:
626          type: function
627          native: duk_bi_object_constructor_define_property
628          length: 3
629          magic: 0
630      - key: "defineProperties"
631        value:
632          type: function
633          native: duk_bi_object_constructor_define_properties
634          length: 2
635      - key: "seal"
636        value:
637          type: function
638          native: duk_bi_object_constructor_seal_freeze_shared
639          length: 1
640          magic: 0
641      - key: "freeze"
642        value:
643          type: function
644          native: duk_bi_object_constructor_seal_freeze_shared
645          length: 1
646          magic: 1
647      - key: "preventExtensions"
648        value:
649          type: function
650          native: duk_bi_object_constructor_prevent_extensions
651          length: 1
652          magic: 0
653      - key: "isSealed"
654        value:
655          type: function
656          native: duk_bi_object_constructor_is_sealed_frozen_shared
657          length: 1
658          magic: 0
659      - key: "isFrozen"
660        value:
661          type: function
662          native: duk_bi_object_constructor_is_sealed_frozen_shared
663          length: 1
664          magic: 1
665      - key: "isExtensible"
666        value:
667          type: function
668          native: duk_bi_object_constructor_is_extensible
669          length: 1
670          magic: 0
671      - key: "keys"
672        value:
673          type: function
674          native: duk_bi_object_constructor_keys_shared
675          length: 1
676          magic: 0
677      - key: "getOwnPropertySymbols"
678        value:
679          type: function
680          native: duk_bi_object_constructor_keys_shared
681          length: 1
682          magic: 2
683        es6: true
684        present_if: DUK_USE_ES6
685      - key: "is"
686        value:
687          type: function
688          native: duk_bi_object_constructor_is
689          length: 2
690          nargs: 2
691        es6: true
692        present_if: DUK_USE_ES6
693
694  - id: bi_object_prototype
695    class: Object
696    # internal_prototype: null
697    bidx: true
698    # Present even when DUK_USE_OBJECT_BUILTIN disabled.
699
700    properties:
701      - key: "constructor"
702        value:
703          type: object
704          id: bi_object_constructor
705        attributes: "wc"
706        present_if: DUK_USE_OBJECT_BUILTIN
707
708      - key: "__proto__"
709        value:
710          type: accessor
711          getter: duk_bi_object_getprototype_shared
712          setter: duk_bi_object_setprototype_shared
713          getter_nargs: 0
714          setter_nargs: 1
715          getter_magic: 0
716          setter_magic: 0
717        attributes: "c"  # configurable in ES2015, also V8
718        es6: true  # also non-standard legacy
719        present_if: DUK_USE_OBJECT_BUILTIN
720
721      - key: "toString"
722        value:
723          type: function
724          native: duk_bi_object_prototype_to_string
725          length: 0
726        present_if: DUK_USE_OBJECT_BUILTIN
727      - key: "toLocaleString"
728        value:
729          type: function
730          native: duk_bi_object_prototype_to_locale_string
731          length: 0
732        present_if: DUK_USE_OBJECT_BUILTIN
733      - key: "valueOf"
734        value:
735          type: function
736          native: duk_bi_object_prototype_value_of
737          length: 0
738        present_if: DUK_USE_OBJECT_BUILTIN
739      - key: "hasOwnProperty"
740        value:
741          type: function
742          native: duk_bi_object_prototype_has_own_property
743          length: 1
744        present_if: DUK_USE_OBJECT_BUILTIN
745      - key: "isPrototypeOf"
746        value:
747          type: function
748          native: duk_bi_object_prototype_is_prototype_of
749          length: 1
750        present_if: DUK_USE_OBJECT_BUILTIN
751      - key: "propertyIsEnumerable"
752        value:
753          type: function
754          native: duk_bi_object_prototype_property_is_enumerable
755          length: 1
756        present_if: DUK_USE_OBJECT_BUILTIN
757
758      # __defineGetter, __defineSetter__, __lookupGetter__, __lookupSetter__: ES2017 Annex B
759      # https://tc39.github.io/ecma262/#sec-additional-properties-of-the-object.prototype-object
760
761      - key: "__defineGetter__"
762        value:
763          type: function
764          native: duk_bi_object_prototype_defineaccessor
765          length: 2
766          magic: 0  # define getter
767        present_if: DUK_USE_ES8
768      - key: "__defineSetter__"
769        value:
770          type: function
771          native: duk_bi_object_prototype_defineaccessor
772          length: 2
773          magic: 1  # define setter
774        present_if: DUK_USE_ES8
775      - key: "__lookupGetter__"
776        value:
777          type: function
778          native: duk_bi_object_prototype_lookupaccessor
779          length: 1
780          magic: 0  # lookup getter
781        present_if: DUK_USE_ES8
782      - key: "__lookupSetter__"
783        value:
784          type: function
785          native: duk_bi_object_prototype_lookupaccessor
786          length: 1
787          magic: 1  # lookup setter
788        present_if: DUK_USE_ES8
789
790  - id: bi_function_constructor
791    class: Function
792    internal_prototype: bi_function_prototype
793    varargs: true
794    native: duk_bi_function_constructor
795    callable: true
796    constructable: true
797    bidx: true
798    present_if: DUK_USE_FUNCTION_BUILTIN
799
800    properties:
801      - key: "length"
802        value: 1
803        attributes: "c"
804      - key: "prototype"
805        value:
806          type: object
807          id: bi_function_prototype
808        attributes: ""
809      - key: "name"
810        value: "Function"
811        attributes: "c"
812
813  # Note, unlike other prototype objects, Function.prototype is itself
814  # a Function and callable.  When invoked, it accepts any arguments
815  # and returns undefined.  It cannot be called as a constructor.
816  # See E5 Section 15.3.4.
817  - id: bi_function_prototype
818    class: Function
819    internal_prototype: bi_object_prototype
820    native: duk_bi_function_prototype
821    callable: true
822    constructable: false
823    bidx: true
824    nargs: 0  # given explicitly because .length is optional
825    # Present even when DUK_USE_FUNCTION_BUILTIN disabled.
826
827    properties:
828      - key: "length"
829        value: 0
830        attributes: "c"
831        present_if: DUK_USE_FUNCTION_BUILTIN
832      - key: "constructor"
833        value:
834          type: object
835          id: bi_function_constructor
836        attributes: "wc"
837        present_if: DUK_USE_FUNCTION_BUILTIN
838
839      # In ES2015 Function.prototype.name is not writable, but is configurable.
840      - key: "name"
841        value: ""
842        attributes: "c"
843        #present_if: DUK_USE_FUNCTION_BUILTIN  # Kept even when prototype is otherwise empty to guarantee a .name for functions
844
845      # test262 ch15/15.3/15.3.4/15.3.4.2/S15.3.4.2_A11 checks that Function.prototype.toString.length
846      # is zero, cannot find specification support for that but 0 is a good value.
847      - key: "toString"
848        value:
849          type: function
850          native: duk_bi_function_prototype_to_string
851          length: 0
852        present_if: DUK_USE_FUNCTION_BUILTIN
853      - key: "apply"
854        value:
855          type: function
856          native: duk_bi_function_prototype_apply
857          length: 2
858          magic: 1  # see duk_js_call.c
859          special_call: true
860        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
861        present_if: DUK_USE_FUNCTION_BUILTIN
862      - key: "call"
863        value:
864          type: function
865          native: duk_bi_function_prototype_call
866          length: 1
867          magic: 0  # see duk_js_call.c
868          varargs: true
869          special_call: true
870        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
871        present_if: DUK_USE_FUNCTION_BUILTIN
872      - key: "bind"
873        value:
874          type: function
875          native: duk_bi_function_prototype_bind
876          length: 1
877          varargs: true
878        present_if: DUK_USE_FUNCTION_BUILTIN
879
880      # ES2015
881      - key:  # @@hasInstance
882          type: symbol
883          variant: wellknown
884          string: "Symbol.hasInstance"
885        value:
886          type: function
887          native: duk_bi_function_prototype_hasinstance
888          length: 1
889        attributes: ""
890        es6: true
891        present_if: DUK_USE_SYMBOL_BUILTIN
892
893  # Duktape specific %NativeFunctionPrototype% which provides some getters.
894  #
895  - id: bi_native_function_prototype
896    class: Object
897    internal_prototype: bi_function_prototype
898    native: duk_bi_function_prototype
899    bidx: true
900    duktape: true
901    # Present even when DUK_USE_FUNCTION_BUILTIN disabled.
902
903    properties:
904      - key: "length"
905        value:
906          type: accessor
907          getter: duk_bi_native_function_length
908          getter_nargs: 0
909          getter_magic: 0
910          # Setter undefined: direct write fails (defineProperty() works).
911          # This mimics ES2015 function (own property) .length which is
912          # not writable but configurable.
913        attributes: "c"
914        #present_if: DUK_USE_FUNCTION_BUILTIN  # Kept to guarantee a .length for lightfuncs
915      - key: "name"
916        value:
917          type: accessor
918          getter: duk_bi_native_function_name
919          getter_nargs: 0
920          getter_magic: 0
921          # Setter undefined: direct write fails (defineProperty() works).
922          # This mimics ES2015 function (own property) .name which is
923          # not writable but configurable.
924        attributes: "c"
925        #present_if: DUK_USE_FUNCTION_BUILTIN  # Kept to guarantee a .name for lightfuncs
926
927  - id: bi_array_constructor
928    class: Function
929    internal_prototype: bi_function_prototype
930    varargs: true
931    native: duk_bi_array_constructor
932    callable: true
933    constructable: true
934    bidx: true
935    present_if: DUK_USE_ARRAY_BUILTIN
936
937    properties:
938      - key: "length"
939        value: 1
940        attributes: "c"
941      - key: "prototype"
942        value:
943          type: object
944          id: bi_array_prototype
945        attributes: ""
946      - key: "name"
947        value: "Array"
948        attributes: "c"
949      - key: "isArray"
950        value:
951          type: function
952          native: duk_bi_array_constructor_is_array
953          length: 1
954
955      #- key:  # @@species
956      #    type: symbol
957      #    variant: wellknown
958      #    string: "Symbol.species"
959      #  value: XXX
960      #  es6: true
961
962  - id: bi_array_prototype
963    class: Array
964    internal_prototype: bi_object_prototype
965    bidx: true
966    # Present even when DUK_USE_ARRAY_BUILTIN disabled.
967
968    # An array prototype is an Array itself.  It has a length property initialized to 0,
969    # with property attributes: writable, non-configurable, non-enumerable.  The attributes
970    # are not specified very explicitly for the prototype, but are given for Array instances
971    # in E5 Section 15.4.5.2 (and this matches the behavior of e.g. V8).
972
973    properties:
974      # With duk_harray added to the internal representation, .length is now virtual.
975      #- key: "length"
976      #  value: 0
977      #  attributes: "w"
978      - key: "constructor"
979        value:
980          type: object
981          id: bi_array_constructor
982        attributes: "wc"
983        present_if: DUK_USE_ARRAY_BUILTIN
984      - key: "toString"
985        value:
986          type: function
987          native: duk_bi_array_prototype_to_string
988          length: 0
989        present_if: DUK_USE_ARRAY_BUILTIN
990      - key: "toLocaleString"
991        value:
992          type: function
993          native: duk_bi_array_prototype_join_shared
994          length: 0
995          magic: 1  # magic: to_locale_string, here 1
996        present_if: DUK_USE_ARRAY_BUILTIN
997      - key: "concat"
998        value:
999          type: function
1000          native: duk_bi_array_prototype_concat
1001          length: 1
1002          varargs: true
1003        present_if: DUK_USE_ARRAY_BUILTIN
1004      - key: "join"
1005        value:
1006          type: function
1007          native: duk_bi_array_prototype_join_shared
1008          length: 1
1009          magic: 0  # magic: to_locale_string, here 0
1010        present_if: DUK_USE_ARRAY_BUILTIN
1011      - key: "pop"
1012        value:
1013          type: function
1014          native: duk_bi_array_prototype_pop
1015          length: 0
1016        present_if: DUK_USE_ARRAY_BUILTIN
1017      - key: "push"
1018        value:
1019          type: function
1020          native: duk_bi_array_prototype_push
1021          length: 1
1022          varargs: true
1023        present_if: DUK_USE_ARRAY_BUILTIN
1024      - key: "reverse"
1025        value:
1026          type: function
1027          native: duk_bi_array_prototype_reverse
1028          length: 0
1029        present_if: DUK_USE_ARRAY_BUILTIN
1030      - key: "shift"
1031        value:
1032          type: function
1033          native: duk_bi_array_prototype_shift
1034          length: 0
1035        present_if: DUK_USE_ARRAY_BUILTIN
1036      - key: "slice"
1037        value:
1038          type: function
1039          native: duk_bi_array_prototype_slice
1040          length: 2
1041        present_if: DUK_USE_ARRAY_BUILTIN
1042      - key: "sort"
1043        value:
1044          type: function
1045          native: duk_bi_array_prototype_sort
1046          length: 1
1047        present_if: DUK_USE_ARRAY_BUILTIN
1048      - key: "splice"
1049        value:
1050          type: function
1051          native: duk_bi_array_prototype_splice
1052          length: 2
1053          varargs: true
1054        present_if: DUK_USE_ARRAY_BUILTIN
1055      - key: "unshift"
1056        value:
1057          type: function
1058          native: duk_bi_array_prototype_unshift
1059          length: 1
1060          varargs: true
1061        present_if: DUK_USE_ARRAY_BUILTIN
1062      - key: "indexOf"
1063        value:
1064          type: function
1065          native: duk_bi_array_prototype_indexof_shared
1066          length: 1
1067          varargs: true
1068          magic: 1  # magic: idx_step = +1
1069        present_if: DUK_USE_ARRAY_BUILTIN
1070      - key: "lastIndexOf"
1071        value:
1072          type: function
1073          native: duk_bi_array_prototype_indexof_shared
1074          length: 1
1075          varargs: true
1076          magic: -1  # magic: idx_step = -1
1077        present_if: DUK_USE_ARRAY_BUILTIN
1078      - key: "every"
1079        value:
1080          type: function
1081          native: duk_bi_array_prototype_iter_shared
1082          length: 1
1083          nargs: 2
1084          magic:
1085            type: array_iter
1086            funcname: "every"  # BI_ARRAY_ITER_EVERY
1087        present_if: DUK_USE_ARRAY_BUILTIN
1088      - key: "some"
1089        value:
1090          type: function
1091          native: duk_bi_array_prototype_iter_shared
1092          length: 1
1093          nargs: 2
1094          magic:
1095            type: array_iter
1096            funcname: "some"  # BI_ARRAY_ITER_SOME
1097        present_if: DUK_USE_ARRAY_BUILTIN
1098      - key: "forEach"
1099        value:
1100          type: function
1101          native: duk_bi_array_prototype_iter_shared
1102          length: 1
1103          nargs: 2
1104          magic:
1105            type: array_iter
1106            funcname: "forEach"  # BI_ARRAY_ITER_FOREACH
1107        present_if: DUK_USE_ARRAY_BUILTIN
1108      - key: "map"
1109        value:
1110          type: function
1111          native: duk_bi_array_prototype_iter_shared
1112          length: 1
1113          nargs: 2
1114          magic:
1115            type: array_iter
1116            funcname: "map"  # BI_ARRAY_ITER_MAP
1117        present_if: DUK_USE_ARRAY_BUILTIN
1118      - key: "filter"
1119        value:
1120          type: function
1121          native: duk_bi_array_prototype_iter_shared
1122          length: 1
1123          nargs: 2
1124          magic:
1125            type: array_iter
1126            funcname: filter  # BI_ARRAY_ITER_FILTER
1127        present_if: DUK_USE_ARRAY_BUILTIN
1128      - key: "reduce"
1129        value:
1130          type: function
1131          native: duk_bi_array_prototype_reduce_shared
1132          length: 1
1133          varargs: true
1134          magic: 1  # magic: idx_step = +1
1135        present_if: DUK_USE_ARRAY_BUILTIN
1136      - key: "reduceRight"
1137        value:
1138          type: function
1139          native: duk_bi_array_prototype_reduce_shared
1140          length: 1
1141          varargs: true
1142          magic: -1  # magic: idx_step = -1
1143        present_if: DUK_USE_ARRAY_BUILTIN
1144
1145      #- key:  # @@iterator
1146      #    type: symbol
1147      #    variant: wellknown
1148      #    string: "Symbol.iterator"
1149      #  value: XXX
1150      #  es6: true
1151      #- key:  # @@unscopables
1152      #    type: symbol
1153      #    variant: wellknown
1154      #    string: "Symbol.unscopables"
1155      #  value: XXX
1156      #  es6: true
1157
1158  - id: bi_string_constructor
1159    class: Function
1160    internal_prototype: bi_function_prototype
1161    varargs: true
1162    native: duk_bi_string_constructor
1163    callable: true
1164    constructable: true
1165    bidx: true
1166    present_if: DUK_USE_STRING_BUILTIN
1167
1168    properties:
1169      - key: "length"
1170        value: 1
1171        attributes: "c"
1172      - key: "prototype"
1173        value:
1174          type: object
1175          id: bi_string_prototype
1176        attributes: ""
1177      - key: "name"
1178        value: "String"
1179        attributes: "c"
1180
1181      - key: "fromCharCode"
1182        value:
1183          type: function
1184          native: duk_bi_string_constructor_from_char_code
1185          length: 1
1186          varargs: true
1187      - key: "fromCodePoint"
1188        value:
1189          type: function
1190          native: duk_bi_string_constructor_from_code_point
1191          length: 1
1192          varargs: true
1193        present_if: DUK_USE_ES6
1194
1195  - id: bi_string_prototype
1196    class: String
1197    internal_prototype: bi_object_prototype
1198    bidx: true
1199    # Present even when DUK_USE_STRING_BUILTIN disabled.
1200
1201    # String prototype is a String instance and must have length value 0.
1202    # This is supplied by the String instance virtual properties and does
1203    # not need to be included in init data.
1204    #
1205    # Unlike Array.prototype.length, String.prototype.length has the default
1206    # "length" attributes of built-in objects: non-writable, non-enumerable,
1207    # non-configurable.
1208
1209    #length: 0,  # omitted; non-writable, non-enumerable, non-configurable
1210
1211    properties:
1212      - key: "constructor"
1213        value:
1214          type: object
1215          id: bi_string_constructor
1216        attributes: "wc"
1217        present_if: DUK_USE_STRING_BUILTIN
1218
1219      # Internal empty string value.  Note that this value is not writable
1220      # which prevents a String instance's internal value also from being
1221      # written with standard methods.  The internal code creating String
1222      # instances has no such issues.
1223      - key:
1224          type: symbol
1225          variant: hidden
1226          string: "Value"
1227        value: ""
1228        attributes: ""
1229        duktape: true
1230
1231      - key: "toString"
1232        value:
1233          type: function
1234          native: duk_bi_string_prototype_to_string
1235          length: 0
1236        present_if: DUK_USE_STRING_BUILTIN
1237      - key: "valueOf"
1238        value:
1239          type: function
1240          native: duk_bi_string_prototype_to_string  # share native function, behavior is identical
1241          length: 0
1242        present_if: DUK_USE_STRING_BUILTIN
1243      - key: "charAt"
1244        value:
1245          type: function
1246          native: duk_bi_string_prototype_char_at
1247          length: 1
1248        present_if: DUK_USE_STRING_BUILTIN
1249      - key: "charCodeAt"
1250        value:
1251          type: function
1252          native: duk_bi_string_prototype_char_code_at
1253          length: 1
1254          magic: 0
1255        present_if: DUK_USE_STRING_BUILTIN
1256      - key: "codePointAt"
1257        value:
1258          type: function
1259          native: duk_bi_string_prototype_char_code_at
1260          length: 1
1261          magic: 1
1262        es6: true
1263        present_if:
1264          - DUK_USE_ES6
1265          - DUK_USE_STRING_BUILTIN
1266      - key: "concat"
1267        value:
1268          type: function
1269          native: duk_bi_string_prototype_concat
1270          length: 1
1271          varargs: true
1272        present_if: DUK_USE_STRING_BUILTIN
1273      - key: "indexOf"
1274        value:
1275          type: function
1276          native: duk_bi_string_prototype_indexof_shared
1277          length: 1
1278          nargs: 2
1279          magic: 0  # magic = 0 -> indexOf
1280        present_if: DUK_USE_STRING_BUILTIN
1281      - key: "lastIndexOf"
1282        value:
1283          type: function
1284          native: duk_bi_string_prototype_indexof_shared
1285          length: 1
1286          nargs: 2
1287          magic: 1  # magic = 1 -> lastIndexOf
1288        present_if: DUK_USE_STRING_BUILTIN
1289      - key: "localeCompare"
1290        value:
1291          type: function
1292          native: duk_bi_string_prototype_locale_compare
1293          length: 1
1294        present_if: DUK_USE_STRING_BUILTIN
1295      - key: "match"
1296        value:
1297          type: function
1298          native: duk_bi_string_prototype_match
1299          length: 1
1300        present_if:
1301          - DUK_USE_STRING_BUILTIN
1302          - DUK_USE_REGEXP_SUPPORT
1303      - key: "replace"
1304        value:
1305          type: function
1306          native: duk_bi_string_prototype_replace
1307          length: 2
1308        present_if: DUK_USE_STRING_BUILTIN
1309      - key: "search"
1310        value:
1311          type: function
1312          native: duk_bi_string_prototype_search
1313          length: 1
1314        present_if:
1315          - DUK_USE_STRING_BUILTIN
1316          - DUK_USE_REGEXP_SUPPORT
1317      - key: "slice"
1318        value:
1319          type: function
1320          native: duk_bi_string_prototype_slice
1321          length: 2
1322        present_if: DUK_USE_STRING_BUILTIN
1323      - key: "split"
1324        value:
1325          type: function
1326          native: duk_bi_string_prototype_split
1327          length: 2
1328        present_if: DUK_USE_STRING_BUILTIN
1329      - key: "substring"
1330        value:
1331          type: function
1332          native: duk_bi_string_prototype_substring
1333          length: 2
1334        present_if: DUK_USE_STRING_BUILTIN
1335      - key: "toLowerCase"
1336        value:
1337          type: function
1338          native: duk_bi_string_prototype_caseconv_shared
1339          length: 0
1340          magic: 0  # magic = uppercase
1341        present_if: DUK_USE_STRING_BUILTIN
1342      - key: "toLocaleLowerCase"
1343        value:
1344          type: function
1345          native: duk_bi_string_prototype_caseconv_shared
1346          length: 0
1347          magic: 0  # magic = uppercase; no locale specific conversion now
1348        present_if: DUK_USE_STRING_BUILTIN
1349      - key: "toUpperCase"
1350        value:
1351          type: function
1352          native: duk_bi_string_prototype_caseconv_shared
1353          length: 0
1354          magic: 1  # magic = uppercase
1355        present_if: DUK_USE_STRING_BUILTIN
1356      - key: "toLocaleUpperCase"
1357        value:
1358          type: function
1359          native: duk_bi_string_prototype_caseconv_shared
1360          length: 0
1361          magic: 1  # magic = uppercase; no locale specific conversion now
1362        present_if: DUK_USE_STRING_BUILTIN
1363      - key: "trim"
1364        value:
1365          type: function
1366          native: duk_bi_string_prototype_trim
1367          length: 0
1368        present_if: DUK_USE_STRING_BUILTIN
1369      - key: "repeat"
1370        value:
1371          type: function
1372          native: duk_bi_string_prototype_repeat
1373          length: 1
1374          nargs: 1
1375        present_if:
1376          - DUK_USE_ES6
1377          - DUK_USE_STRING_BUILTIN
1378      - key: "startsWith"
1379        value:
1380          type: function
1381          native: duk_bi_string_prototype_startswith_endswith
1382          length: 1
1383          nargs: 2
1384          magic: 0  # 0=startsWith
1385        present_if:
1386          - DUK_USE_ES6
1387          - DUK_USE_STRING_BUILTIN
1388      - key: "endsWith"
1389        value:
1390          type: function
1391          native: duk_bi_string_prototype_startswith_endswith
1392          length: 1
1393          nargs: 2
1394          magic: 1  # 1=endsWith
1395        present_if:
1396          - DUK_USE_ES6
1397          - DUK_USE_STRING_BUILTIN
1398      - key: "includes"
1399        value:
1400          type: function
1401          native: duk_bi_string_prototype_includes
1402          length: 1
1403          nargs: 2
1404        present_if:
1405          - DUK_USE_ES6
1406          - DUK_USE_STRING_BUILTIN
1407
1408      # Non-standard extension: E5 Section B.2.3
1409
1410      - key: "substr"
1411        value:
1412          type: function
1413          native: duk_bi_string_prototype_substr
1414          length: 2
1415        section_b: true
1416        present_if:
1417          - DUK_USE_STRING_BUILTIN
1418          - DUK_USE_SECTION_B
1419
1420      #- key:  # @@iterator
1421      #    type: symbol
1422      #    variant: wellknown
1423      #    string: "Symbol.iterator"
1424      #  value: XXX
1425      #  es6: true
1426
1427  - id: bi_boolean_constructor
1428    class: Function
1429    internal_prototype: bi_function_prototype
1430    native: duk_bi_boolean_constructor
1431    callable: true
1432    constructable: true
1433    bidx: true
1434    present_if: DUK_USE_BOOLEAN_BUILTIN
1435
1436    properties:
1437      - key: "length"
1438        value: 1
1439        attributes: "c"
1440      - key: "prototype"
1441        value:
1442          type: object
1443          id: bi_boolean_prototype
1444        attributes: ""
1445      - key: "name"
1446        value: "Boolean"
1447        attributes: "c"
1448
1449  - id: bi_boolean_prototype
1450    class: Boolean
1451    internal_prototype: bi_object_prototype
1452    bidx: true
1453    # Present even when DUK_USE_BOOLEAN_BUILTIN disabled.
1454
1455    properties:
1456      - key: "constructor"
1457        value:
1458          type: object
1459          id: bi_boolean_constructor
1460        attributes: "wc"
1461        present_if: DUK_USE_BOOLEAN_BUILTIN
1462
1463      # Internal false boolean value.  Note that this value is not writable
1464      # which prevents a Boolean instance's internal value also from being
1465      # written with standard methods.  The internal code creating Boolean
1466      # instances has no such issues.
1467      - key:
1468          type: symbol
1469          variant: hidden
1470          string: "Value"
1471        value: false
1472        attributes: ""
1473        duktape: true
1474
1475      - key: "toString"
1476        value:
1477          type: function
1478          native: duk_bi_boolean_prototype_tostring_shared
1479          length: 0
1480          magic: 1  # magic = coerce_tostring
1481        present_if: DUK_USE_BOOLEAN_BUILTIN
1482      - key: "valueOf"
1483        value:
1484          type: function
1485          native: duk_bi_boolean_prototype_tostring_shared
1486          length: 0
1487          magic: 0  # magic = coerce_tostring
1488        present_if: DUK_USE_BOOLEAN_BUILTIN
1489
1490  - id: bi_number_constructor
1491    class: Function
1492    internal_prototype: bi_function_prototype
1493    varargs: true
1494    native: duk_bi_number_constructor
1495    callable: true
1496    constructable: true
1497    bidx: true
1498    present_if: DUK_USE_NUMBER_BUILTIN
1499
1500    properties:
1501      - key: "length"
1502        value: 1
1503        attributes: "c"
1504      - key: "prototype"
1505        value:
1506          type: object
1507          id: bi_number_prototype
1508        attributes: ""
1509      - key: "name"
1510        value: "Number"
1511        attributes: "c"
1512      - key: "MAX_VALUE"
1513        value:
1514          type: double
1515          bytes: "7fefffffffffffff"  # DBL_MAX_DOUBLE
1516        attributes: ""
1517      - key: "MIN_VALUE"
1518        value:
1519          type: double
1520          bytes: "0000000000000001"  # DBL_MIN_DOUBLE
1521        attributes: ""
1522      - key: "NaN"
1523        value:
1524          type: double
1525          bytes: "7ff8000000000000"  # DBL_NAN
1526        attributes: ""
1527      - key: "POSITIVE_INFINITY"
1528        value:
1529          type: double
1530          bytes: "7ff0000000000000"  # DBL_POSITIVE_INFINITY
1531        attributes: ""
1532      - key: "NEGATIVE_INFINITY"
1533        value:
1534          type: double
1535          bytes: "fff0000000000000"  # DBL_NEGATIVE_INFINITY
1536        attributes: ""
1537      - key: "EPSILON"
1538        value:
1539          type: double
1540          bytes: "3cb0000000000000"   # 3ff0000000000001 - 3ff0000000000000 = 3cb0000000000000
1541        attributes: ""
1542        es6: true
1543        present_if: DUK_USE_ES6
1544      - key: "MAX_SAFE_INTEGER"
1545        value:
1546          # >>> struct.pack('>d', 9007199254740991.0).encode('hex')
1547          # '433fffffffffffff'
1548          type: double
1549          bytes: "433fffffffffffff"
1550        attributes: ""
1551        es6: true
1552        present_if: DUK_USE_ES6
1553      - key: "MIN_SAFE_INTEGER"
1554        value:
1555          # >>> struct.pack('>d', -9007199254740991.0).encode('hex')
1556          # 'c33fffffffffffff'
1557          type: double
1558          bytes: "c33fffffffffffff"
1559        attributes: ""
1560        es6: true
1561        present_if: DUK_USE_ES6
1562
1563      - key: "isFinite"
1564        value:
1565          type: function
1566          native: duk_bi_number_check_shared
1567          length: 1
1568          magic: 0
1569        attributes: "wc"
1570        es6: true
1571        present_if: DUK_USE_ES6
1572      - key: "isInteger"
1573        value:
1574          type: function
1575          native: duk_bi_number_check_shared
1576          length: 1
1577          magic: 1
1578        attributes: "wc"
1579        es6: true
1580        present_if: DUK_USE_ES6
1581      - key: "isNaN"
1582        value:
1583          type: function
1584          native: duk_bi_number_check_shared
1585          length: 1
1586          magic: 2
1587        attributes: "wc"
1588        es6: true
1589        present_if: DUK_USE_ES6
1590      - key: "isSafeInteger"
1591        value:
1592          type: function
1593          native: duk_bi_number_check_shared
1594          length: 1
1595          magic: 3
1596        attributes: "wc"
1597        es6: true
1598        present_if: DUK_USE_ES6
1599      - key: "parseInt"  # Must map to the exactly same object as global parseInt()
1600        value:
1601          type: object
1602          id: bi_parse_int
1603        es6: true
1604        present_if: DUK_USE_ES6
1605      - key: "parseFloat"  # Must map to the exactly same object as global parseFloat()
1606        value:
1607          type: object
1608          id: bi_parse_float
1609        es6: true
1610        present_if: DUK_USE_ES6
1611
1612  - id: bi_number_prototype
1613    class: Number
1614    internal_prototype: bi_object_prototype
1615    bidx: true
1616    # Present even when DUK_USE_NUMBER_BUILTIN disabled.
1617
1618    properties:
1619      - key: "constructor"
1620        value:
1621          type: object
1622          id: bi_number_constructor
1623        attributes: "wc"
1624        present_if: DUK_USE_NUMBER_BUILTIN
1625
1626    # Internal 0.0 number value.  Note that this value is not writable
1627    # which prevents a Number instance's internal value also from being
1628    # written with standard methods.  The internal code creating Number
1629    # instances has no such issues.
1630    #
1631    # Number.prototype is a Number itself in ES5.1 and ES2016+.  It was
1632    # briefly made a non-Number in ES2015 but this change was reverted
1633    # in ES2016.
1634      - key:
1635          type: symbol
1636          variant: hidden
1637          string: "Value"
1638        value: 0.0
1639        attributes: ""
1640        duktape: true
1641
1642      - key: "toString"
1643        value:
1644          type: function
1645          native: duk_bi_number_prototype_to_string
1646          length: 1
1647        present_if: DUK_USE_NUMBER_BUILTIN
1648      - key: "toLocaleString"
1649        value:
1650          type: function
1651          native: duk_bi_number_prototype_to_locale_string
1652          length: 1
1653        present_if: DUK_USE_NUMBER_BUILTIN
1654      - key: "valueOf"
1655        value:
1656          type: function
1657          native: duk_bi_number_prototype_value_of
1658          length: 0
1659        present_if: DUK_USE_NUMBER_BUILTIN
1660      - key: "toFixed"
1661        value:
1662          type: function
1663          native: duk_bi_number_prototype_to_fixed
1664          length: 1
1665        present_if: DUK_USE_NUMBER_BUILTIN
1666      - key: "toExponential"
1667        value:
1668          type: function
1669          native: duk_bi_number_prototype_to_exponential
1670          length: 1
1671        present_if: DUK_USE_NUMBER_BUILTIN
1672      - key: "toPrecision"
1673        value:
1674          type: function
1675          native: duk_bi_number_prototype_to_precision
1676          length: 1
1677        present_if: DUK_USE_NUMBER_BUILTIN
1678
1679  - id: bi_date_constructor
1680    class: Function
1681    internal_prototype: bi_function_prototype
1682    varargs: true
1683    native: duk_bi_date_constructor
1684    callable: true
1685    constructable: true
1686    bidx: true
1687    present_if: DUK_USE_DATE_BUILTIN
1688
1689    properties:
1690      - key: "length"
1691        value: 7
1692        attributes: "c"
1693      - key: "prototype"
1694        value:
1695          type: object
1696          id: bi_date_prototype
1697        attributes: ""
1698      - key: "name"
1699        value: "Date"
1700        attributes: "c"
1701
1702      - key: "parse"
1703        value:
1704          type: function
1705          native: duk_bi_date_constructor_parse
1706          length: 1
1707      - key: "UTC"
1708        value:
1709          type: function
1710          native: duk_bi_date_constructor_utc
1711          length: 7
1712          varargs: true
1713      - key: "now"
1714        value:
1715          type: function
1716          native: duk_bi_date_constructor_now
1717          length: 0
1718
1719  - id: bi_date_prototype
1720    class: Date
1721    internal_prototype: bi_object_prototype
1722    bidx: true
1723    present_if: DUK_USE_DATE_BUILTIN
1724
1725    # The Date prototype is an instance of Date with [[PrimitiveValue]] NaN.
1726    #
1727    # Setters with optional arguments must be varargs functions because
1728    # they must detect the number of parameters actually given (cannot
1729    # assume parameters not given are undefined).
1730    #
1731    # Date.prototype.valueOf() and Date.prototype.getTime() have identical
1732    # behavior so they share the same C function, but have different
1733    # function instances.
1734    #
1735    # Getters, setters, and string conversion functions use shared native
1736    # helpers and the function "magic" value is used to pass flags and
1737    # parameters to the helpers.
1738
1739    properties:
1740      - key: "constructor"
1741        value:
1742          type: object
1743          id: bi_date_constructor
1744        attributes: "wc"
1745
1746      # Internal date value (E5 Section 15.9.5).
1747      #
1748      # Note: the value is writable, as you can e.g. do the following (V8):
1749      #  > Date.prototype.toString()
1750      #  "Invalid Date"
1751      #  > Date.prototype.setYear(2010)
1752      #  1262296800000
1753      #  > Date.prototype.toString()
1754      #  "Fri Jan 01 2010 00:00:00 GMT+0200 (EET)"
1755
1756      - key:
1757          type: symbol
1758          variant: hidden
1759          string: "Value"
1760        value:
1761          type: double
1762          bytes: "7ff8000000000000"  # DBL_NAN
1763        attributes: "w"
1764        duktape: true
1765
1766      # NOTE: The magic values for Date prototype are special.  The actual control
1767      # flags needed for the built-ins don't fit into LIGHTFUNC magic field, so
1768      # the values here are indices to duk__date_magics[] in duk_bi_date.c which
1769      # contains the actual control flags.  Magic values here must be kept in strict
1770      # sync with duk_bi_date.c!
1771
1772      - key: "toString"
1773        value:
1774          type: function
1775          native: duk_bi_date_prototype_tostring_shared
1776          length: 0
1777          magic: 0
1778      - key: "toDateString"
1779        value:
1780          type: function
1781          native: duk_bi_date_prototype_tostring_shared
1782          length: 0
1783          magic: 1
1784      - key: "toTimeString"
1785        value:
1786          type: function
1787          native: duk_bi_date_prototype_tostring_shared
1788          length: 0
1789          magic: 2
1790      - key: "toLocaleString"
1791        value:
1792          type: function
1793          native: duk_bi_date_prototype_tostring_shared
1794          length: 0
1795          magic: 3
1796      - key: "toLocaleDateString"
1797        value:
1798          type: function
1799          native: duk_bi_date_prototype_tostring_shared
1800          length: 0
1801          magic: 4
1802      - key: "toLocaleTimeString"
1803        value:
1804          type: function
1805          native: duk_bi_date_prototype_tostring_shared
1806          length: 0
1807          magic: 5
1808      - key: "toUTCString"
1809        value:
1810          type: function
1811          native: duk_bi_date_prototype_tostring_shared
1812          length: 0
1813          magic: 6
1814      - key: "toISOString"
1815        value:
1816          type: function
1817          native: duk_bi_date_prototype_tostring_shared
1818          length: 0
1819          magic: 7
1820      - key: "toJSON"
1821        value:
1822          type: function
1823          native: duk_bi_date_prototype_to_json
1824          length: 1
1825      - key: "valueOf"
1826        value:
1827          type: function
1828          native: duk_bi_date_prototype_value_of
1829          length: 0
1830      - key: "getTime"
1831        value:
1832          type: function
1833          native: duk_bi_date_prototype_value_of  # Native function shared on purpose
1834          length: 0
1835      - key: "getFullYear"
1836        value:
1837          type: function
1838          native: duk_bi_date_prototype_get_shared
1839          length: 0
1840          magic: 8
1841      - key: "getUTCFullYear"
1842        value:
1843          type: function
1844          native: duk_bi_date_prototype_get_shared
1845          length: 0
1846          magic: 9
1847      - key: "getMonth"
1848        value:
1849          type: function
1850          native: duk_bi_date_prototype_get_shared
1851          length: 0
1852          magic: 10
1853      - key: "getUTCMonth"
1854        value:
1855          type: function
1856          native: duk_bi_date_prototype_get_shared
1857          length: 0
1858          magic: 11
1859      - key: "getDate"
1860        value:
1861          type: function
1862          native: duk_bi_date_prototype_get_shared
1863          length: 0
1864          magic: 12
1865      - key: "getUTCDate"
1866        value:
1867          type: function
1868          native: duk_bi_date_prototype_get_shared
1869          length: 0
1870          magic: 13
1871      - key: "getDay"
1872        value:
1873          type: function
1874          native: duk_bi_date_prototype_get_shared
1875          length: 0
1876          magic: 14
1877      - key: "getUTCDay"
1878        value:
1879          type: function
1880          native: duk_bi_date_prototype_get_shared
1881          length: 0
1882          magic: 15
1883      - key: "getHours"
1884        value:
1885          type: function
1886          native: duk_bi_date_prototype_get_shared
1887          length: 0
1888          magic: 16
1889      - key: "getUTCHours"
1890        value:
1891          type: function
1892          native: duk_bi_date_prototype_get_shared
1893          length: 0
1894          magic: 17
1895      - key: "getMinutes"
1896        value:
1897          type: function
1898          native: duk_bi_date_prototype_get_shared
1899          length: 0
1900          magic: 18
1901      - key: "getUTCMinutes"
1902        value:
1903          type: function
1904          native: duk_bi_date_prototype_get_shared
1905          length: 0
1906          magic: 19
1907      - key: "getSeconds"
1908        value:
1909          type: function
1910          native: duk_bi_date_prototype_get_shared
1911          length: 0
1912          magic: 20
1913      - key: "getUTCSeconds"
1914        value:
1915          type: function
1916          native: duk_bi_date_prototype_get_shared
1917          length: 0
1918          magic: 21
1919      - key: "getMilliseconds"
1920        value:
1921          type: function
1922          native: duk_bi_date_prototype_get_shared
1923          length: 0
1924          magic: 22
1925      - key: "getUTCMilliseconds"
1926        value:
1927          type: function
1928          native: duk_bi_date_prototype_get_shared
1929          length: 0
1930          magic: 23
1931      - key: "getTimezoneOffset"
1932        value:
1933          type: function
1934          native: duk_bi_date_prototype_get_timezone_offset
1935          length: 0
1936      - key: "setTime"
1937        value:
1938          type: function
1939          native: duk_bi_date_prototype_set_time
1940          length: 1
1941      - key: "setMilliseconds"
1942        value:
1943          type: function
1944          native: duk_bi_date_prototype_set_shared
1945          length: 1
1946          magic: 24
1947      - key: "setUTCMilliseconds"
1948        value:
1949          type: function
1950          native: duk_bi_date_prototype_set_shared
1951          length: 1
1952          magic: 25
1953      - key: "setSeconds"
1954        value:
1955          type: function
1956          native: duk_bi_date_prototype_set_shared
1957          length: 2
1958          varargs: true
1959          magic: 26
1960      - key: "setUTCSeconds"
1961        value:
1962          type: function
1963          native: duk_bi_date_prototype_set_shared
1964          length: 2
1965          varargs: true
1966          magic: 27
1967      - key: "setMinutes"
1968        value:
1969          type: function
1970          native: duk_bi_date_prototype_set_shared
1971          length: 3
1972          varargs: true
1973          magic: 28
1974      - key: "setUTCMinutes"
1975        value:
1976          type: function
1977          native: duk_bi_date_prototype_set_shared
1978          length: 3
1979          varargs: true
1980          magic: 29
1981      - key: "setHours"
1982        value:
1983          type: function
1984          native: duk_bi_date_prototype_set_shared
1985          length: 4
1986          varargs: true
1987          magic: 30
1988      - key: "setUTCHours"
1989        value:
1990          type: function
1991          native: duk_bi_date_prototype_set_shared
1992          length: 4
1993          varargs: true
1994          magic: 31
1995      - key: "setDate"
1996        value:
1997          type: function
1998          native: duk_bi_date_prototype_set_shared
1999          length: 1
2000          magic: 32
2001      - key: "setUTCDate"
2002        value:
2003          type: function
2004          native: duk_bi_date_prototype_set_shared
2005          length: 1
2006          magic: 33
2007      - key: "setMonth"
2008        value:
2009          type: function
2010          native: duk_bi_date_prototype_set_shared
2011          length: 2
2012          varargs: true
2013          magic: 34
2014      - key: "setUTCMonth"
2015        value:
2016          type: function
2017          native: duk_bi_date_prototype_set_shared
2018          length: 2
2019          varargs: true
2020          magic: 35
2021      - key: "setFullYear"
2022        value:
2023          type: function
2024          native: duk_bi_date_prototype_set_shared
2025          length: 3
2026          varargs: true
2027          magic: 36
2028      - key: "setUTCFullYear"
2029        value:
2030          type: function
2031          native: duk_bi_date_prototype_set_shared
2032          length: 3
2033          varargs: true
2034          magic: 37
2035      # Note: toGMTString() is required to initially be the same Function
2036      # object as the initial Date.prototype.toUTCString.  In other words
2037      # the following must compare true:
2038      #
2039      #   Date.prototype.toGMTString === Date.prototype.toUTCString.
2040      #
2041      # This is currently handled using a small tweak in duk_hthread_builtins.c
2042      # (for RAM objects) and genbuiltins.py (for ROM objects).
2043      #
2044      # Note that while Smjs respects the requirement in E5 Section B.2.6,
2045      # V8 does not.
2046      - key: "toGMTString"
2047        value:
2048          type: function
2049          native: duk_bi_date_prototype_tostring_shared
2050          length: 0
2051          magic: 6
2052        section_b: true
2053
2054      # Non-standard extensions: E5 Section B.2.4, B.2.5, B.2.6
2055      #
2056      # "length" values are not given explicitly but follows the general rule.
2057      # The lengths below agree with V8.
2058
2059      - key: "getYear"
2060        value:
2061          type: function
2062          native: duk_bi_date_prototype_get_shared
2063          length: 0
2064          magic: 38
2065        section_b: true
2066      - key: "setYear"
2067        value:
2068          type: function
2069          native: duk_bi_date_prototype_set_shared
2070          length: 1
2071          magic: 39
2072        section_b: true
2073
2074      - key:  # @@toPrimitive
2075          type: symbol
2076          variant: wellknown
2077          string: "Symbol.toPrimitive"
2078        value:
2079          type: function
2080          native: duk_bi_date_prototype_toprimitive
2081          length: 1
2082          name: "[Symbol.toPrimitive]"
2083        attributes: "c"
2084        es6: true
2085        present_if: DUK_USE_SYMBOL_BUILTIN
2086
2087  - id: bi_regexp_constructor
2088    class: Function
2089    internal_prototype: bi_function_prototype
2090    native: duk_bi_regexp_constructor
2091    callable: true
2092    constructable: true
2093    bidx: true
2094    present_if: DUK_USE_REGEXP_SUPPORT
2095
2096    properties:
2097      - key: "length"
2098        value: 2
2099        attributes: "c"
2100      - key: "prototype"
2101        value:
2102          type: object
2103          id: bi_regexp_prototype
2104        attributes: ""
2105      - key: "name"
2106        value: "RegExp"
2107        attributes: "c"
2108
2109      #- key:  # @@species
2110      #    type: symbol
2111      #    variant: wellknown
2112      #    string: "Symbol.species"
2113      #  value: XXX
2114      #  es6: true
2115
2116  - id: bi_regexp_prototype
2117    class: Object  # Object in ES2015; RegExp in ES5
2118    internal_prototype: bi_object_prototype
2119    bidx: true
2120    present_if: DUK_USE_REGEXP_SUPPORT
2121
2122    properties:
2123      - key: "constructor"
2124        value:
2125          type: object
2126          id: bi_regexp_constructor
2127        attributes: "wc"
2128
2129      # In ES2015 RegExp.prototype is no longer a RegExp instance.
2130
2131      # "lastIndex" is writable, even in the RegExp.prototype object.
2132      # This matches at least V8.
2133      - key: "lastIndex"
2134        value: 0
2135        attributes: "w"
2136
2137      - key: "exec"
2138        value:
2139          type: function
2140          native: duk_bi_regexp_prototype_exec
2141          length: 1
2142      - key: "test"
2143        value:
2144          type: function
2145          native: duk_bi_regexp_prototype_test
2146          length: 1
2147      - key: "toString"
2148        value:
2149          type: function
2150          native: duk_bi_regexp_prototype_tostring
2151          length: 0
2152
2153      # In ES2015 .source, .global, .ignoreCase, etc are accessors.
2154      # .flags is ES2015 but must be present because the constructor now
2155      # relies on its presence for e.g. new RegExp(/foo/gim).
2156
2157      - key: "flags"
2158        value:
2159          type: accessor
2160          getter: duk_bi_regexp_prototype_flags
2161          getter_nargs: 0
2162          getter_magic: 0
2163          # setter undefined
2164        attributes: "c"
2165        es6: true
2166
2167      - key: "source"
2168        value:
2169          type: accessor
2170          getter: duk_bi_regexp_prototype_shared_getter
2171          getter_nargs: 0
2172          getter_magic: 16  # default case in shared getter (value quite arbitrary)
2173          # setter undefined
2174        attributes: "c"
2175      - key: "global"
2176        value:
2177          type: accessor
2178          getter: duk_bi_regexp_prototype_shared_getter
2179          getter_nargs: 0
2180          getter_magic: 0
2181          # setter undefined
2182        attributes: "c"
2183      - key: "ignoreCase"
2184        value:
2185          type: accessor
2186          getter: duk_bi_regexp_prototype_shared_getter
2187          getter_nargs: 0
2188          getter_magic: 1
2189          # setter undefined
2190        attributes: "c"
2191      - key: "multiline"
2192        value:
2193          type: accessor
2194          getter: duk_bi_regexp_prototype_shared_getter
2195          getter_nargs: 0
2196          getter_magic: 2
2197          # setter undefined
2198        attributes: "c"
2199      # .sticky and .unicode commented out; don't provide until implemented
2200      # to avoid interfering with application feature detection code
2201      #- key: "sticky"
2202      #  value:
2203      #    type: accessor
2204      #    getter: duk_bi_regexp_prototype_shared_getter
2205      #    getter_nargs: 0
2206      #    getter_magic: 3
2207      #    # setter undefined
2208      #  attributes: "c"
2209      #  es6: true
2210      #  present_if: DUK_USE_ES6
2211      #- key: "unicode"
2212      #  value:
2213      #    type: accessor
2214      #    getter: duk_bi_regexp_prototype_shared_getter
2215      #    getter_nargs: 0
2216      #    getter_magic: 4
2217      #    # setter undefined
2218      #  attributes: "c"
2219      #  es6: true
2220      #  present_if: DUK_USE_ES6
2221
2222      #- key:  # @@match
2223      #    type: symbol
2224      #    variant: wellknown
2225      #    string: "Symbol.match"
2226      #  value: XXX
2227      #  es6: true
2228      #- key:  # @@replace
2229      #    type: symbol
2230      #    variant: wellknown
2231      #    string: "Symbol.replace"
2232      #  value: XXX
2233      #  es6: true
2234      #- key:  # @@search
2235      #    type: symbol
2236      #    variant: wellknown
2237      #    string: "Symbol.search"
2238      #  value: XXX
2239      #  es6: true
2240      #- key:  # @@split
2241      #    type: symbol
2242      #    variant: wellknown
2243      #    string: "Symbol.split"
2244      #  value: XXX
2245      #  es6: true
2246
2247  - id: bi_error_constructor
2248    class: Function
2249    internal_prototype: bi_function_prototype
2250    native: duk_bi_error_constructor_shared
2251    callable: true
2252    constructable: true
2253    magic:
2254      type: bidx
2255      id: bi_error_prototype
2256    bidx: true
2257
2258    properties:
2259      - key: "length"
2260        value: 1
2261        attributes: "c"
2262      - key: "prototype"
2263        value:
2264          type: object
2265          id: bi_error_prototype
2266        attributes: ""
2267      - key: "name"
2268        value: "Error"
2269        attributes: "c"
2270
2271  - id: bi_error_prototype
2272    class: Error
2273    internal_prototype: bi_object_prototype
2274    bidx: true
2275
2276    properties:
2277      - key: "constructor"
2278        value:
2279          type: object
2280          id: bi_error_constructor
2281        attributes: "wc"
2282
2283      # Standard properties; property attributes:
2284      #
2285      # "message" is writable and deletable.  This matches the default
2286      # attributes of "wc".  V8 and Smjs both match this.
2287      #
2288      # "name" is writable and deletable.  This matches the default
2289      # attributes too.  Smjs behaves like this, but in V8 "name" is
2290      # non-writable:
2291      #
2292      #  > Object.getOwnPropertyDescriptor(Error.prototype, "name")
2293      #  { value: "Error",
2294      #    writable: false,
2295      #    enumerable: false,
2296      #    configurable: false }
2297      #
2298      # We go with the standard attributes ("wc").
2299
2300      - key: "name"
2301        value: "Error"
2302      - key: "message"
2303        value: ""
2304
2305      # Custom properties
2306
2307      - key: "stack"
2308        value:
2309          type: accessor
2310          getter: duk_bi_error_prototype_stack_getter
2311          setter: duk_bi_error_prototype_stack_setter
2312          getter_nargs: 0
2313          setter_nargs: 1
2314          getter_magic: 0
2315          setter_magic: 0
2316        attributes: "c"
2317        duktape: true
2318      - key: "fileName"
2319        value:
2320          type: accessor
2321          getter: duk_bi_error_prototype_filename_getter
2322          setter: duk_bi_error_prototype_filename_setter
2323          getter_nargs: 0
2324          setter_nargs: 1
2325          getter_magic: 0
2326          setter_magic: 0
2327        attributes: "c"
2328        duktape: true
2329      - key: "lineNumber"
2330        value:
2331          type: accessor
2332          getter: duk_bi_error_prototype_linenumber_getter
2333          setter: duk_bi_error_prototype_linenumber_setter
2334          getter_nargs: 0
2335          setter_nargs: 1
2336          getter_magic: 0
2337          setter_magic: 0
2338        attributes: "c"
2339        duktape: true
2340      # XXX: columnNumber
2341
2342      - key: "toString"
2343        value:
2344          type: function
2345          native: duk_bi_error_prototype_to_string
2346          length: 0
2347
2348  # NOTE: Error subclass prototypes have an empty "message" property, even
2349  # though one is inherited already from Error prototype (E5 Section 15.11.7.10).
2350  #
2351  # V8 does not respect this: Error subclasses ("native Errors" in E5 spec)
2352  # do not have a "message" property at all.  Also, in V8 their "name" property
2353  # is not writable and configurable as E5 requires.
2354
2355  - id: bi_eval_error_constructor
2356    class: Function
2357    internal_prototype: bi_error_constructor
2358    native: duk_bi_error_constructor_shared
2359    callable: true
2360    constructable: true
2361    magic:
2362      type: bidx
2363      id: bi_eval_error_prototype
2364    bidx: true
2365
2366    properties:
2367      - key: "length"
2368        value: 1
2369        attributes: "c"
2370      - key: "prototype"
2371        value:
2372          type: object
2373          id: bi_eval_error_prototype
2374        attributes: ""
2375      - key: "name"
2376        value: "EvalError"
2377        attributes: "c"
2378
2379  - id: bi_eval_error_prototype
2380    class: Error
2381    internal_prototype: bi_error_prototype
2382    bidx: true
2383
2384    properties:
2385      - key: "constructor"
2386        value:
2387          type: object
2388          id: bi_eval_error_constructor
2389        attributes: "wc"
2390      - key: "name"
2391        value: "EvalError"
2392      - key: "message"
2393        value: ""
2394
2395  - id: bi_range_error_constructor
2396    class: Function
2397    internal_prototype: bi_error_constructor
2398    native: duk_bi_error_constructor_shared
2399    callable: true
2400    constructable: true
2401    magic:
2402      type: bidx
2403      id: bi_range_error_prototype
2404    bidx: true
2405
2406    properties:
2407      - key: "length"
2408        value: 1
2409        attributes: "c"
2410      - key: "prototype"
2411        value:
2412          type: object
2413          id: bi_range_error_prototype
2414        attributes: ""
2415      - key: "name"
2416        value: "RangeError"
2417        attributes: "c"
2418
2419  - id: bi_range_error_prototype
2420    class: Error
2421    internal_prototype: bi_error_prototype
2422    bidx: true
2423
2424    properties:
2425      - key: "constructor"
2426        value:
2427          type: object
2428          id: bi_range_error_constructor
2429        attributes: "wc"
2430      - key: "name"
2431        value: "RangeError"
2432      - key: "message"
2433        value: ""
2434
2435  - id: bi_reference_error_constructor
2436    class: Function
2437    internal_prototype: bi_error_constructor
2438    native: duk_bi_error_constructor_shared
2439    callable: true
2440    constructable: true
2441    magic:
2442      type: bidx
2443      id: bi_reference_error_prototype
2444    bidx: true
2445
2446    properties:
2447      - key: "length"
2448        value: 1
2449        attributes: "c"
2450      - key: "prototype"
2451        value:
2452          type: object
2453          id: bi_reference_error_prototype
2454        attributes: ""
2455      - key: "name"
2456        value: "ReferenceError"
2457        attributes: "c"
2458
2459  - id: bi_reference_error_prototype
2460    class: Error
2461    internal_prototype: bi_error_prototype
2462    bidx: true
2463
2464    properties:
2465      - key: "constructor"
2466        value:
2467          type: object
2468          id: bi_reference_error_constructor
2469        attributes: "wc"
2470      - key: "name"
2471        value: "ReferenceError"
2472      - key: "message"
2473        value: ""
2474
2475  - id: bi_syntax_error_constructor
2476    class: Function
2477    internal_prototype: bi_error_constructor
2478    native: duk_bi_error_constructor_shared
2479    callable: true
2480    constructable: true
2481    magic:
2482      type: bidx
2483      id: bi_syntax_error_prototype
2484    bidx: true
2485
2486    properties:
2487      - key: "length"
2488        value: 1
2489        attributes: "c"
2490      - key: "prototype"
2491        value:
2492          type: object
2493          id: bi_syntax_error_prototype
2494        attributes: ""
2495      - key: "name"
2496        value: "SyntaxError"
2497        attributes: "c"
2498
2499  - id: bi_syntax_error_prototype
2500    class: Error
2501    internal_prototype: bi_error_prototype
2502    bidx: true
2503
2504    properties:
2505      - key: "constructor"
2506        value:
2507          type: object
2508          id: bi_syntax_error_constructor
2509        attributes: "wc"
2510      - key: "name"
2511        value: "SyntaxError"
2512      - key: "message"
2513        value: ""
2514
2515  - id: bi_type_error_constructor
2516    class: Function
2517    internal_prototype: bi_error_constructor
2518    native: duk_bi_error_constructor_shared
2519    callable: true
2520    constructable: true
2521    magic:
2522      type: bidx
2523      id: bi_type_error_prototype
2524    bidx: true
2525
2526    properties:
2527      - key: "length"
2528        value: 1
2529        attributes: "c"
2530      - key: "prototype"
2531        value:
2532          type: object
2533          id: bi_type_error_prototype
2534        attributes: ""
2535      - key: "name"
2536        value: "TypeError"
2537        attributes: "c"
2538
2539  - id: bi_type_error_prototype
2540    class: Error
2541    internal_prototype: bi_error_prototype
2542    bidx: true
2543
2544    properties:
2545      - key: "constructor"
2546        value:
2547          type: object
2548          id: bi_type_error_constructor
2549        attributes: "wc"
2550      - key: "name"
2551        value: "TypeError"
2552      - key: "message"
2553        value: ""
2554
2555  - id: bi_uri_error_constructor
2556    class: Function
2557    internal_prototype: bi_error_constructor
2558    native: duk_bi_error_constructor_shared
2559    callable: true
2560    constructable: true
2561    magic:
2562      type: bidx
2563      id: bi_uri_error_prototype
2564    bidx: true
2565
2566    properties:
2567      - key: "length"
2568        value: 1
2569        attributes: "c"
2570      - key: "prototype"
2571        value:
2572          type: object
2573          id: bi_uri_error_prototype
2574        attributes: ""
2575      - key: "name"
2576        value: "URIError"
2577        attributes: "c"
2578
2579  - id: bi_uri_error_prototype
2580    class: Error
2581    internal_prototype: bi_error_prototype
2582    bidx: true
2583
2584    properties:
2585      - key: "constructor"
2586        value:
2587          type: object
2588          id: bi_uri_error_constructor
2589        attributes: "wc"
2590      - key: "name"
2591        value: "URIError"
2592      - key: "message"
2593        value: ""
2594
2595  - id: bi_math
2596    class: Math
2597    internal_prototype: bi_object_prototype
2598    bidx: false
2599    present_if: DUK_USE_MATH_BUILTIN
2600
2601    # apparently no external "prototype" property
2602    # apparently no external "constructor" property
2603
2604    properties:
2605      - key: "E"
2606        value:
2607          type: double
2608          bytes: "4005bf0a8b145769"  # DBL_E
2609        attributes: ""
2610      - key: "LN10"
2611        value:
2612          type: double
2613          bytes: "40026bb1bbb55516"  # DBL_LN10
2614        attributes: ""
2615      - key: "LN2"
2616        value:
2617          type: double
2618          bytes: "3fe62e42fefa39ef"  # DBL_LN2
2619        attributes: ""
2620      - key: "LOG2E"
2621        value:
2622          type: double
2623          bytes: "3ff71547652b82fe"  # DBL_LOG2E
2624        attributes: ""
2625      - key: "LOG10E"
2626        value:
2627          type: double
2628          bytes: "3fdbcb7b1526e50e"  # DBL_LOG10E
2629        attributes: ""
2630      - key: "PI"
2631        value:
2632          type: double
2633          bytes: "400921fb54442d18"  # DBL_PI
2634        attributes: ""
2635      - key: "SQRT1_2"
2636        value:
2637          type: double
2638          bytes: "3fe6a09e667f3bcd"  # DBL_SQRT1_2
2639        attributes: ""
2640      - key: "SQRT2"
2641        value:
2642          type: double
2643          bytes: "3ff6a09e667f3bcd"  # DBL_SQRT2
2644        attributes: ""
2645
2646      - key: "abs"
2647        value:
2648          type: function
2649          native: duk_bi_math_object_onearg_shared
2650          length: 1
2651          magic:
2652            type: math_onearg
2653            funcname: "fabs"
2654      - key: "acos"
2655        value:
2656          type: function
2657          native: duk_bi_math_object_onearg_shared
2658          length: 1
2659          magic:
2660            type: math_onearg
2661            funcname: "acos"
2662      - key: "asin"
2663        value:
2664          type: function
2665          native: duk_bi_math_object_onearg_shared
2666          length: 1
2667          magic:
2668            type: math_onearg
2669            funcname: "asin"
2670      - key: "atan"
2671        value:
2672          type: function
2673          native: duk_bi_math_object_onearg_shared
2674          length: 1
2675          magic:
2676            type: math_onearg
2677            funcname: "atan"
2678      - key: "atan2"
2679        value:
2680          type: function
2681          native: duk_bi_math_object_twoarg_shared
2682          length: 2
2683          magic:
2684            type: math_twoarg
2685            funcname: "atan2"
2686      - key: "cbrt"
2687        value:
2688          type: function
2689          native: duk_bi_math_object_onearg_shared
2690          length: 1
2691          magic:
2692            type: math_onearg
2693            funcname: "cbrt"
2694        es6: true
2695        present_if: DUK_USE_ES6
2696      - key: "ceil"
2697        value:
2698          type: function
2699          native: duk_bi_math_object_onearg_shared
2700          length: 1
2701          magic:
2702            type: math_onearg
2703            funcname: "ceil"
2704      - key: "clz32"
2705        value:
2706          type: function
2707          native: duk_bi_math_object_clz32
2708          length: 1
2709        es6: true
2710        present_if: DUK_USE_ES6
2711      - key: "cos"
2712        value:
2713          type: function
2714          native: duk_bi_math_object_onearg_shared
2715          length: 1
2716          magic:
2717            type: math_onearg
2718            funcname: "cos"
2719      - key: "exp"
2720        value:
2721          type: function
2722          native: duk_bi_math_object_onearg_shared
2723          length: 1
2724          magic:
2725            type: math_onearg
2726            funcname: "exp"
2727      - key: "floor"
2728        value:
2729          type: function
2730          native: duk_bi_math_object_onearg_shared
2731          length: 1
2732          magic:
2733            type: math_onearg
2734            funcname: "floor"
2735      - key: "hypot"
2736        value:
2737          type: function
2738          native: duk_bi_math_object_hypot
2739          length: 2
2740          varargs: true
2741        es6: true
2742        present_if: DUK_USE_ES6
2743      - key: "imul"
2744        value:
2745          type: function
2746          native: duk_bi_math_object_imul
2747          length: 2
2748        es6: true
2749        present_if: DUK_USE_ES6
2750      - key: "log"
2751        value:
2752          type: function
2753          native: duk_bi_math_object_onearg_shared
2754          length: 1
2755          magic:
2756            type: math_onearg
2757            funcname: "log"
2758      - key: "log2"
2759        value:
2760          type: function
2761          native: duk_bi_math_object_onearg_shared
2762          length: 1
2763          magic:
2764            type: math_onearg
2765            funcname: "log2"
2766        es6: true
2767        present_if: DUK_USE_ES6
2768      - key: "log10"
2769        value:
2770          type: function
2771          native: duk_bi_math_object_onearg_shared
2772          length: 1
2773          magic:
2774            type: math_onearg
2775            funcname: "log10"
2776        es6: true
2777        present_if: DUK_USE_ES6
2778      - key: "max"
2779        value:
2780          type: function
2781          native: duk_bi_math_object_max
2782          length: 2
2783          varargs: true
2784      - key: "min"
2785        value:
2786          type: function
2787          native: duk_bi_math_object_min
2788          length: 2
2789          varargs: true
2790      - key: "pow"
2791        value:
2792          type: function
2793          native: duk_bi_math_object_twoarg_shared
2794          length: 2
2795          magic:
2796            type: math_twoarg
2797            funcname: "pow"
2798      - key: "random"
2799        value:
2800          type: function
2801          native: duk_bi_math_object_random
2802          length: 0
2803      - key: "round"
2804        value:
2805          type: function
2806          native: duk_bi_math_object_onearg_shared
2807          length: 1
2808          magic:
2809            type: math_onearg
2810            funcname: "round"
2811      - key: "sign"
2812        value:
2813          type: function
2814          native: duk_bi_math_object_sign
2815          length: 1
2816        es6: true
2817        present_if: DUK_USE_ES6
2818      - key: "sin"
2819        value:
2820          type: function
2821          native: duk_bi_math_object_onearg_shared
2822          length: 1
2823          magic:
2824            type: math_onearg
2825            funcname: "sin"
2826      - key: "sqrt"
2827        value:
2828          type: function
2829          native: duk_bi_math_object_onearg_shared
2830          length: 1
2831          magic:
2832            type: math_onearg
2833            funcname: "sqrt"
2834      - key: "tan"
2835        value:
2836          type: function
2837          native: duk_bi_math_object_onearg_shared
2838          length: 1
2839          magic:
2840            type: math_onearg
2841            funcname: "tan"
2842      - key: "trunc"
2843        value:
2844          type: function
2845          native: duk_bi_math_object_onearg_shared
2846          length: 1
2847          magic:
2848            type: math_onearg
2849            funcname: "trunc"
2850        es6: true
2851        present_if: DUK_USE_ES6
2852      - key:
2853          type: symbol
2854          variant: wellknown
2855          string: "Symbol.toStringTag"
2856        value: "Math"
2857        attributes: "c"
2858        es6: true
2859        present_if: DUK_USE_SYMBOL_BUILTIN
2860
2861  - id: bi_json
2862    class: JSON
2863    internal_prototype: bi_object_prototype
2864    bidx: false
2865    present_if:
2866      - DUK_USE_JSON_BUILTIN
2867      - DUK_USE_JSON_SUPPORT
2868
2869    # apparently no external "prototype" property
2870    # apparently no external "constructor" property
2871
2872    properties:
2873      - key: "parse"
2874        value:
2875          type: function
2876          native: duk_bi_json_object_parse
2877          length: 2
2878      - key: "stringify"
2879        value:
2880          type: function
2881          native: duk_bi_json_object_stringify
2882          length: 3
2883
2884      #- key:  # @@toStringTag
2885      #    type: symbol
2886      #    variant: wellknown
2887      #    string: "Symbol.toStringTag"
2888      #  value: XXX
2889      #  es6: true
2890      #  present_if: DUK_USE_SYMBOL_BUILTIN
2891
2892  # E5 Section 13.2.3
2893  - id: bi_type_error_thrower
2894    class: Function
2895    internal_prototype: bi_function_prototype
2896    native: duk_bi_type_error_thrower
2897    callable: true
2898    constructable: false  # This is not clearly specified, but [[Construct]] is not set in E5 Section 13.2.3.
2899    bidx: true
2900
2901    properties:
2902      - key: "length"
2903        value: 0
2904        attributes: "c"
2905      # Custom name, matches V8; ES2016 describes %ThrowTypeError% as being
2906      # anonymous.
2907      - key: "name"
2908        value: "ThrowTypeError"
2909        attributes: "c"
2910        duktape: true
2911
2912  #
2913  #  Duktape-specific built-ins
2914  #
2915
2916  - id: bi_duktape
2917    class: Object
2918    internal_prototype: bi_object_prototype
2919    duktape: true
2920    bidx: true
2921    #present_if: DUK_USE_DUKTAPE_BUILTIN  # Present even when properties disabled, error augmentation relies on it
2922
2923    # There are a few properties not listed here:
2924    #   - "version" is added from parameter file automatically.
2925    #   - "env" is added dynamically at runtime.
2926
2927    properties:
2928      - key: "Pointer"
2929        value:
2930          type: object
2931          id: bi_pointer_constructor
2932        duktape: true
2933        present_if: DUK_USE_DUKTAPE_BUILTIN
2934      - key: "Thread"
2935        value:
2936          type: object
2937          id: bi_thread_constructor
2938        duktape: true
2939        present_if:
2940          - DUK_USE_COROUTINE_SUPPORT
2941          - DUK_USE_DUKTAPE_BUILTIN
2942      - key: "info"
2943        value:
2944          type: function
2945          native: duk_bi_duktape_object_info
2946          length: 1
2947        duktape: true
2948        present_if: DUK_USE_DUKTAPE_BUILTIN
2949      - key: "act"
2950        value:
2951          type: function
2952          native: duk_bi_duktape_object_act
2953          length: 1
2954        duktape: true
2955        present_if: DUK_USE_DUKTAPE_BUILTIN
2956      - key: "gc"
2957        value:
2958          type: function
2959          native: duk_bi_duktape_object_gc
2960          length: 1
2961        duktape: true
2962        present_if: DUK_USE_DUKTAPE_BUILTIN
2963      - key: "fin"
2964        value:
2965          type: function
2966          native: duk_bi_duktape_object_fin
2967          length: 0
2968          varargs: true
2969        duktape: true
2970        present_if:
2971          - DUK_USE_FINALIZER_SUPPORT
2972          - DUK_USE_DUKTAPE_BUILTIN
2973      - key: "enc"
2974        value:
2975          type: function
2976          native: duk_bi_duktape_object_enc
2977          length: 0
2978          varargs: true
2979        duktape: true
2980        present_if: DUK_USE_DUKTAPE_BUILTIN
2981      - key: "dec"
2982        value:
2983          type: function
2984          native: duk_bi_duktape_object_dec
2985          length: 0
2986          varargs: true
2987        duktape: true
2988        present_if: DUK_USE_DUKTAPE_BUILTIN
2989      - key: "compact"
2990        value:
2991          type: function
2992          native: duk_bi_duktape_object_compact
2993          length: 1
2994        duktape: true
2995        present_if: DUK_USE_DUKTAPE_BUILTIN
2996
2997  - id: bi_thread_constructor
2998    class: Function
2999    internal_prototype: bi_function_prototype
3000    varargs: true
3001    native: duk_bi_thread_constructor
3002    callable: true
3003    constructable: true
3004    duktape: true
3005    bidx: false
3006    present_if: DUK_USE_COROUTINE_SUPPORT
3007
3008    properties:
3009      - key: "length"
3010        value: 1
3011        attributes: "c"
3012        duktape: true
3013      - key: "prototype"
3014        value:
3015          type: object
3016          id: bi_thread_prototype
3017        attributes: ""
3018        duktape: true
3019      - key: "name"
3020        value: "Thread"
3021        attributes: "c"
3022        duktape: true
3023
3024      # "yield" is a reserved word but does not prevent its use as a property name
3025      - key: "yield"
3026        value:
3027          type: function
3028          native: duk_bi_thread_yield
3029          length: 2
3030        duktape: true
3031        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
3032        present_if: DUK_USE_COROUTINE_SUPPORT
3033      - key: "resume"
3034        value:
3035          type: function
3036          native: duk_bi_thread_resume
3037          length: 3
3038        duktape: true
3039        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
3040        present_if: DUK_USE_COROUTINE_SUPPORT
3041      - key: "current"
3042        value:
3043          type: function
3044          native: duk_bi_thread_current
3045          length: 0
3046        duktape: true
3047        present_if: DUK_USE_COROUTINE_SUPPORT
3048
3049  - id: bi_thread_prototype
3050    class: Object
3051    internal_prototype: bi_object_prototype
3052    duktape: true
3053    bidx: true
3054    # Present even when DUK_USE_DUKTAPE_BUILTIN disabled.
3055
3056    # Must be present even if coroutines are disabled for inheritance.
3057    # Because Duktape.Thread.prototype is missing, the only way to access
3058    # the prototype to e.g. add methods is to look it up from a thread
3059    # instance.
3060
3061    # Note: we don't keep up with the E5 convention that prototype objects
3062    # are some faux instances of their type (e.g. Date.prototype is a Date
3063    # instance).
3064    #
3065    # Also, we don't currently have a "constructor" property because there is
3066    # no explicit constructor object.
3067
3068    properties:
3069      - key: "constructor"
3070        value:
3071          type: object
3072          id: bi_thread_constructor
3073        attributes: "wc"
3074        duktape: true
3075        present_if:
3076          - DUK_USE_COROUTINE_SUPPORT
3077          - DUK_USE_DUKTAPE_BUILTIN
3078
3079      # toString() and valueOf() are inherited from Object.prototype
3080
3081  - id: bi_pointer_constructor
3082    class: Function
3083    internal_prototype: bi_function_prototype
3084    varargs: true
3085    native: duk_bi_pointer_constructor
3086    callable: true
3087    constructable: true
3088    duktape: true
3089    bidx: false
3090
3091    properties:
3092      - key: "length"
3093        value: 1
3094        attributes: "c"
3095        duktape: true
3096      - key: "prototype"
3097        value:
3098          type: object
3099          id: bi_pointer_prototype
3100        attributes: ""
3101        duktape: true
3102      - key: "name"
3103        value: "Pointer"
3104        attributes: "c"
3105        duktape: true
3106
3107  - id: bi_pointer_prototype
3108    class: Pointer
3109    internal_prototype: bi_object_prototype
3110    duktape: true
3111    bidx: true
3112    # Present even when DUK_USE_DUKTAPE_BUILTIN disabled.
3113
3114    properties:
3115      - key: "constructor"
3116        value:
3117          type: object
3118          id: bi_pointer_constructor
3119        attributes: "wc"
3120        duktape: true
3121        present_if: DUK_USE_DUKTAPE_BUILTIN
3122
3123      - key: "toString"
3124        value:
3125          type: function
3126          native: duk_bi_pointer_prototype_tostring_shared
3127          length: 0
3128          magic: 1  # magic = to_string
3129        duktape: true
3130        present_if: DUK_USE_DUKTAPE_BUILTIN
3131      - key: "valueOf"
3132        value:
3133          type: function
3134          native: duk_bi_pointer_prototype_tostring_shared
3135          length: 0
3136          magic: 0  # magic = to_string
3137        duktape: true
3138        present_if: DUK_USE_DUKTAPE_BUILTIN
3139
3140  # This is an Error *instance* used to avoid allocation when a "double error" occurs.
3141  # The object is "frozen and sealed" to avoid code accidentally modifying the instance.
3142  # This is important because the error is rethrown as is.
3143
3144  - id: bi_double_error
3145    class: Error
3146    internal_prototype: bi_error_prototype
3147    extensible: false
3148    duktape: true
3149    bidx: true
3150
3151    # Note: this is the only non-extensible built-in, so there is special
3152    # post-tweak in duk_hthread_builtins.c to handle this.
3153
3154    properties:
3155      - key: "name"
3156        value: "DoubleError"
3157        attributes: ""
3158        duktape: true
3159      - key: "message"
3160        value: "error in error handling"
3161        attributes: ""
3162        duktape: true
3163
3164  #
3165  #  ES2015
3166  #
3167
3168  - id: bi_proxy_constructor
3169    class: Function
3170    internal_prototype: bi_function_prototype
3171    # no external prototype
3172    native: duk_bi_proxy_constructor
3173    callable: true
3174    constructable: true
3175    es6: true
3176    bidx: false
3177    present_if: DUK_USE_ES6_PROXY
3178
3179    properties:
3180      - key: "length"
3181        value: 2
3182        attributes: "c"
3183        es6: true
3184      - key: "name"
3185        value: "Proxy"
3186        attributes: "c"
3187        es6: true
3188      #- key: "revocable"
3189      #  value:
3190      #    type: function
3191      #    native: duk_bi_proxy_constructor_revocable
3192      #    length: 2
3193      #  es6: true
3194
3195  - id: bi_reflect
3196    class: Object
3197    internal_prototype: bi_object_prototype
3198    bidx: false
3199    present_if: DUK_USE_REFLECT_BUILTIN
3200
3201    properties:
3202      - key: "apply"
3203        value:
3204          type: function
3205          native: duk_bi_reflect_apply
3206          length: 3
3207          magic: 2  # see duk_js_call.c
3208          special_call: true
3209        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
3210        es6: true
3211      - key: "construct"
3212        value:
3213          type: function
3214          native: duk_bi_reflect_construct
3215          length: 2
3216          magic: 3  # see duk_js_call.c
3217          special_call: true
3218        auto_lightfunc: false  # automatic lightfunc conversion clashes with internal implementation
3219        es6: true
3220      - key: "defineProperty"
3221        value:
3222          type: function
3223          native: duk_bi_object_constructor_define_property
3224          length: 3
3225          magic: 1
3226        es6: true
3227      - key: "deleteProperty"
3228        value:
3229          type: function
3230          native: duk_bi_reflect_object_delete_property
3231          length: 2
3232        es6: true
3233      - key: "get"
3234        value:
3235          type: function
3236          native: duk_bi_reflect_object_get
3237          length: 2
3238          varargs: true
3239        es6: true
3240      - key: "getOwnPropertyDescriptor"
3241        value:
3242          type: function
3243          native: duk_bi_object_constructor_get_own_property_descriptor
3244          length: 2
3245          magic: 1
3246        es6: true
3247      - key: "getPrototypeOf"
3248        value:
3249          type: function
3250          native: duk_bi_object_getprototype_shared
3251          length: 1
3252          magic: 2
3253        es6: true
3254      - key: "has"
3255        value:
3256          type: function
3257          native: duk_bi_reflect_object_has
3258          length: 2
3259        es6: true
3260      - key: "isExtensible"
3261        value:
3262          type: function
3263          native: duk_bi_object_constructor_is_extensible
3264          length: 1
3265          magic: 1
3266        es6: true
3267      - key: "ownKeys"
3268        value:
3269          type: function
3270          native: duk_bi_object_constructor_keys_shared
3271          length: 1
3272          magic: 3
3273        es6: true
3274      - key: "preventExtensions"
3275        value:
3276          type: function
3277          native: duk_bi_object_constructor_prevent_extensions
3278          length: 1
3279          magic: 1
3280        es6: true
3281      - key: "set"
3282        value:
3283          type: function
3284          native: duk_bi_reflect_object_set
3285          length: 3
3286          varargs: true
3287        es6: true
3288      - key: "setPrototypeOf"
3289        value:
3290          type: function
3291          native: duk_bi_object_setprototype_shared
3292          length: 2
3293          magic: 2
3294        es6: true
3295
3296  - id: bi_symbol_constructor
3297    class: Function
3298    internal_prototype: bi_function_prototype
3299    native: duk_bi_symbol_constructor_shared
3300    callable: true
3301    constructable: false  # new Symbol() not allowed
3302    es6: true
3303    nargs: 1
3304    magic: 0
3305    bidx: false
3306    present_if: DUK_USE_SYMBOL_BUILTIN
3307
3308    properties:
3309      - key: "length"
3310        value: 0
3311        attributes: "c"
3312        es6: true
3313      - key: "name"
3314        value: "Symbol"
3315        attributes: "c"
3316        es6: true
3317      - key: "prototype"
3318        value:
3319          type: object
3320          id: bi_symbol_prototype
3321        attributes: ""
3322        es6: true
3323
3324      - key: "for"
3325        value:
3326          type: function
3327          native: duk_bi_symbol_constructor_shared
3328          magic: 1
3329          length: 1
3330          nargs: 1
3331        attributes: "wc"
3332        es6: true
3333      - key: "keyFor"
3334        value:
3335          type: function
3336          native: duk_bi_symbol_key_for
3337          length: 1
3338          nargs: 1
3339        attributes: "wc"
3340        es6: true
3341
3342      - key: "hasInstance"
3343        value:
3344          type: symbol
3345          variant: wellknown
3346          string: "Symbol.hasInstance"
3347        attributes: ""
3348        es6: true
3349        present_if: DUK_USE_SYMBOL_BUILTIN
3350      - key: "isConcatSpreadable"
3351        value:
3352          type: symbol
3353          variant: wellknown
3354          string: "Symbol.isConcatSpreadable"
3355        attributes: ""
3356        es6: true
3357      - key: "iterator"
3358        value:
3359          type: symbol
3360          variant: wellknown
3361          string: "Symbol.iterator"
3362        attributes: ""
3363        es6: true
3364        present_if: DUK_USE_SYMBOL_BUILTIN
3365      #- key: "match"
3366      #  value:
3367      #    type: symbol
3368      #    variant: wellknown
3369      #    string: "Symbol.match"
3370      #  attributes: ""
3371      #  es6: true
3372      #- key: "replace"
3373      #  value:
3374      #    type: symbol
3375      #    variant: wellknown
3376      #    string: "Symbol.replace"
3377      #  attributes: ""
3378      #  es6: true
3379      #- key: "search"
3380      #  value:
3381      #    type: symbol
3382      #    variant: wellknown
3383      #    string: "Symbol.search"
3384      #  attributes: ""
3385      #  es6: true
3386      #- key: "species"
3387      #  value:
3388      #    type: symbol
3389      #    variant: wellknown
3390      #    string: "Symbol.species"
3391      #  attributes: ""
3392      #  es6: true
3393      #- key: "split"
3394      #  value:
3395      #    type: symbol
3396      #    variant: wellknown
3397      #    string: "Symbol.split"
3398      #  attributes: ""
3399      #  es6: true
3400      - key: "toPrimitive"
3401        value:
3402          type: symbol
3403          variant: wellknown
3404          string: "Symbol.toPrimitive"
3405        attributes: ""
3406        es6: true
3407      - key: "toStringTag"
3408        value:
3409          type: symbol
3410          variant: wellknown
3411          string: "Symbol.toStringTag"
3412        attributes: ""
3413        es6: true
3414      #- key: "unscopables"
3415      #  value:
3416      #    type: symbol
3417      #    variant: wellknown
3418      #    string: "Symbol.unscopables"
3419      #  attributes: ""
3420      #  es6: true
3421
3422  - id: bi_symbol_prototype
3423    class: Object
3424    internal_prototype: bi_object_prototype
3425    es6: true
3426    bidx: true
3427    # Present even when DUK_USE_SYMBOL_BUILTIN disabled so that symbol values
3428    # created from C code can inherit through the Symbol prototype.
3429
3430    properties:
3431      - key: "constructor"
3432        value:
3433          type: object
3434          id: bi_symbol_constructor
3435        attributes: "wc"
3436        es6: true
3437        present_if: DUK_USE_SYMBOL_BUILTIN
3438
3439      - key: "toString"
3440        value:
3441          type: function
3442          native: duk_bi_symbol_tostring_shared
3443          nargs: 0
3444          magic: 0
3445        attributes: "wc"
3446        es6: true
3447        present_if: DUK_USE_SYMBOL_BUILTIN
3448      - key: "valueOf"
3449        value:
3450          type: function
3451          native: duk_bi_symbol_tostring_shared
3452          nargs: 0
3453          magic: 1
3454        attributes: "wc"
3455        es6: true
3456        present_if: DUK_USE_SYMBOL_BUILTIN
3457      - key:  # @@toPrimitive
3458          type: symbol
3459          variant: wellknown
3460          string: "Symbol.toPrimitive"
3461        value:
3462          type: function
3463          native: duk_bi_symbol_toprimitive
3464          nargs: 0  # hint is ignored
3465          length: 0
3466          name: "[Symbol.toPrimitive]"
3467        attributes: "c"
3468        es6: true
3469        present_if: DUK_USE_SYMBOL_BUILTIN
3470      - key:  # @@toStringTag
3471          type: symbol
3472          variant: wellknown
3473          string: "Symbol.toStringTag"
3474        value: "Symbol"
3475        attributes: "c"
3476        es6: true
3477        present_if: DUK_USE_SYMBOL_BUILTIN
3478
3479  - id: bi_promise_constructor
3480    class: Function
3481    internal_prototype: bi_function_prototype
3482    native: duk_bi_promise_constructor
3483    callable: true
3484    constructable: true
3485    es6: true
3486    nargs: 1
3487    magic: 0
3488    bidx: false
3489    present_if: DUK_USE_PROMISE_BUILTIN
3490
3491    properties:
3492      - key: "length"
3493        value: 1
3494        attributes: "c"
3495        es6: true
3496      - key: "name"
3497        value: "Promise"
3498        attributes: "c"
3499        es6: true
3500      - key: 'prototype'
3501        value:
3502          type: object
3503          id: bi_promise_prototype
3504        attributes: ""
3505        es6: true
3506      - key: 'all'
3507        value:
3508          type: function
3509          native: duk_bi_promise_all
3510          length: 1
3511          varargs: false
3512        attributes: 'wc'
3513        es6: true
3514      - key: 'race'
3515        value:
3516          type: function
3517          native: duk_bi_promise_race
3518          length: 1
3519          varargs: false
3520        attributes: 'wc'
3521        es6: true
3522      - key: 'reject'
3523        value:
3524          type: function
3525          native: duk_bi_promise_reject
3526          length: 1
3527          varargs: false
3528        attributes: 'wc'
3529        es6: true
3530      - key: 'resolve'
3531        value:
3532          type: function
3533          native: duk_bi_promise_resolve
3534          length: 1
3535          varargs: false
3536        attributes: 'wc'
3537        es6: true
3538      # @@species
3539      # 'defer' is obsolete and not implemented:
3540      # https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred.
3541      # 'accept' is obsolete and not implemented:
3542      #https://bugs.chromium.org/p/v8/issues/detail?id=3238
3543      # 'try': https://github.com/tc39/proposal-promise-try
3544
3545  - id: bi_promise_prototype
3546    class: Object
3547    internal_prototype: bi_object_prototype
3548    es6: true
3549    bidx: true
3550    present_if: DUK_USE_PROMISE_BUILTIN
3551
3552    properties:
3553      - key: 'constructor'
3554        value:
3555          type: object
3556          id: bi_promise_constructor
3557        attributes: "wc"
3558        es6: true
3559      - key: 'catch'
3560        value:
3561          type: function
3562          native: duk_bi_promise_catch
3563          length: 1
3564          varargs: false
3565        attributes: 'wc'
3566        es6: true
3567      - key: 'then'
3568        value:
3569          type: function
3570          native: duk_bi_promise_then
3571          length: 2
3572          varargs: false
3573        attributes: 'wc'
3574        es6: true
3575      # @@toStringTag
3576      # 'chain' is an obsolete variant of .then and not implemented:
3577      # https://stackoverflow.com/questions/34713965/the-feature-of-method-promise-prototype-chain-in-chrome
3578
3579      # 'finally': https://github.com/tc39/proposal-promise-finally
3580
3581  #
3582  #  TypedArray
3583  #
3584
3585  - id: bi_arraybuffer_constructor
3586    class: Function
3587    internal_prototype: bi_function_prototype
3588    varargs: false
3589    native: duk_bi_arraybuffer_constructor
3590    callable: true
3591    constructable: true
3592    typedarray: true
3593    es6: true
3594    bidx: false
3595    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
3596
3597    properties:
3598      - key: "length"
3599        value: 1
3600        attributes: "c"
3601        typedarray: true
3602        es6: true
3603      - key: "prototype"
3604        value:
3605          type: object
3606          id: bi_arraybuffer_prototype
3607        attributes: ""
3608        typedarray: true
3609        es6: true
3610      - key: "name"
3611        value: "ArrayBuffer"
3612        attributes: "c"
3613        es6: true
3614      - key: "isView"
3615        value:
3616          type: function
3617          native: duk_bi_arraybuffer_isview
3618          length: 1
3619          varargs: false
3620        typedarray: true
3621        es6: true
3622
3623      #- key:  # @@species
3624      #    type: symbol
3625      #    variant: wellknown
3626      #    string: "Symbol.species"
3627      #  value: XXX
3628      #  es6: true
3629
3630  - id: bi_arraybuffer_prototype
3631    class: Object
3632    internal_prototype: bi_object_prototype
3633    typedarray: true
3634    es6: true
3635    bidx: true
3636    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
3637
3638    properties:
3639      - key: "byteLength"
3640        value:
3641          type: accessor
3642          getter: duk_bi_typedarray_bytelength_getter  # XXX: more lenient than required by spec now
3643          getter_nargs: 0
3644          getter_magic: 0
3645        attributes: ""
3646        typedarray: true
3647        es6: true
3648      - key: "constructor"
3649        value:
3650          type: object
3651          id: bi_arraybuffer_constructor
3652        attributes: "wc"
3653        typedarray: true
3654        es6: true
3655      - key: "slice"
3656        value:
3657          type: function
3658          native: duk_bi_buffer_slice_shared
3659          length: 2
3660          varargs: false
3661          magic: 2  # magic: 0x01=isView, 0x02=create copy, 0x04=Node.js Buffer special
3662        typedarray: true
3663        es6: true
3664
3665      #- key:  # @@toStringTag
3666      #    type: symbol
3667      #    variant: wellknown
3668      #    string: "Symbol.toStringTag"
3669      #  value: XXX
3670      #  es6: true
3671
3672  - id: bi_dataview_constructor
3673    class: Function
3674    internal_prototype: bi_function_prototype
3675    varargs: false
3676    native: duk_bi_dataview_constructor
3677    callable: true
3678    constructable: true
3679    typedarray: true
3680    es6: true
3681    bidx: false
3682    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
3683
3684    properties:
3685      - key: "length"
3686        value: 3
3687        attributes: "c"
3688        typedarray: true
3689        es6: true
3690      - key: "prototype"
3691        value:
3692          type: object
3693          id: bi_dataview_prototype
3694        attributes: ""
3695        typedarray: true
3696        es6: true
3697      - key: "name"
3698        value: "DataView"
3699        attributes: "c"
3700        es6: true
3701
3702      #- key:  # @@species
3703      #    type: symbol
3704      #    variant: wellknown
3705      #    string: "Symbol.species"
3706      #  value: XXX
3707      #  es6: true
3708
3709  - id: bi_dataview_prototype
3710    class: Object
3711    internal_prototype: bi_object_prototype
3712    typedarray: true
3713    es6: true
3714    bidx: true
3715    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
3716
3717    properties:
3718      - key: "byteLength"
3719        value:
3720          type: accessor
3721          getter: duk_bi_typedarray_bytelength_getter
3722          getter_nargs: 0
3723          getter_magic: 0
3724        attributes: ""
3725        typedarray: true
3726        es6: true
3727      - key: "byteOffset"
3728        value:
3729          type: accessor
3730          getter: duk_bi_typedarray_byteoffset_getter
3731          getter_nargs: 0
3732          getter_magic: 0
3733        attributes: ""
3734        typedarray: true
3735        es6: true
3736      - key: "buffer"
3737        value:
3738          type: accessor
3739          getter: duk_bi_typedarray_buffer_getter
3740          getter_nargs: 0
3741          getter_magic: 0
3742        attributes: ""
3743        typedarray: true
3744        es6: true
3745      - key: "constructor"
3746        value:
3747          type: object
3748          id: bi_dataview_constructor
3749        attributes: "wc"
3750        typedarray: true
3751        es6: true
3752
3753      # Int8/Uint8 get/set calls don't have a little endian argument
3754      # but length/nargs must provide it for the shared helper anyway.
3755
3756      - key: "getInt8"
3757        value:
3758          type: function
3759          native: duk_bi_buffer_readfield
3760          length: 2
3761          varargs: false
3762          magic:
3763            type: buffer_readfield
3764            elem: "8bit"
3765            signed: true
3766            bigendian: false
3767            typedarray: true
3768        typedarray: true
3769        es6: true
3770      - key: "getUint8"
3771        value:
3772          type: function
3773          native: duk_bi_buffer_readfield
3774          length: 2
3775          varargs: false
3776          magic:
3777            type: buffer_readfield
3778            elem: "8bit"
3779            signed: false
3780            bigendian: false
3781            typedarray: true
3782        typedarray: true
3783        es6: true
3784      - key: "getInt16"
3785        value:
3786          type: function
3787          native: duk_bi_buffer_readfield
3788          length: 2
3789          varargs: false
3790          magic:
3791            type: buffer_readfield
3792            elem: "16bit"
3793            signed: true
3794            bigendian: false
3795            typedarray: true
3796        typedarray: true
3797        es6: true
3798      - key: "getUint16"
3799        value:
3800          type: function
3801          native: duk_bi_buffer_readfield
3802          length: 2
3803          varargs: false
3804          magic:
3805            type: buffer_readfield
3806            elem: "16bit"
3807            signed: false
3808            bigendian: false
3809            typedarray: true
3810        typedarray: true
3811        es6: true
3812      - key: "getInt32"
3813        value:
3814          type: function
3815          native: duk_bi_buffer_readfield
3816          length: 2
3817          varargs: false
3818          magic:
3819            type: buffer_readfield
3820            elem: "32bit"
3821            signed: true
3822            bigendian: false
3823            typedarray: true
3824        typedarray: true
3825        es6: true
3826      - key: "getUint32"
3827        value:
3828          type: function
3829          native: duk_bi_buffer_readfield
3830          length: 2
3831          varargs: false
3832          magic:
3833            type: buffer_readfield
3834            elem: "32bit"
3835            signed: false
3836            bigendian: false
3837            typedarray: true
3838        typedarray: true
3839        es6: true
3840      - key: "getFloat32"
3841        value:
3842          type: function
3843          native: duk_bi_buffer_readfield
3844          length: 2
3845          varargs: false
3846          magic:
3847            type: buffer_readfield
3848            elem: "float"
3849            signed: false
3850            bigendian: false
3851            typedarray: true
3852        typedarray: true
3853        es6: true
3854      - key: "getFloat64"
3855        value:
3856          type: function
3857          native: duk_bi_buffer_readfield
3858          length: 2
3859          varargs: false
3860          magic:
3861            type: buffer_readfield
3862            elem: "double"
3863            signed: false
3864            bigendian: false
3865            typedarray: true
3866        typedarray: true
3867        es6: true
3868      - key: "setInt8"
3869        value:
3870          type: function
3871          native: duk_bi_buffer_writefield
3872          length: 3
3873          varargs: false
3874          magic:
3875            type: buffer_writefield
3876            elem: "8bit"
3877            signed: true
3878            bigendian: false
3879            typedarray: true
3880        typedarray: true
3881        es6: true
3882      - key: "setUint8"
3883        value:
3884          type: function
3885          native: duk_bi_buffer_writefield
3886          length: 3
3887          varargs: false
3888          magic:
3889            type: buffer_writefield
3890            elem: "8bit"
3891            signed: false
3892            bigendian: false
3893            typedarray: true
3894        typedarray: true
3895        es6: true
3896      - key: "setInt16"
3897        value:
3898          type: function
3899          native: duk_bi_buffer_writefield
3900          length: 3
3901          varargs: false
3902          magic:
3903            type: buffer_writefield
3904            elem: "16bit"
3905            signed: true
3906            bigendian: false
3907            typedarray: true
3908        typedarray: true
3909        es6: true
3910      - key: "setUint16"
3911        value:
3912          type: function
3913          native: duk_bi_buffer_writefield
3914          length: 3
3915          varargs: false
3916          magic:
3917            type: buffer_writefield
3918            elem: "16bit"
3919            signed: false
3920            bigendian: false
3921            typedarray: true
3922        typedarray: true
3923        es6: true
3924      - key: "setInt32"
3925        value:
3926          type: function
3927          native: duk_bi_buffer_writefield
3928          length: 3
3929          varargs: false
3930          magic:
3931            type: buffer_writefield
3932            elem: "32bit"
3933            signed: true
3934            bigendian: false
3935            typedarray: true
3936        typedarray: true
3937        es6: true
3938      - key: "setUint32"
3939        value:
3940          type: function
3941          native: duk_bi_buffer_writefield
3942          length: 3
3943          varargs: false
3944          magic:
3945            type: buffer_writefield
3946            elem: "32bit"
3947            signed: false
3948            bigendian: false
3949            typedarray: true
3950        typedarray: true
3951        es6: true
3952      - key: "setFloat32"
3953        value:
3954          type: function
3955          native: duk_bi_buffer_writefield
3956          length: 3
3957          varargs: false
3958          magic:
3959            type: buffer_writefield
3960            elem: "float"
3961            signed: false
3962            bigendian: false
3963            typedarray: true
3964        typedarray: true
3965        es6: true
3966      - key: "setFloat64"
3967        value:
3968          type: function
3969          native: duk_bi_buffer_writefield
3970          length: 3
3971          varargs: false
3972          magic:
3973            type: buffer_writefield
3974            elem: "double"
3975            signed: false
3976            bigendian: false
3977            typedarray: true
3978        typedarray: true
3979        es6: true
3980
3981      #- key:  # @@toStringTag
3982      #    type: symbol
3983      #    variant: wellknown
3984      #    string: "Symbol.toStringTag"
3985      #  value: XXX
3986      #  es6: true
3987
3988  # %TypedArray% constructor
3989  # Prototype object providing properties shared by all TypedArray
3990  # constructors.  Callable, but duk_bi_typedarray_constructor()
3991  # rejects normal calls with TypeError; not constructable which
3992  # rejects constructor calls with TypeError.
3993  - id: bi_typedarray_constructor
3994    class: Function
3995    internal_prototype: bi_function_prototype
3996    varargs: false
3997    native: duk_bi_typedarray_constructor
3998    callable: true
3999    constructable: false
4000    nargs: 0
4001    magic: 0
4002    typedarray: true
4003    es6: true
4004    bidx: false
4005    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4006
4007    properties:
4008      - key: "length"
4009        value: 0
4010        attributes: "c"
4011        typedarray: true
4012        es6: true
4013      - key: "prototype"
4014        value:
4015          type: object
4016          id: bi_typedarray_prototype
4017        attributes: ""
4018        es6: true
4019      - key: "name"
4020        value: "TypedArray"
4021        attributes: "c"
4022        es6: true
4023
4024      # .from
4025      # .of
4026      # @@species getter
4027
4028  # %TypedArrayPrototype%
4029  # Custom prototype object providing properties shared by all TypedArray
4030  # instances (reduces built-in object count).  The view specific prototypes
4031  # (such as Uint8Array.prototype) are still needed so that e.g. instanceof
4032  # will work properly.
4033
4034  - id: bi_typedarray_prototype
4035    class: Object
4036    internal_prototype: bi_object_prototype
4037    # no external_prototype (specific views provide it)
4038    typedarray: true
4039    es6: true
4040    bidx: false
4041    # Present even when DUK_USE_BUFFEROBJECT_SUPPORT is disabled
4042    # to support plain buffers.
4043
4044    properties:
4045      - key: "byteLength"
4046        value:
4047          type: accessor
4048          getter: duk_bi_typedarray_bytelength_getter
4049          getter_nargs: 0
4050          getter_magic: 0
4051        attributes: ""
4052        typedarray: true
4053        es6: true
4054      - key: "byteOffset"
4055        value:
4056          type: accessor
4057          getter: duk_bi_typedarray_byteoffset_getter
4058          getter_nargs: 0
4059          getter_magic: 0
4060        attributes: ""
4061        typedarray: true
4062        es6: true
4063      - key: "buffer"
4064        value:
4065          type: accessor
4066          getter: duk_bi_typedarray_buffer_getter
4067          getter_nargs: 0
4068          getter_magic: 0
4069        attributes: ""
4070        typedarray: true
4071        es6: true
4072        present_if: DUK_USE_BUFFEROBJECT_SUPPORT  # missing without bufferobject support
4073      - key: "set"
4074        value:
4075          type: function
4076          native: duk_bi_typedarray_set
4077          length: 2
4078          varargs: false
4079        typedarray: true
4080        es6: true
4081        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4082      - key: "subarray"
4083        value:
4084          type: function
4085          native: duk_bi_buffer_slice_shared
4086          length: 2
4087          varargs: false
4088          magic: 1  # magic: 0x01=isView, 0x02=create copy, 0x04=Node.js Buffer special
4089        typedarray: true
4090        es6: true
4091        present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4092
4093      #- key:  # @@iterator
4094      #    type: symbol
4095      #    variant: wellknown
4096      #    string: "Symbol.iterator"
4097      #  value: XXX
4098      #  es6: true
4099      #  present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4100      #- key:  # @@toStringTag
4101      #    type: symbol
4102      #    variant: wellknown
4103      #    string: "Symbol.toStringTag"
4104      #  value: XXX
4105      #  es6: true
4106      #  present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4107
4108  - id: bi_int8array_constructor
4109    class: Function
4110    internal_prototype: bi_typedarray_constructor
4111    varargs: false
4112    native: duk_bi_typedarray_constructor
4113    callable: true
4114    constructable: true
4115    magic:
4116      type: typedarray_constructor
4117      elem: "int8"
4118      shift: 0
4119    typedarray: true
4120    es6: true
4121    bidx: false
4122    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4123
4124    properties:
4125      - key: "length"
4126        value: 3
4127        attributes: "c"
4128        typedarray: true
4129        es6: true
4130      - key: "prototype"
4131        value:
4132          type: object
4133          id: bi_int8array_prototype
4134        attributes: ""
4135        typedarray: true
4136        es6: true
4137      - key: "name"
4138        value: "Int8Array"
4139        attributes: "c"
4140        es6: true
4141      - key: "BYTES_PER_ELEMENT"
4142        value: 1
4143        attributes: ""
4144        typedarray: true
4145        es6: true
4146
4147      #- key:  # @@species
4148      #    type: symbol
4149      #    variant: wellknown
4150      #    string: "Symbol.species"
4151      #  value: XXX
4152      #  es6: true
4153
4154  - id: bi_int8array_prototype
4155    internal_prototype: bi_typedarray_prototype
4156    class: Object
4157    typedarray: true
4158    es6: true
4159    bidx: true
4160    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4161
4162    properties:
4163      - key: "constructor"
4164        value:
4165          type: object
4166          id: bi_int8array_constructor
4167        attributes: "wc"
4168        typedarray: true
4169        es6: true
4170      - key: "BYTES_PER_ELEMENT"
4171        value: 1
4172        attributes: ""
4173        typedarray: true
4174        es6: true
4175
4176  - id: bi_uint8array_constructor
4177    class: Function
4178    internal_prototype: bi_typedarray_constructor
4179    varargs: false
4180    native: duk_bi_typedarray_constructor
4181    callable: true
4182    constructable: true
4183    magic:
4184      type: typedarray_constructor
4185      elem: "uint8"
4186      shift: 0
4187    typedarray: true
4188    es6: true
4189    bidx: false
4190    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4191
4192    properties:
4193      - key: "length"
4194        value: 3
4195        attributes: "c"
4196        typedarray: true
4197        es6: true
4198      - key: "prototype"
4199        value:
4200          type: object
4201          id: bi_uint8array_prototype
4202        attributes: ""
4203        typedarray: true
4204        es6: true
4205      - key: "name"
4206        value: "Uint8Array"
4207        attributes: "c"
4208        es6: true
4209      - key: "BYTES_PER_ELEMENT"
4210        value: 1
4211        attributes: ""
4212        typedarray: true
4213        es6: true
4214
4215      # Duktape custom: allocate a plain buffer, return value is always
4216      # a freshly allocated fixed plain buffer.
4217      - key: "allocPlain"
4218        value:
4219          type: function
4220          native: duk_bi_uint8array_allocplain
4221          length: 1
4222          varargs: false
4223        duktape: true
4224
4225      # Duktape custom: get plain buffer underlying a buffer object.
4226      - key: "plainOf"
4227        value:
4228          type: function
4229          native: duk_bi_uint8array_plainof
4230          length: 1
4231          varargs: false
4232        duktape: true
4233
4234      #- key:  # @@species
4235      #    type: symbol
4236      #    variant: wellknown
4237      #    string: "Symbol.species"
4238      #  value: XXX
4239      #  es6: true
4240
4241  - id: bi_uint8array_prototype
4242    class: Object
4243    internal_prototype: bi_typedarray_prototype
4244    typedarray: true
4245    es6: true
4246    bidx: true
4247    # Present even when DUK_USE_BUFFEROBJECT_SUPPORT is disabled
4248    # to support plain buffers.
4249
4250    properties:
4251      - key: "constructor"
4252        value:
4253          type: object
4254          id: bi_uint8array_constructor
4255        attributes: "wc"
4256        typedarray: true
4257        es6: true
4258        present_if: DUK_USE_BUFFEROBJECT_SUPPORT  # missing without bufferobject support
4259      - key: "BYTES_PER_ELEMENT"
4260        value: 1
4261        attributes: ""
4262        typedarray: true
4263        es6: true
4264
4265  - id: bi_uint8clampedarray_constructor
4266    class: Function
4267    internal_prototype: bi_typedarray_constructor
4268    varargs: false
4269    native: duk_bi_typedarray_constructor
4270    callable: true
4271    constructable: true
4272    magic:
4273      type: typedarray_constructor
4274      elem: "uint8clamped"
4275      shift: 0
4276    typedarray: true
4277    es6: true
4278    bidx: false
4279    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4280
4281    properties:
4282      - key: "length"
4283        value: 3
4284        attributes: "c"
4285        typedarray: true
4286        es6: true
4287      - key: "prototype"
4288        value:
4289          type: object
4290          id: bi_uint8clampedarray_prototype
4291        attributes: ""
4292        typedarray: true
4293        es6: true
4294      - key: "name"
4295        value: "Uint8ClampedArray"
4296        attributes: "c"
4297        es6: true
4298      - key: "BYTES_PER_ELEMENT"
4299        value: 1
4300        attributes: ""
4301        typedarray: true
4302        es6: true
4303
4304      #- key:  # @@species
4305      #    type: symbol
4306      #    variant: wellknown
4307      #    string: "Symbol.species"
4308      #  value: XXX
4309      #  es6: true
4310
4311  - id: bi_uint8clampedarray_prototype
4312    class: Object
4313    internal_prototype: bi_typedarray_prototype
4314    typedarray: true
4315    es6: true
4316    bidx: true
4317    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4318
4319    properties:
4320      - key: "constructor"
4321        value:
4322          type: object
4323          id: bi_uint8clampedarray_constructor
4324        attributes: "wc"
4325        typedarray: true
4326        es6: true
4327      - key: "BYTES_PER_ELEMENT"
4328        value: 1
4329        attributes: ""
4330        typedarray: true
4331        es6: true
4332
4333  - id: bi_int16array_constructor
4334    class: Function
4335    internal_prototype: bi_typedarray_constructor
4336    varargs: false
4337    native: duk_bi_typedarray_constructor
4338    callable: true
4339    constructable: true
4340    magic:
4341      type: typedarray_constructor
4342      elem: "int16"
4343      shift: 1
4344    typedarray: true
4345    es6: true
4346    bidx: false
4347    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4348
4349    properties:
4350      - key: "length"
4351        value: 3
4352        attributes: "c"
4353        typedarray: true
4354        es6: true
4355      - key: "prototype"
4356        value:
4357          type: object
4358          id: bi_int16array_prototype
4359        attributes: ""
4360        typedarray: true
4361        es6: true
4362      - key: "name"
4363        value: "Int16Array"
4364        attributes: "c"
4365        es6: true
4366      - key: "BYTES_PER_ELEMENT"
4367        value: 2
4368        attributes: ""
4369        typedarray: true
4370        es6: true
4371
4372      #- key:  # @@species
4373      #    type: symbol
4374      #    variant: wellknown
4375      #    string: "Symbol.species"
4376      #  value: XXX
4377      #  es6: true
4378
4379  - id: bi_int16array_prototype
4380    class: Object
4381    internal_prototype: bi_typedarray_prototype
4382    typedarray: true
4383    es6: true
4384    bidx: true
4385    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4386
4387    properties:
4388      - key: "constructor"
4389        value:
4390          type: object
4391          id: bi_int16array_constructor
4392        attributes: "wc"
4393        typedarray: true
4394        es6: true
4395      - key: "BYTES_PER_ELEMENT"
4396        value: 2
4397        attributes: ""
4398        typedarray: true
4399        es6: true
4400
4401  - id: bi_uint16array_constructor
4402    class: Function
4403    internal_prototype: bi_typedarray_constructor
4404    varargs: false
4405    native: duk_bi_typedarray_constructor
4406    callable: true
4407    constructable: true
4408    magic:
4409      type: typedarray_constructor
4410      elem: "uint16"
4411      shift: 1
4412    typedarray: true
4413    es6: true
4414    bidx: false
4415    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4416
4417    properties:
4418      - key: "length"
4419        value: 3
4420        attributes: "c"
4421        typedarray: true
4422        es6: true
4423      - key: "prototype"
4424        value:
4425          type: object
4426          id: bi_uint16array_prototype
4427        attributes: ""
4428        typedarray: true
4429        es6: true
4430      - key: "name"
4431        value: "Uint16Array"
4432        attributes: "c"
4433        es6: true
4434      - key: "BYTES_PER_ELEMENT"
4435        value: 2
4436        attributes: ""
4437        typedarray: true
4438        es6: true
4439
4440      #- key:  # @@species
4441      #    type: symbol
4442      #    variant: wellknown
4443      #    string: "Symbol.species"
4444      #  value: XXX
4445      #  es6: true
4446
4447  - id: bi_uint16array_prototype
4448    class: Object
4449    internal_prototype: bi_typedarray_prototype
4450    typedarray: true
4451    es6: true
4452    bidx: true
4453    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4454
4455    properties:
4456      - key: "constructor"
4457        value:
4458          type: object
4459          id: bi_uint16array_constructor
4460        attributes: "wc"
4461        typedarray: true
4462        es6: true
4463      - key: "BYTES_PER_ELEMENT"
4464        value: 2
4465        attributes: ""
4466        typedarray: true
4467        es6: true
4468
4469  - id: bi_int32array_constructor
4470    class: Function
4471    internal_prototype: bi_typedarray_constructor
4472    varargs: false
4473    native: duk_bi_typedarray_constructor
4474    callable: true
4475    constructable: true
4476    magic:
4477      type: typedarray_constructor
4478      elem: "int32"
4479      shift: 2
4480    typedarray: true
4481    es6: true
4482    bidx: false
4483    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4484
4485    properties:
4486      - key: "length"
4487        value: 3
4488        attributes: "c"
4489        typedarray: true
4490        es6: true
4491      - key: "prototype"
4492        value:
4493          type: object
4494          id: bi_int32array_prototype
4495        attributes: ""
4496        typedarray: true
4497        es6: true
4498      - key: "name"
4499        value: "Int32Array"
4500        attributes: "c"
4501        es6: true
4502      - key: "BYTES_PER_ELEMENT"
4503        value: 4
4504        attributes: ""
4505        typedarray: true
4506        es6: true
4507
4508      #- key:  # @@species
4509      #    type: symbol
4510      #    variant: wellknown
4511      #    string: "Symbol.species"
4512      #  value: XXX
4513      #  es6: true
4514
4515  - id: bi_int32array_prototype
4516    class: Object
4517    internal_prototype: bi_typedarray_prototype
4518    typedarray: true
4519    es6: true
4520    bidx: true
4521    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4522
4523    properties:
4524      - key: "constructor"
4525        value:
4526          type: object
4527          id: bi_int32array_constructor
4528        attributes: "wc"
4529        typedarray: true
4530        es6: true
4531      - key: "BYTES_PER_ELEMENT"
4532        value: 4
4533        attributes: ""
4534        typedarray: true
4535        es6: true
4536
4537  - id: bi_uint32array_constructor
4538    class: Function
4539    internal_prototype: bi_typedarray_constructor
4540    varargs: false
4541    native: duk_bi_typedarray_constructor
4542    callable: true
4543    constructable: true
4544    magic:
4545      type: typedarray_constructor
4546      elem: "uint32"
4547      shift: 2
4548    typedarray: true
4549    es6: true
4550    bidx: false
4551    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4552
4553    properties:
4554      - key: "length"
4555        value: 3
4556        attributes: "c"
4557        typedarray: true
4558        es6: true
4559      - key: "prototype"
4560        value:
4561          type: object
4562          id: bi_uint32array_prototype
4563        attributes: ""
4564        typedarray: true
4565        es6: true
4566      - key: "name"
4567        value: "Uint32Array"
4568        attributes: "c"
4569        es6: true
4570      - key: "BYTES_PER_ELEMENT"
4571        value: 4
4572        attributes: ""
4573        typedarray: true
4574        es6: true
4575
4576      #- key:  # @@species
4577      #    type: symbol
4578      #    variant: wellknown
4579      #    string: "Symbol.species"
4580      #  value: XXX
4581      #  es6: true
4582
4583  - id: bi_uint32array_prototype
4584    class: Object
4585    internal_prototype: bi_typedarray_prototype
4586    typedarray: true
4587    es6: true
4588    bidx: true
4589    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4590
4591    properties:
4592      - key: "constructor"
4593        value:
4594          type: object
4595          id: bi_uint32array_constructor
4596        attributes: "wc"
4597        typedarray: true
4598        es6: true
4599      - key: "BYTES_PER_ELEMENT"
4600        value: 4
4601        attributes: ""
4602        typedarray: true
4603        es6: true
4604
4605  - id: bi_float32array_constructor
4606    class: Function
4607    internal_prototype: bi_typedarray_constructor
4608    varargs: false
4609    native: duk_bi_typedarray_constructor
4610    callable: true
4611    constructable: true
4612    magic:
4613      type: typedarray_constructor
4614      elem: "float32"
4615      shift: 2
4616    typedarray: true
4617    es6: true
4618    bidx: false
4619    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4620
4621    properties:
4622      - key: "length"
4623        value: 3
4624        attributes: "c"
4625        typedarray: true
4626        es6: true
4627      - key: "prototype"
4628        value:
4629          type: object
4630          id: bi_float32array_prototype
4631        attributes: ""
4632        typedarray: true
4633        es6: true
4634      - key: "name"
4635        value: "Float32Array"
4636        attributes: "c"
4637        es6: true
4638      - key: "BYTES_PER_ELEMENT"
4639        value: 4
4640        attributes: ""
4641        typedarray: true
4642        es6: true
4643
4644      #- key:  # @@species
4645      #    type: symbol
4646      #    variant: wellknown
4647      #    string: "Symbol.species"
4648      #  value: XXX
4649      #  es6: true
4650
4651  - id: bi_float32array_prototype
4652    class: Object
4653    internal_prototype: bi_typedarray_prototype
4654    typedarray: true
4655    es6: true
4656    bidx: true
4657    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4658
4659    properties:
4660      - key: "constructor"
4661        value:
4662          type: object
4663          id: bi_float32array_constructor
4664        attributes: "wc"
4665        typedarray: true
4666        es6: true
4667      - key: "BYTES_PER_ELEMENT"
4668        value: 4
4669        attributes: ""
4670        typedarray: true
4671        es6: true
4672
4673  - id: bi_float64array_constructor
4674    class: Function
4675    internal_prototype: bi_typedarray_constructor
4676    varargs: false
4677    native: duk_bi_typedarray_constructor
4678    callable: true
4679    constructable: true
4680    magic:
4681      type: typedarray_constructor
4682      elem: "float64"
4683      shift: 3
4684    typedarray: true
4685    es6: true
4686    bidx: false
4687    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4688
4689    properties:
4690      - key: "length"
4691        value: 3
4692        attributes: "c"
4693        typedarray: true
4694        es6: true
4695      - key: "prototype"
4696        value:
4697          type: object
4698          id: bi_float64array_prototype
4699        attributes: ""
4700        typedarray: true
4701        es6: true
4702      - key: "name"
4703        value: "Float64Array"
4704        attributes: "c"
4705        es6: true
4706      - key: "BYTES_PER_ELEMENT"
4707        value: 8
4708        attributes: ""
4709        typedarray: true
4710        es6: true
4711
4712      #- key:  # @@species
4713      #    type: symbol
4714      #    variant: wellknown
4715      #    string: "Symbol.species"
4716      #  value: XXX
4717      #  es6: true
4718
4719  - id: bi_float64array_prototype
4720    class: Object
4721    internal_prototype: bi_typedarray_prototype
4722    typedarray: true
4723    es6: true
4724    bidx: true
4725    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4726
4727    properties:
4728      - key: "constructor"
4729        value:
4730          type: object
4731          id: bi_float64array_constructor
4732        attributes: "wc"
4733        typedarray: true
4734        es6: true
4735      - key: "BYTES_PER_ELEMENT"
4736        value: 8
4737        attributes: ""
4738        typedarray: true
4739        es6: true
4740
4741  #
4742  #  Node.js Buffer
4743  #
4744
4745  - id: bi_nodejs_buffer_constructor
4746    class: Function
4747    internal_prototype: bi_function_prototype
4748    varargs: false
4749    native: duk_bi_nodejs_buffer_constructor
4750    callable: true
4751    constructable: true
4752    nodejs_buffer: true
4753    bidx: false
4754    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4755
4756    properties:
4757      - key: "length"
4758        value: 2
4759        attributes: "c"
4760        nodejs_buffer: true
4761      - key: "prototype"
4762        value:
4763          type: object
4764          id: bi_nodejs_buffer_prototype
4765        attributes: ""
4766        nodejs_buffer: true
4767      - key: "name"
4768        value: "Buffer"
4769        attributes: "c"
4770        nodejs_buffer: true
4771
4772      - key: "concat"
4773        value:
4774          type: function
4775          native: duk_bi_nodejs_buffer_concat
4776          length: 2
4777          varargs: false
4778        nodejs_buffer: true
4779      - key: "isEncoding"
4780        value:
4781          type: function
4782          native: duk_bi_nodejs_buffer_is_encoding
4783          length: 1
4784          varargs:
4785        nodejs_buffer: true
4786      - key: "isBuffer"
4787        value:
4788          type: function
4789          native: duk_bi_nodejs_buffer_is_buffer
4790          length: 1
4791          varargs: false
4792        nodejs_buffer: true
4793      - key: "byteLength"
4794        value:
4795          type: function
4796          native: duk_bi_nodejs_buffer_byte_length
4797          length: 2
4798          varargs: false
4799        nodejs_buffer: true
4800      - key: "compare"
4801        value:
4802          type: function
4803          native: duk_bi_buffer_compare_shared
4804          length: 2
4805          varargs: false
4806          magic: 3  # magic: 0x02=static call + 0x01=compare = 0x03
4807        nodejs_buffer: true
4808
4809  - id: bi_nodejs_buffer_prototype
4810    internal_prototype: bi_uint8array_prototype
4811    class: Object
4812    nodejs_buffer: true
4813    bidx: true
4814    present_if: DUK_USE_BUFFEROBJECT_SUPPORT
4815
4816    properties:
4817      - key: "constructor"
4818        value:
4819          type: object
4820          id: bi_nodejs_buffer_constructor
4821        attributes: "wc"
4822        nodejs_buffer: true
4823
4824      - key: "readUInt8"
4825        value:
4826          type: function
4827          native: duk_bi_buffer_readfield
4828          length: 2
4829          varargs: false
4830          magic:
4831            type: buffer_readfield
4832            elem: "8bit"
4833            signed: false
4834            bigendian: false
4835            typedarray: false
4836        nodejs_buffer: true
4837      - key: "readInt8"
4838        value:
4839          type: function
4840          native: duk_bi_buffer_readfield
4841          length: 2
4842          varargs: false
4843          magic:
4844            type: buffer_readfield
4845            elem: "8bit"
4846            signed: true
4847            bigendian: false
4848            typedarray: false
4849        nodejs_buffer: true
4850      - key: "readUInt16LE"
4851        value:
4852          type: function
4853          native: duk_bi_buffer_readfield
4854          length: 2
4855          varargs: false
4856          magic:
4857            type: buffer_readfield
4858            elem: "16bit"
4859            signed: false
4860            bigendian: false
4861            typedarray: false
4862        nodejs_buffer: true
4863      - key: "readUInt16BE"
4864        value:
4865          type: function
4866          native: duk_bi_buffer_readfield
4867          length: 2
4868          varargs: false
4869          magic:
4870            type: buffer_readfield
4871            elem: "16bit"
4872            signed: false
4873            bigendian: true
4874            typedarray: false
4875        nodejs_buffer: true
4876      - key: "readInt16LE"
4877        value:
4878          type: function
4879          native: duk_bi_buffer_readfield
4880          length: 2
4881          varargs: false
4882          magic:
4883            type: buffer_readfield
4884            elem: "16bit"
4885            signed: true
4886            bigendian: false
4887            typedarray: false
4888        nodejs_buffer: true
4889      - key: "readInt16BE"
4890        value:
4891          type: function
4892          native: duk_bi_buffer_readfield
4893          length: 2
4894          varargs: false
4895          magic:
4896            type: buffer_readfield
4897            elem: "16bit"
4898            signed: true
4899            bigendian: true
4900            typedarray: false
4901        nodejs_buffer: true
4902      - key: "readUInt32LE"
4903        value:
4904          type: function
4905          native: duk_bi_buffer_readfield
4906          length: 2
4907          varargs: false
4908          magic:
4909            type: buffer_readfield
4910            elem: "32bit"
4911            signed: false
4912            bigendian: false
4913            typedarray: false
4914        nodejs_buffer: true
4915      - key: "readUInt32BE"
4916        value:
4917          type: function
4918          native: duk_bi_buffer_readfield
4919          length: 2
4920          varargs: false
4921          magic:
4922            type: buffer_readfield
4923            elem: "32bit"
4924            signed: false
4925            bigendian: true
4926            typedarray: false
4927        nodejs_buffer: true
4928      - key: "readInt32LE"
4929        value:
4930          type: function
4931          native: duk_bi_buffer_readfield
4932          length: 2
4933          varargs: false
4934          magic:
4935            type: buffer_readfield
4936            elem: "32bit"
4937            signed: true
4938            bigendian: false
4939            typedarray: false
4940        nodejs_buffer: true
4941      - key: "readInt32BE"
4942        value:
4943          type: function
4944          native: duk_bi_buffer_readfield
4945          length: 2
4946          varargs: false
4947          magic:
4948            type: buffer_readfield
4949            elem: "32bit"
4950            signed: true
4951            bigendian: true
4952            typedarray: false
4953        nodejs_buffer: true
4954      - key: "readFloatLE"
4955        value:
4956          type: function
4957          native: duk_bi_buffer_readfield
4958          length: 2
4959          varargs: false
4960          magic:
4961            type: buffer_readfield
4962            elem: "float"
4963            signed: false
4964            bigendian: false
4965            typedarray: false
4966        nodejs_buffer: true
4967      - key: "readFloatBE"
4968        value:
4969          type: function
4970          native: duk_bi_buffer_readfield
4971          length: 2
4972          varargs: false
4973          magic:
4974            type: buffer_readfield
4975            elem: "float"
4976            signed: false
4977            bigendian: true
4978            typedarray: false
4979        nodejs_buffer: true
4980      - key: "readDoubleLE"
4981        value:
4982          type: function
4983          native: duk_bi_buffer_readfield
4984          length: 2
4985          varargs: false
4986          magic:
4987            type: buffer_readfield
4988            elem: "double"
4989            signed: false
4990            bigendian: false
4991            typedarray: false
4992        nodejs_buffer: true
4993      - key: "readDoubleBE"
4994        value:
4995          type: function
4996          native: duk_bi_buffer_readfield
4997          length: 2
4998          varargs: false
4999          magic:
5000            type: buffer_readfield
5001            elem: "double"
5002            signed: false
5003            bigendian: true
5004            typedarray: false
5005        nodejs_buffer: true
5006      - key: "readUIntLE"
5007        value:
5008          type: function
5009          native: duk_bi_buffer_readfield
5010          length: 3
5011          varargs: false
5012          magic:
5013            type: buffer_readfield
5014            elem: "varint"
5015            signed: false
5016            bigendian: false
5017            typedarray: false
5018        nodejs_buffer: true
5019      - key: "readUIntBE"
5020        value:
5021          type: function
5022          native: duk_bi_buffer_readfield
5023          length: 3
5024          varargs: false
5025          magic:
5026            type: buffer_readfield
5027            elem: "varint"
5028            signed: false
5029            bigendian: true
5030            typedarray: false
5031        nodejs_buffer: true
5032      - key: "readIntLE"
5033        value:
5034          type: function
5035          native: duk_bi_buffer_readfield
5036          length: 3
5037          varargs: false
5038          magic:
5039            type: buffer_readfield
5040            elem: "varint"
5041            signed: true
5042            bigendian: false
5043            typedarray: false
5044        nodejs_buffer: true
5045      - key: "readIntBE"
5046        value:
5047          type: function
5048          native: duk_bi_buffer_readfield
5049          length: 3
5050          varargs: false
5051          magic:
5052            type: buffer_readfield
5053            elem: "varint"
5054            signed: true
5055            bigendian: true
5056            typedarray: false
5057        nodejs_buffer: true
5058      - key: "writeUInt8"
5059        value:
5060          type: function
5061          native: duk_bi_buffer_writefield
5062          length: 3
5063          varargs: false
5064          magic:
5065            type: buffer_writefield
5066            elem: "8bit"
5067            signed: false
5068            bigendian: false
5069            typedarray: false
5070        nodejs_buffer: true
5071      - key: "writeInt8"
5072        value:
5073          type: function
5074          native: duk_bi_buffer_writefield
5075          length: 3
5076          varargs: false
5077          magic:
5078            type: buffer_writefield
5079            elem: "8bit"
5080            signed: true
5081            bigendian: false
5082            typedarray: false
5083        nodejs_buffer: true
5084      - key: "writeUInt16LE"
5085        value:
5086          type: function
5087          native: duk_bi_buffer_writefield
5088          length: 3
5089          varargs: false
5090          magic:
5091            type: buffer_writefield
5092            elem: "16bit"
5093            signed: false
5094            bigendian: false
5095            typedarray: false
5096        nodejs_buffer: true
5097      - key: "writeUInt16BE"
5098        value:
5099          type: function
5100          native: duk_bi_buffer_writefield
5101          length: 3
5102          varargs: false
5103          magic:
5104            type: buffer_writefield
5105            elem: "16bit"
5106            signed: false
5107            bigendian: true
5108            typedarray: false
5109        nodejs_buffer: true
5110      - key: "writeInt16LE"
5111        value:
5112          type: function
5113          native: duk_bi_buffer_writefield
5114          length: 3
5115          varargs: false
5116          magic:
5117            type: buffer_writefield
5118            elem: "16bit"
5119            signed: true
5120            bigendian: false
5121            typedarray: false
5122        nodejs_buffer: true
5123      - key: "writeInt16BE"
5124        value:
5125          type: function
5126          native: duk_bi_buffer_writefield
5127          length: 3
5128          varargs: false
5129          magic:
5130            type: buffer_writefield
5131            elem: "16bit"
5132            signed: true
5133            bigendian: true
5134            typedarray: false
5135        nodejs_buffer: true
5136      - key: "writeUInt32LE"
5137        value:
5138          type: function
5139          native: duk_bi_buffer_writefield
5140          length: 3
5141          varargs: false
5142          magic:
5143            type: buffer_writefield
5144            elem: "32bit"
5145            signed: false
5146            bigendian: false
5147            typedarray: false
5148        nodejs_buffer: true
5149      - key: "writeUInt32BE"
5150        value:
5151          type: function
5152          native: duk_bi_buffer_writefield
5153          length: 3
5154          varargs: false
5155          magic:
5156            type: buffer_writefield
5157            elem: "32bit"
5158            signed: false
5159            bigendian: true
5160            typedarray: false
5161        nodejs_buffer: true
5162      - key: "writeInt32LE"
5163        value:
5164          type: function
5165          native: duk_bi_buffer_writefield
5166          length: 3
5167          varargs: false
5168          magic:
5169            type: buffer_writefield
5170            elem: "32bit"
5171            signed: true
5172            bigendian: false
5173            typedarray: false
5174        nodejs_buffer: true
5175      - key: "writeInt32BE"
5176        value:
5177          type: function
5178          native: duk_bi_buffer_writefield
5179          length: 3
5180          varargs: false
5181          magic:
5182            type: buffer_writefield
5183            elem: "32bit"
5184            signed: true
5185            bigendian: true
5186            typedarray: false
5187        nodejs_buffer: true
5188      - key: "writeFloatLE"
5189        value:
5190          type: function
5191          native: duk_bi_buffer_writefield
5192          length: 3
5193          varargs: false
5194          magic:
5195            type: buffer_writefield
5196            elem: "float"
5197            signed: false
5198            bigendian: false
5199            typedarray: false
5200        nodejs_buffer: true
5201      - key: "writeFloatBE"
5202        value:
5203          type: function
5204          native: duk_bi_buffer_writefield
5205          length: 3
5206          varargs: false
5207          magic:
5208            type: buffer_writefield
5209            elem: "float"
5210            signed: false
5211            bigendian: true
5212            typedarray: false
5213        nodejs_buffer: true
5214      - key: "writeDoubleLE"
5215        value:
5216          type: function
5217          native: duk_bi_buffer_writefield
5218          length: 3
5219          varargs: false
5220          magic:
5221            type: buffer_writefield
5222            elem: "double"
5223            signed: false
5224            bigendian: false
5225            typedarray: false
5226        nodejs_buffer: true
5227      - key: "writeDoubleBE"
5228        value:
5229          type: function
5230          native: duk_bi_buffer_writefield
5231          length: 3
5232          varargs: false
5233          magic:
5234            type: buffer_writefield
5235            elem: "double"
5236            signed: false
5237            bigendian: true
5238            typedarray: false
5239        nodejs_buffer: true
5240      - key: "writeUIntLE"
5241        value:
5242          type: function
5243          native: duk_bi_buffer_writefield
5244          length: 4
5245          varargs: false
5246          magic:
5247            type: buffer_writefield
5248            elem: "varint"
5249            signed: false
5250            bigendian: false
5251            typedarray: false
5252        nodejs_buffer: true
5253      - key: "writeUIntBE"
5254        value:
5255          type: function
5256          native: duk_bi_buffer_writefield
5257          length: 4
5258          varargs: false
5259          magic:
5260            type: buffer_writefield
5261            elem: "varint"
5262            signed: false
5263            bigendian: true
5264            typedarray: false
5265        nodejs_buffer: true
5266      - key: "writeIntLE"
5267        value:
5268          type: function
5269          native: duk_bi_buffer_writefield
5270          length: 4
5271          varargs: false
5272          magic:
5273            type: buffer_writefield
5274            elem: "varint"
5275            signed: true
5276            bigendian: false
5277            typedarray: false
5278        nodejs_buffer: true
5279      - key: "writeIntBE"
5280        value:
5281          type: function
5282          native: duk_bi_buffer_writefield
5283          length: 4
5284          varargs: false
5285          magic:
5286            type: buffer_writefield
5287            elem: "varint"
5288            signed: true
5289            bigendian: true
5290            typedarray: false
5291        nodejs_buffer: true
5292      - key: "toString"
5293        value:
5294          type: function
5295          native: duk_bi_nodejs_buffer_tostring
5296          length: 3
5297          varargs: false
5298        nodejs_buffer: true
5299      - key: "toJSON"
5300        value:
5301          type: function
5302          native: duk_bi_nodejs_buffer_tojson
5303          length: 0
5304          varargs: false
5305        nodejs_buffer: true
5306      - key: "fill"
5307        value:
5308          type: function
5309          native: duk_bi_nodejs_buffer_fill
5310          length: 3
5311          varargs: false
5312        nodejs_buffer: true
5313      - key: "equals"
5314        value:
5315          type: function
5316          native: duk_bi_buffer_compare_shared
5317          length: 1
5318          varargs: false
5319          magic: 0  # magic = 0: equals
5320        nodejs_buffer: true
5321      - key: "compare"
5322        value:
5323          type: function
5324          native: duk_bi_buffer_compare_shared
5325          length: 1
5326          varargs: false
5327          magic: 1  # magic = 1: compare
5328        nodejs_buffer: true
5329      - key: "copy"
5330        value:
5331          type: function
5332          native: duk_bi_nodejs_buffer_copy
5333          length: 4
5334          varargs: false
5335        nodejs_buffer: true
5336      - key: "slice"
5337        value:
5338          type: function
5339          native: duk_bi_buffer_slice_shared
5340          length: 2
5341          varargs: false
5342          magic: 5  # magic: 0x01=isView, 0x02=create copy, 0x04=Node.js Buffer special
5343        nodejs_buffer: true
5344      - key: "write"
5345        value:
5346          type: function
5347          native: duk_bi_nodejs_buffer_write
5348          length: 4
5349          varargs: false
5350        nodejs_buffer: true
5351
5352  #
5353  #  CBOR
5354  #
5355
5356  - id: bi_cbor
5357    class: Object
5358    internal_prototype: bi_object_prototype
5359    bidx: false
5360    present_if: DUK_USE_CBOR_BUILTIN
5361
5362    properties:
5363      - key: "encode"
5364        value:
5365          type: function
5366          native: duk_bi_cbor_encode
5367          length: 1
5368        attributes: "wc"
5369      - key: "decode"
5370        value:
5371          type: function
5372          native: duk_bi_cbor_decode
5373          length: 1
5374        attributes: "wc"
5375
5376  #
5377  #  Encoding API
5378  #
5379
5380  - id: bi_textencoder_constructor
5381    class: Function
5382    internal_prototype: bi_function_prototype
5383    nargs: 0
5384    native: duk_bi_textencoder_constructor
5385    callable: true
5386    constructable: true
5387    bidx: false
5388    encoding_api: true
5389    present_if: DUK_USE_ENCODING_BUILTINS
5390
5391    properties:
5392      - key: "length"
5393        value: 0
5394        attributes: "c"
5395        encoding_api: true
5396      - key: "prototype"
5397        value:
5398          type: object
5399          id: bi_textencoder_prototype
5400        attributes: ""
5401        encoding_api: true
5402      - key: "name"
5403        value: "TextEncoder"
5404        attributes: "c"
5405        encoding_api: true
5406
5407  - id: bi_textencoder_prototype
5408    internal_prototype: bi_object_prototype
5409    class: Object
5410    bidx: false
5411    encoding_api: true
5412    present_if: DUK_USE_ENCODING_BUILTINS
5413
5414    properties:
5415      - key: "constructor"
5416        value:
5417          type: object
5418          id: bi_textencoder_constructor
5419        attributes: "wc"
5420        encoding_api: true
5421      - key: "encoding"
5422        value:
5423          type: accessor
5424          getter: duk_bi_textencoder_prototype_encoding_getter
5425          getter_nargs: 0
5426          getter_magic: 0
5427        attributes: "ec"
5428        encoding_api: true
5429      - key: "encode"
5430        value:
5431          type: function
5432          native: duk_bi_textencoder_prototype_encode
5433          length: 0
5434          nargs: 1
5435        attributes: "wec"
5436        encoding_api: true
5437
5438  - id: bi_textdecoder_constructor
5439    class: Function
5440    internal_prototype: bi_function_prototype
5441    nargs: 2
5442    native: duk_bi_textdecoder_constructor
5443    callable: true
5444    constructable: true
5445    bidx: false
5446    encoding_api: true
5447    present_if: DUK_USE_ENCODING_BUILTINS
5448
5449    properties:
5450      - key: "length"
5451        value: 0
5452        attributes: "c"
5453        encoding_api: true
5454      - key: "prototype"
5455        value:
5456          type: object
5457          id: bi_textdecoder_prototype
5458        attributes: ""
5459        encoding_api: true
5460      - key: "name"
5461        value: "TextDecoder"
5462        attributes: "c"
5463        encoding_api: true
5464
5465  - id: bi_textdecoder_prototype
5466    internal_prototype: bi_object_prototype
5467    class: Object
5468    bidx: false
5469    encoding_api: true
5470    present_if: DUK_USE_ENCODING_BUILTINS
5471
5472    properties:
5473      - key: "constructor"
5474        value:
5475          type: object
5476          id: bi_textdecoder_constructor
5477        attributes: "wc"
5478        encoding_api: true
5479      - key: "encoding"
5480        value:
5481          type: accessor
5482          getter: duk_bi_textdecoder_prototype_shared_getter
5483          getter_nargs: 0
5484          getter_magic: 0  # 0=encoding
5485        attributes: "ec"
5486        encoding_api: true
5487      - key: "fatal"
5488        value:
5489          type: accessor
5490          getter: duk_bi_textdecoder_prototype_shared_getter
5491          getter_nargs: 0
5492          getter_magic: 1  # 1=fatal
5493        attributes: "ec"
5494        encoding_api: true
5495      - key: "ignoreBOM"
5496        value:
5497          type: accessor
5498          getter: duk_bi_textdecoder_prototype_shared_getter
5499          getter_nargs: 0
5500          getter_magic: 2  # 2=ignoreBOM
5501        attributes: "ec"
5502        encoding_api: true
5503      - key: "decode"
5504        value:
5505          type: function
5506          native: duk_bi_textdecoder_prototype_decode
5507          length: 0
5508          nargs: 2
5509        attributes: "wec"
5510        encoding_api: true
5511
5512  - id: bi_performance
5513    internal_prototype: bi_object_prototype
5514    class: Object
5515    bidx: false
5516    performance_api: true
5517    present_if: DUK_USE_PERFORMANCE_BUILTIN
5518
5519    properties:
5520      # Firefox and Chrome: data property with 'wec' attributes,
5521      # inherited from PerformancePrototype.  Use own data property
5522      # for now.
5523      - key: "now"
5524        value:
5525          type: function
5526          native: duk_bi_performance_now
5527          length: 0
5528          nargs: 0
5529        attributes: "wec"
5530        performance_api: true
5531      # Missing until semantics decided.
5532      #- key: "timeOrigin"
5533      #  value:
5534      #    type: accessor
5535      #    getter: duk_bi_performance_timeorigin_getter
5536      #    getter_nargs: 0
5537      #    getter_magic: 0
5538      #  attributes: "ec"  # check
5539      #  performance_api: true
5540